Merge branch 'edge_v4' into 'develop_v4'

Restructured IStudentDataFields

See merge request !240
parents 5cee655c f109b9cf
...@@ -4,7 +4,7 @@ import { Injectable } from "@angular/core"; ...@@ -4,7 +4,7 @@ import { Injectable } from "@angular/core";
import { Router } from "@angular/router"; import { Router } from "@angular/router";
import { NgRedux, select } from "@angular-redux/store"; import { NgRedux, select } from "@angular-redux/store";
import { StudentDataFieldsActions } from "../../actions/studentdatafields.actions"; import { StudentDataFieldsActions } from "../../actions/studentdatafields.actions";
import { IStudentDataFields } from "../../store/studentdatafields/studentdatafields.types"; import { IStudentDataFieldRecords } from "../../store/studentdatafields/studentdatafields.types";
import { IAppState } from "../../store/store"; import { IAppState } from "../../store/store";
import { VALID_NAMES_PATTERN, VALID_UCASE_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_DIGITS_PATTERN, import { VALID_NAMES_PATTERN, VALID_UCASE_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_DIGITS_PATTERN,
VALID_DATE_PATTERN, FIRST_SCHOOL_YEAR, VALID_YEAR_PATTERN, VALID_TELEPHONE_PATTERN } from "../../constants"; VALID_DATE_PATTERN, FIRST_SCHOOL_YEAR, VALID_YEAR_PATTERN, VALID_TELEPHONE_PATTERN } from "../../constants";
...@@ -30,7 +30,7 @@ import { ...@@ -30,7 +30,7 @@ import {
@Injectable() export default class StudentApplicationMain implements OnInit { @Injectable() export default class StudentApplicationMain implements OnInit {
private loginInfo$: BehaviorSubject<ILoginInfo>; private loginInfo$: BehaviorSubject<ILoginInfo>;
private studentDataFields$: BehaviorSubject<IStudentDataFields>; private studentDataFields$: BehaviorSubject<IStudentDataFieldRecords>;
private studentDataFieldsSub: Subscription; private studentDataFieldsSub: Subscription;
private loginInfoSub: Subscription; private loginInfoSub: Subscription;
...@@ -112,23 +112,23 @@ import { ...@@ -112,23 +112,23 @@ import {
this.studentDataFieldsSub = this._ngRedux.select("studentDataFields") this.studentDataFieldsSub = this._ngRedux.select("studentDataFields")
.subscribe(studentDataFields => { .subscribe(studentDataFields => {
let sdfds = <IStudentDataFields>studentDataFields; let sdfds = <IStudentDataFieldRecords>studentDataFields;
if (sdfds.size > 0) { if (sdfds.size > 0) {
sdfds.reduce(({}, studentDataField) => { sdfds.reduce(({}, studentDataField) => {
this.studentDataGroup.controls["name"].setValue(studentDataField.name); this.studentDataGroup.controls["name"].setValue(studentDataField.get("name"));
this.studentDataGroup.controls["studentsurname"].setValue(studentDataField.studentsurname); this.studentDataGroup.controls["studentsurname"].setValue(studentDataField.get("studentsurname"));
this.studentDataGroup.controls["fatherfirstname"].setValue(studentDataField.fatherfirstname); this.studentDataGroup.controls["fatherfirstname"].setValue(studentDataField.get("fatherfirstname"));
this.studentDataGroup.controls["motherfirstname"].setValue(studentDataField.motherfirstname); this.studentDataGroup.controls["motherfirstname"].setValue(studentDataField.get("motherfirstname"));
this.studentDataGroup.controls["regionaddress"].setValue(studentDataField.regionaddress); this.studentDataGroup.controls["regionaddress"].setValue(studentDataField.get("regionaddress"));
this.studentDataGroup.controls["regiontk"].setValue(studentDataField.regiontk); this.studentDataGroup.controls["regiontk"].setValue(studentDataField.get("regiontk"));
this.studentDataGroup.controls["regionarea"].setValue(studentDataField.regionarea); this.studentDataGroup.controls["regionarea"].setValue(studentDataField.get("regionarea"));
this.studentDataGroup.controls["lastschool_schoolname"].setValue(studentDataField.lastschool_schoolname); this.studentDataGroup.controls["lastschool_schoolname"].setValue(studentDataField.get("lastschool_schoolname"));
this.studentDataGroup.controls["lastschool_schoolyear"].setValue(studentDataField.lastschool_schoolyear); this.studentDataGroup.controls["lastschool_schoolyear"].setValue(studentDataField.get("lastschool_schoolyear"));
this.studentDataGroup.controls["lastschool_class"].setValue(studentDataField.lastschool_class); this.studentDataGroup.controls["lastschool_class"].setValue(studentDataField.get("lastschool_class"));
this.studentDataGroup.controls["relationtostudent"].setValue(studentDataField.relationtostudent); this.studentDataGroup.controls["relationtostudent"].setValue(studentDataField.get("relationtostudent"));
this.studentDataGroup.controls["telnum"].setValue(studentDataField.telnum); this.studentDataGroup.controls["telnum"].setValue(studentDataField.get("telnum"));
this.studentDataGroup.controls["studentbirthdate"].setValue(this.populateDate(studentDataField.studentbirthdate)); this.studentDataGroup.controls["studentbirthdate"].setValue(this.populateDate(studentDataField.get("studentbirthdate")));
return studentDataField; return studentDataField;
}, {}); }, {});
} }
......
...@@ -5,7 +5,7 @@ import { BehaviorSubject, Subscription } from "rxjs/Rx"; ...@@ -5,7 +5,7 @@ import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { NgRedux, select } from "@angular-redux/store"; import { NgRedux, select } from "@angular-redux/store";
import { IAppState } from "../../store/store"; import { IAppState } from "../../store/store";
import { IStudentDataFields } from "../../store/studentdatafields/studentdatafields.types"; import { IStudentDataFieldRecords } from "../../store/studentdatafields/studentdatafields.types";
import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from "../../store/regionschools/regionschools.types"; import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from "../../store/regionschools/regionschools.types";
import { ISectors } from "../../store/sectorcourses/sectorcourses.types"; import { ISectors } from "../../store/sectorcourses/sectorcourses.types";
import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types"; import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types";
...@@ -74,30 +74,30 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -74,30 +74,30 @@ import { HelperDataService } from "../../services/helper-data-service";
<div *ngFor="let studentDataField$ of studentDataFields$ | async;"> <div *ngFor="let studentDataField$ of studentDataFields$ | async;">
<div class="row oddin" style="margin: 0px 2px 20px 2px; line-height: 2em;"> <div class="row oddin" style="margin: 0px 2px 20px 2px; line-height: 2em;">
<div class="col-md-3" style="font-size: 0.8em;">Διεύθυνση</div> <div class="col-md-3" style="font-size: 0.8em;">Διεύθυνση</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.regionaddress}}</div> <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.get("regionaddress")}}</div>
<div class="col-md-3" style="font-size: 0.8em;">ΤΚ - Πόλη</div> <div class="col-md-3" style="font-size: 0.8em;">ΤΚ - Πόλη</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.regiontk}} - {{studentDataField$.regionarea}}</div> <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.get("regiontk")}} - {{studentDataField$.get("regionarea")}}</div>
</div> </div>
<div class="row evenin" style="margin: 20px 2px 10px 2px; line-height: 2em;"> <div class="row evenin" style="margin: 20px 2px 10px 2px; line-height: 2em;">
<div class="col-md-12" style="font-size: 1.5em; font-weight: bold; text-align: center;">Στοιχεία μαθητή</div> <div class="col-md-12" style="font-size: 1.5em; font-weight: bold; text-align: center;">Στοιχεία μαθητή</div>
</div> </div>
<div><label for="name">Όνομα μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.name}} </p> </div> <div><label for="name">Όνομα μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("name")}} </p> </div>
<div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.studentsurname}} </p></div> <div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("studentsurname")}} </p></div>
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.fatherfirstname}} </p></div> <div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("fatherfirstname")}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.motherfirstname}} </p></div> <div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("motherfirstname")}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.studentbirthdate}} </p></div> <div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("studentbirthdate")}} </p></div>
<div><label for="lastschool_schoolname">Σχολείο τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.lastschool_schoolname.name}} </p></div> <div><label for="lastschool_schoolname">Σχολείο τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("lastschool_schoolname").name}} </p></div>
<div><label for="lastschool_schoolyear">Σχολικό έτος τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.lastschool_schoolyear}} </p></div> <div><label for="lastschool_schoolyear">Σχολικό έτος τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("lastschool_schoolyear")}} </p></div>
<div *ngIf="studentDataField$.lastschool_class === 1"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Α'</p></div> <div *ngIf="studentDataField$.get('lastschool_class') === 1"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Α'</p></div>
<div *ngIf="studentDataField$.lastschool_class === 2"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Β'</p></div> <div *ngIf="studentDataField$.get('lastschool_class') === 2"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Β'</p></div>
<div *ngIf="studentDataField$.lastschool_class === 3"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Γ'</p></div> <div *ngIf="studentDataField$.get('lastschool_class') === 3"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Γ'</p></div>
<div *ngIf="studentDataField$.lastschool_class === 4"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Δ'</p></div> <div *ngIf="studentDataField$.get('lastschool_class') === 4"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Δ'</p></div>
<div><label for="relationtostudent">Η δήλωση προτίμησης γίνεται από</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.relationtostudent}} </p></div> <div><label for="relationtostudent">Η δήλωση προτίμησης γίνεται από</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("relationtostudent")}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.telnum}} </p></div> <div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.get("telnum")}} </p></div>
</div> </div>
<div class="row" style="margin-top: 20px; margin-bottom: 20px;"> <div class="row" style="margin-top: 20px; margin-bottom: 20px;">
<div class="col-md-6"> <div class="col-md-6">
...@@ -123,7 +123,7 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -123,7 +123,7 @@ import { HelperDataService } from "../../services/helper-data-service";
private sectorSelected; private sectorSelected;
private classSelected; private classSelected;
private totalPoints = <number>0; private totalPoints = <number>0;
private studentDataFields$: BehaviorSubject<IStudentDataFields>; private studentDataFields$: BehaviorSubject<IStudentDataFieldRecords>;
private epalclasses$: BehaviorSubject<IEpalClasses>; private epalclasses$: BehaviorSubject<IEpalClasses>;
private loginInfo$: BehaviorSubject<ILoginInfo>; private loginInfo$: BehaviorSubject<ILoginInfo>;
private studentDataFieldsSub: Subscription; private studentDataFieldsSub: Subscription;
...@@ -205,7 +205,7 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -205,7 +205,7 @@ import { HelperDataService } from "../../services/helper-data-service";
this.studentDataFieldsSub = this._ngRedux.select("studentDataFields") this.studentDataFieldsSub = this._ngRedux.select("studentDataFields")
.subscribe(studentDataFields => { .subscribe(studentDataFields => {
this.studentDataFields$.next(<IStudentDataFields>studentDataFields); this.studentDataFields$.next(<IStudentDataFieldRecords>studentDataFields);
}, error => { console.log("error selecting studentDataFields"); }); }, error => { console.log("error selecting studentDataFields"); });
this.regionsSub = this._ngRedux.select("regions"). this.regionsSub = this._ngRedux.select("regions").
...@@ -296,25 +296,25 @@ import { HelperDataService } from "../../services/helper-data-service"; ...@@ -296,25 +296,25 @@ import { HelperDataService } from "../../services/helper-data-service";
let std = this.studentDataFields$.getValue().get(0); let std = this.studentDataFields$.getValue().get(0);
aitisiObj[0] = <any>{}; aitisiObj[0] = <any>{};
aitisiObj[0].name = std.name; aitisiObj[0].name = std.get("name");
aitisiObj[0].studentsurname = std.studentsurname; aitisiObj[0].studentsurname = std.get("studentsurname");
aitisiObj[0].studentbirthdate = std.studentbirthdate; aitisiObj[0].studentbirthdate = std.get("studentbirthdate");
aitisiObj[0].fatherfirstname = std.fatherfirstname; aitisiObj[0].fatherfirstname = std.get("fatherfirstname");
aitisiObj[0].motherfirstname = std.motherfirstname; aitisiObj[0].motherfirstname = std.get("motherfirstname");
aitisiObj[0].regionaddress = std.regionaddress; aitisiObj[0].regionaddress = std.get("regionaddress");
aitisiObj[0].regionarea = std.regionarea; aitisiObj[0].regionarea = std.get("regionarea");
aitisiObj[0].regiontk = std.regiontk; aitisiObj[0].regiontk = std.get("regiontk");
aitisiObj[0].certificatetype = ""; aitisiObj[0].certificatetype = "";
aitisiObj[0].graduation_year = 0; aitisiObj[0].graduation_year = 0;
aitisiObj[0].lastschool_registrynumber = std.lastschool_schoolname.registry_no; aitisiObj[0].lastschool_registrynumber = std.get("lastschool_schoolname").registry_no;
aitisiObj[0].lastschool_schoolname = std.lastschool_schoolname.name; aitisiObj[0].lastschool_schoolname = std.get("lastschool_schoolname").name;
aitisiObj[0].lastschool_schoolyear = std.lastschool_schoolyear; aitisiObj[0].lastschool_schoolyear = std.get("lastschool_schoolyear");
aitisiObj[0].lastschool_unittypeid = std.lastschool_schoolname.unit_type_id; aitisiObj[0].lastschool_unittypeid = std.get("lastschool_schoolname").unit_type_id;
aitisiObj[0].lastschool_class = std.lastschool_class; aitisiObj[0].lastschool_class = std.get("lastschool_class");
aitisiObj[0].relationtostudent = std.relationtostudent; aitisiObj[0].relationtostudent = std.get("relationtostudent");
aitisiObj[0].telnum = std.telnum; aitisiObj[0].telnum = std.get("telnum");
aitisiObj[0].cu_name = this.cu_name; aitisiObj[0].cu_name = this.cu_name;
aitisiObj[0].cu_surname = this.cu_surname; aitisiObj[0].cu_surname = this.cu_surname;
......
...@@ -4,7 +4,7 @@ import { IAppState, rootReducer, deimmutify } from "./store"; ...@@ -4,7 +4,7 @@ import { IAppState, rootReducer, deimmutify } from "./store";
import { ISectorFieldRecord, ISectorFieldRecords } from "./sectorfields/sectorfields.types"; import { ISectorFieldRecord, ISectorFieldRecords } from "./sectorfields/sectorfields.types";
import { IRRegion, IRRegionSchool, IRegionRecord, IRegionRecords, IRegionSchoolRecord, IRegionSchoolRecords } from "./regionschools/regionschools.types"; import { IRRegion, IRRegionSchool, IRegionRecord, IRegionRecords, IRegionSchoolRecord, IRegionSchoolRecords } from "./regionschools/regionschools.types";
import { ISectors, ISector, ISectorCourse } from "./sectorcourses/sectorcourses.types"; import { ISectors, ISector, ISectorCourse } from "./sectorcourses/sectorcourses.types";
import { IStudentDataField, IStudentDataFields } from "./studentdatafields/studentdatafields.types"; import { IStudentDataFieldRecord, IStudentDataFieldRecords } from "./studentdatafields/studentdatafields.types";
import { IEpalClass, IEpalClasses } from "./epalclasses/epalclasses.types"; import { IEpalClass, IEpalClasses } from "./epalclasses/epalclasses.types";
import { ILoginInfoToken, ILoginInfo } from "./logininfo/logininfo.types"; import { ILoginInfoToken, ILoginInfo } from "./logininfo/logininfo.types";
...@@ -22,8 +22,8 @@ IRRegionSchool, ...@@ -22,8 +22,8 @@ IRRegionSchool,
ISectors, ISectors,
ISector, ISector,
ISectorCourse, ISectorCourse,
IStudentDataField, IStudentDataFieldRecord,
IStudentDataFields, IStudentDataFieldRecords,
IEpalClass, IEpalClass,
IEpalClasses, IEpalClasses,
ILoginInfo, ILoginInfo,
......
/* import { List } from "immutable";
import { ISectorField } from "./sectorfields.types";
export const SECTOR_FIELDS_INITIAL_STATE = List<ISectorField>(); */
import { List } from "immutable"; import { List } from "immutable";
import { ISectorFieldRecord, ISectorField } from "./sectorfields.types"; import { ISectorFieldRecord } from "./sectorfields.types";
import {recordify} from "typed-immutable-record";
export const SECTOR_FIELDS_INITIAL_STATE = List<ISectorFieldRecord>(); export const SECTOR_FIELDS_INITIAL_STATE = List<ISectorFieldRecord>();
import { ISectorFieldRecords, ISectorFieldRecord, ISectorField } from "./sectorfields.types"; import { ISectorFieldRecords, ISectorFieldRecord, ISectorField } from "./sectorfields.types";
import { SECTOR_FIELDS_INITIAL_STATE } from "./sectorfields.initial-state"; import { SECTOR_FIELDS_INITIAL_STATE } from "./sectorfields.initial-state";
import { Seq, List } from "immutable"; import { List } from "immutable";
import {recordify} from "typed-immutable-record"; import {recordify} from "typed-immutable-record";
import { import {
......
...@@ -10,7 +10,7 @@ export interface IAppState { ...@@ -10,7 +10,7 @@ export interface IAppState {
sectorFields?: sectorFields.ISectorFieldRecords; sectorFields?: sectorFields.ISectorFieldRecords;
regions?: regions.IRegionRecords; regions?: regions.IRegionRecords;
sectors?: sectors.ISectors; sectors?: sectors.ISectors;
studentDataFields?: studentDataFields.IStudentDataFields; studentDataFields?: studentDataFields.IStudentDataFieldRecords;
epalclasses?: epalclasses.IEpalClasses; epalclasses?: epalclasses.IEpalClasses;
loginInfo?: loginInfo.ILoginInfo; loginInfo?: loginInfo.ILoginInfo;
}; };
......
import { IStudentDataField, IStudentDataFields } from "./studentdatafields.types"; import { IStudentDataFieldRecord, IStudentDataFieldRecords } from "./studentdatafields.types";
import { studentDataFieldsReducer } from "./studentdatafields.reducer"; import { studentDataFieldsReducer } from "./studentdatafields.reducer";
import { deimmutifyStudentDataFields } from "./studentdatafields.transformers"; import { deimmutifyStudentDataFields } from "./studentdatafields.transformers";
export { export {
IStudentDataField, IStudentDataFieldRecord,
IStudentDataFields, IStudentDataFieldRecords,
studentDataFieldsReducer, studentDataFieldsReducer,
deimmutifyStudentDataFields, deimmutifyStudentDataFields,
}; };
import { List } from "immutable"; import { List } from "immutable";
import { IStudentDataField } from "./studentdatafields.types"; import { IStudentDataFieldRecord } from "./studentdatafields.types";
export const STUDENT_DATA_FIELDS_INITIAL_STATE = List<IStudentDataField>(); export const STUDENT_DATA_FIELDS_INITIAL_STATE = List<IStudentDataFieldRecord>();
import { IStudentDataFields, IStudentDataField } from "./studentdatafields.types"; import { IStudentDataFieldRecords, IStudentDataFieldRecord, IStudentDataField } from "./studentdatafields.types";
import { STUDENT_DATA_FIELDS_INITIAL_STATE } from "./studentdatafields.initial-state"; import { STUDENT_DATA_FIELDS_INITIAL_STATE } from "./studentdatafields.initial-state";
import { Seq } from "immutable"; import {recordify} from "typed-immutable-record";
import { List } from "immutable";
import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_INIT } from "../../constants"; import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_INIT } from "../../constants";
export function studentDataFieldsReducer(state: IStudentDataFields = STUDENT_DATA_FIELDS_INITIAL_STATE, action): IStudentDataFields { export function studentDataFieldsReducer(state: IStudentDataFieldRecords = STUDENT_DATA_FIELDS_INITIAL_STATE, action): IStudentDataFieldRecords {
switch (action.type) { switch (action.type) {
case STUDENTDATAFIELDS_SAVE: case STUDENTDATAFIELDS_SAVE:
let studentDataFields = Array<IStudentDataField>(); let studentDataFields = Array<IStudentDataFieldRecord>();
let ind = 0;
action.payload.studentDataFields.forEach(studentDataField => { action.payload.studentDataFields.forEach(studentDataField => {
let transformedDate = ""; let transformedDate = "";
...@@ -16,16 +16,12 @@ export function studentDataFieldsReducer(state: IStudentDataFields = STUDENT_DAT ...@@ -16,16 +16,12 @@ export function studentDataFieldsReducer(state: IStudentDataFields = STUDENT_DAT
transformedDate += studentDataField.studentbirthdate.date.month < 10 ? "0" + studentDataField.studentbirthdate.date.month + "-" : studentDataField.studentbirthdate.date.month + "-"; transformedDate += studentDataField.studentbirthdate.date.month < 10 ? "0" + studentDataField.studentbirthdate.date.month + "-" : studentDataField.studentbirthdate.date.month + "-";
transformedDate += studentDataField.studentbirthdate.date.day < 10 ? "0" + studentDataField.studentbirthdate.date.day : studentDataField.studentbirthdate.date.day; transformedDate += studentDataField.studentbirthdate.date.day < 10 ? "0" + studentDataField.studentbirthdate.date.day : studentDataField.studentbirthdate.date.day;
} }
// transformedDate = studentDataField.studentbirthdate.jsDate;
studentDataField.studentbirthdate = transformedDate; studentDataField.studentbirthdate = transformedDate;
studentDataFields.push(recordify<IStudentDataField, IStudentDataFieldRecord>(studentDataField));
studentDataFields.push(<IStudentDataField>studentDataField);
ind++;
}); });
return Seq(studentDataFields).map(n => n).toList(); return List(studentDataFields);
case STUDENTDATAFIELDS_INIT: case STUDENTDATAFIELDS_INIT:
return STUDENT_DATA_FIELDS_INITIAL_STATE; return STUDENT_DATA_FIELDS_INITIAL_STATE;
default: return state; default: return state;
......
import { IStudentDataFields, IStudentDataField } from "./studentdatafields.types"; import { IStudentDataFieldRecords } from "./studentdatafields.types";
export function deimmutifyStudentDataFields(state: IStudentDataFields): IStudentDataField[] { export function deimmutifyStudentDataFields(state: IStudentDataFieldRecords): IStudentDataFieldRecords {
let fetchedStudentDataFields = new Array(); return state;
state.forEach(studentdataField => {
fetchedStudentDataFields.push(<IStudentDataField>{
epaluser_id: studentdataField.epaluser_id,
name: studentdataField.name, studentsurname: studentdataField.studentsurname, studentbirthdate: studentdataField.studentbirthdate,
fatherfirstname: studentdataField.fatherfirstname, fathersurname: studentdataField.fathersurname,
motherfirstname: studentdataField.motherfirstname, mothersurname: studentdataField.mothersurname,
studentamka: studentdataField.studentamka, regionaddress: studentdataField.regionaddress,
regiontk: studentdataField.regiontk, regionarea: studentdataField.regionarea,
lastschool_schoolname: studentdataField.lastschool_schoolname,
lastschool_schoolyear: studentdataField.lastschool_schoolyear,
lastschool_class: studentdataField.lastschool_class,
relationtostudent: studentdataField.relationtostudent,
currentclass: studentdataField.currentclass, points: studentdataField.points
});
});
return fetchedStudentDataFields;
}; };
import { List } from "immutable"; import { List } from "immutable";
import {TypedRecord} from "typed-immutable-record";
export interface IStudentDataField { export interface IStudentDataField {
epaluser_id: number; epaluser_id: number;
...@@ -22,4 +23,6 @@ export interface IStudentDataField { ...@@ -22,4 +23,6 @@ export interface IStudentDataField {
telnum: string; telnum: string;
} }
export type IStudentDataFields = List<IStudentDataField>; export interface IStudentDataFieldRecord extends TypedRecord<IStudentDataFieldRecord>, IStudentDataField { };
export type IStudentDataFieldRecords = List<IStudentDataFieldRecord>;
// export type IStudentDataFields = List<IStudentDataField>;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment