NgRedux.select rewrite(WIP)

parent f4987505
......@@ -68,35 +68,37 @@ export default class HeaderComponent implements OnInit, OnDestroy {
ngOnInit() {
(<any>$("#headerNotice")).appendTo("body");
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
this.cuName = loginInfoToken.cu_name;
return loginInfoToken;
}, {});
if (this.hasvalue == false)
{
this.showLoader.next(true);
this.TotalStudentsSub = this._hds.findTotalStudents().subscribe(x => {
this.TotalStudents$.next(x);
this.showLoader.next(false);
this.hasvalue = true;
},
error => {
this.TotalStudents$.next([{}]);
console.log("Error Getting courses perSchool");
this.loginInfoSub = this._ngRedux.select('loginInfo')
.map(loginInfo => <ILoginInfo>loginInfo)
.subscribe(loginInfo => {
if (loginInfo.size > 0) {
loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
this.cuName = loginInfoToken.cu_name;
return loginInfoToken;
}, {});
if (this.hasvalue == false)
{
this.showLoader.next(true);
this.TotalStudentsSub = this._hds.findTotalStudents().subscribe(x => {
this.TotalStudents$.next(x);
this.showLoader.next(false);
});
this.hasvalue = true;
},
error => {
this.TotalStudents$.next([{}]);
console.log("Error Getting courses perSchool");
this.showLoader.next(false);
});
}
}
}
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.loginInfo$.next(loginInfo);
});
......
import {Router, ActivatedRoute, Params} from '@angular/router';
import {OnInit, Component} from '@angular/core';
import {OnInit, OnDestroy, Component} from '@angular/core';
import { LoginInfoActions } from '../actions/logininfo.actions';
import { ILoginInfo } from '../store/logininfo/logininfo.types';
import { NgRedux, select } from '@angular-redux/store';
import { Observable } from 'rxjs/Rx';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { IAppState } from '../store/store';
import { HelperDataService } from '../services/helper-data-service';
import { CookieService } from 'ngx-cookie';
import { STUDENT_ROLE } from '../constants';
import { LOGININFO_INITIAL_STATE } from "../store/logininfo/logininfo.initial-state";
import {
FormBuilder,
FormGroup,
......@@ -27,16 +28,16 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings';
<p>
<strong>Ανακοίνωση:</strong> Παρακαλείσθε να μην καταχωρείτε δήλωση προτίμησης επιλέγοντας τα παρακάτω:</p>
<ul>
<li> 9ο ΕΠΑ.Λ. Πειραιά, Β τάξη, Τομέας Ναυτιλιακών Επαγγελμάτων, Γ τάξη-Ειδικότητες Πλοίαρχος Εμπορικού Ναυτικού, Μηχανικός Εμπορικού Ναυτικού
<li> 9ο ΕΠΑ.Λ. Πειραιά, Β τάξη, Τομέας Ναυτιλιακών Επαγγελμάτων, Γ τάξη-Ειδικότητες Πλοίαρχος Εμπορικού Ναυτικού, Μηχανικός Εμπορικού Ναυτικού
</li>
<li> 1ο ΕΠΑ.Λ. Δάφνης, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
<li> 1ο ΕΠΑ.Λ. Δάφνης, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
</li>
<li> 1ο Ημερήσιο ΕΠΑ.Λ. Σιβιτανιδείου, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
<li> 1ο Ημερήσιο ΕΠΑ.Λ. Σιβιτανιδείου, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
</li>
</ul>
<p>Τα τμήματα έχουν πληρότητα από την 1η περίοδο κατανομής.
</p>
</div>
</div>
......@@ -56,15 +57,16 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings';
`
})
export default class Home implements OnInit {
export default class Home implements OnInit, OnDestroy {
public formGroup: FormGroup;
private authToken: string;
private authRole: string;
private name: any;
private xcsrftoken: any;
private loginInfo$: Observable<ILoginInfo>;
private loginInfo$: BehaviorSubject<ILoginInfo>;
private apiEndPoint = API_ENDPOINT;
private apiEndPointParams = API_ENDPOINT_PARAMS;
private loginInfoSub: Subscription;
constructor(private fb: FormBuilder,
private _ata: LoginInfoActions,
......@@ -79,13 +81,15 @@ export default class Home implements OnInit {
this.name = '';
this.formGroup = this.fb.group({
});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
};
ngOnInit() {
this.loginInfo$ = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.loginInfoSub = this._ngRedux.select('loginInfo').subscribe(loginInfo => {
let linfo=<ILoginInfo>loginInfo;
if (linfo.size > 0) {
linfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
if (this.authToken && this.authToken.length > 0 && this.authRole && this.authRole === STUDENT_ROLE) {
......@@ -99,8 +103,8 @@ export default class Home implements OnInit {
}, {});
}
return state.loginInfo;
});
this.loginInfo$.next(linfo);
}, error => {console.log("error selecting loginInfo");});
// subscribe to router event
this.activatedRoute.queryParams.subscribe((params: Params) => {
......@@ -115,6 +119,10 @@ export default class Home implements OnInit {
});
}
ngOnDestroy () {
if (this.loginInfoSub) this.loginInfoSub.unsubscribe();
}
getCookie(key: string){
return this._cookieService.get(key);
}
......
import { Router, Params} from '@angular/router';
import { OnInit, Component} from '@angular/core';
import { OnInit, OnDestroy, Component} from '@angular/core';
import { LoginInfoActions } from '../actions/logininfo.actions';
import { ILoginInfo } from '../store/logininfo/logininfo.types';
import { NgRedux, select } from '@angular-redux/store';
import { Observable } from 'rxjs/Rx';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { IAppState } from '../store/store';
import { HelperDataService } from '../services/helper-data-service';
import {Http, Response, RequestOptions} from '@angular/http';
import { LOGININFO_INITIAL_STATE } from "../store/logininfo/logininfo.initial-state";
import {
FormBuilder,
FormGroup,
......@@ -57,14 +58,15 @@ import { API_ENDPOINT } from '../app.settings';
`
})
export default class MinistryHome implements OnInit {
export default class MinistryHome implements OnInit, OnDestroy {
public userDataGroup: FormGroup;
private authRole: string;
private mineduUsername: string;
//private mineduPassword: string;
//private cuName: string;
private validLogin: number;
private loginInfo$: Observable<ILoginInfo>;
private loginInfo$: BehaviorSubject<ILoginInfo>;
private loginInfoSub: Subscription;
private apiEndPoint = API_ENDPOINT;
constructor(private fb: FormBuilder,
......@@ -89,22 +91,29 @@ export default class MinistryHome implements OnInit {
cu_name: [''],
auth_role: [''],
});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
};
ngOnInit() {
this.loginInfo$ = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.mineduUsername = loginInfoToken.minedu_username;
//this.mineduPassword = loginInfoToken.minedu_userpassword;
if (this.mineduUsername && this.mineduUsername.length > 0)
this.router.navigate(['/ministry/minister-settings']);
return loginInfoToken;
}, {});
}
return state.loginInfo;
});
this.loginInfoSub = this._ngRedux.select('loginInfo')
.subscribe(loginInfo => {
let linfo = <ILoginInfo>loginInfo;
if (linfo.size > 0) {
linfo.reduce(({}, loginInfoToken) => {
this.mineduUsername = loginInfoToken.minedu_username;
//this.mineduPassword = loginInfoToken.minedu_userpassword;
if (this.mineduUsername && this.mineduUsername.length > 0)
this.router.navigate(['/ministry/minister-settings']);
return loginInfoToken;
}, {});
}
this.loginInfo$.next(linfo);
}, error => {console.log("error selecting loginInfo");});
}
ngOnDestroy() {
if (this.loginInfoSub) this.loginInfoSub.unsubscribe();
}
submitCredentials() {
......
......@@ -87,26 +87,28 @@ export default class SchoolHome implements OnInit, OnDestroy {
};
ngOnInit() {
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({ }, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
if (this.authToken && this.authToken.length > 0) {
if (this.authRole === "director") {
this.router.navigate(["/school/director-buttons"]);
this.loginInfoSub = this._ngRedux.select('loginInfo')
.subscribe(loginInfo => {
let linfo=<ILoginInfo>loginInfo;
if (linfo.size > 0) {
linfo.reduce(({ }, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
if (this.authToken && this.authToken.length > 0) {
if (this.authRole === "director") {
this.router.navigate(["/school/director-buttons"]);
}
else if (this.authRole === "pde")
this.router.navigate(["/school/perfecture-view"]);
else if (this.authRole === "dide")
this.router.navigate(["/school/eduadmin-view"]);
}
else if (this.authRole === "pde")
this.router.navigate(["/school/perfecture-view"]);
else if (this.authRole === "dide")
this.router.navigate(["/school/eduadmin-view"]);
}
return loginInfoToken;
}, {});
}
return loginInfoToken;
}, {});
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.loginInfo$.next(linfo);
});
// subscribe to router event
this.activatedRoute.queryParams.subscribe((params: Params) => {
......
......@@ -38,7 +38,6 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action
private authToken: string;
private authRole: string;
private cuName: string;
private loginInfo$: BehaviorSubject<ILoginInfo>;
public cuser: any;
private showLoader$: BehaviorSubject<boolean>;
private loginInfoSub: Subscription;
......@@ -59,25 +58,24 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action
};
ngOnInit() {
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
this.cuName = loginInfoToken.cu_name;
return loginInfoToken;
}, {})
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
}
this.loginInfoSub = this._ngRedux.select('loginInfo')
.subscribe(loginInfo => {
let linfo = <ILoginInfo>loginInfo;
if (linfo.size > 0) {
linfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
this.cuName = loginInfoToken.cu_name;
return loginInfoToken;
}, {});
}
}, error => {console.log("error selecting epalclasses")});
};
ngOnDestroy() {
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
}
};
signOut() {
this.showLoader$.next(true);
......
......@@ -32,17 +32,17 @@ import {
@Injectable() export default class StudentApplicationMain implements OnInit {
private loginInfo$: BehaviorSubject<ILoginInfo>;
private studentDataFields$: BehaviorSubject<IStudentDataFields>;
private criteria$: BehaviorSubject<ICriter>;
private studentDataFieldsSub: Subscription;
private loginInfoSub: Subscription;
private criteriaSub: Subscription;
public studentDataGroup: FormGroup;
public studentCriteriaGroup: FormGroup;
private loginInfo$: BehaviorSubject<ILoginInfo>;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>;
......@@ -84,11 +84,11 @@ import {
private router: Router,
private http: Http) {
this.populateSchoolyears();
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE);
this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE);
this.studentDataGroup = this.fb.group({
......@@ -111,45 +111,41 @@ import {
ngOnInit() {
(<any>$("#applicationFormNotice")).appendTo("body");
this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
return loginInfoToken;
}, {});
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.studentDataFieldsSub = this._ngRedux.select(state => {
if (state.studentDataFields.size > 0) {
state.studentDataFields.reduce(({}, studentDataField) => {
this.studentDataGroup.controls["name"].setValue(studentDataField.name);
this.studentDataGroup.controls["studentsurname"].setValue(studentDataField.studentsurname);
this.studentDataGroup.controls["fatherfirstname"].setValue(studentDataField.fatherfirstname);
this.studentDataGroup.controls["motherfirstname"].setValue(studentDataField.motherfirstname);
this.studentDataGroup.controls["regionaddress"].setValue(studentDataField.regionaddress);
this.studentDataGroup.controls["regiontk"].setValue(studentDataField.regiontk);
this.studentDataGroup.controls["regionarea"].setValue(studentDataField.regionarea);
this.studentDataGroup.controls["lastschool_schoolname"].setValue(studentDataField.lastschool_schoolname);
this.studentDataGroup.controls["lastschool_schoolyear"].setValue(studentDataField.lastschool_schoolyear);
this.studentDataGroup.controls["lastschool_class"].setValue(studentDataField.lastschool_class);
this.studentDataGroup.controls["relationtostudent"].setValue(studentDataField.relationtostudent);
this.studentDataGroup.controls["telnum"].setValue(studentDataField.telnum);
this.studentDataGroup.controls["studentbirthdate"].setValue(this.populateDate(studentDataField.studentbirthdate));
return studentDataField;
}, {});
}
return state.studentDataFields;
}).subscribe(this.studentDataFields$);
this.loginInfoSub = this._ngRedux.select('loginInfo')
.subscribe(loginInfo => {
this.loginInfo$.next(<ILoginInfo>loginInfo);
}, error => {console.log("error selecting loginInfo");});
this.studentDataFieldsSub = this._ngRedux.select('studentDataFields')
.subscribe(studentDataFields => {
let sdfds = <IStudentDataFields>studentDataFields;
if (sdfds.size > 0) {
sdfds.reduce(({}, studentDataField) => {
this.studentDataGroup.controls["name"].setValue(studentDataField.name);
this.studentDataGroup.controls["studentsurname"].setValue(studentDataField.studentsurname);
this.studentDataGroup.controls["fatherfirstname"].setValue(studentDataField.fatherfirstname);
this.studentDataGroup.controls["motherfirstname"].setValue(studentDataField.motherfirstname);
this.studentDataGroup.controls["regionaddress"].setValue(studentDataField.regionaddress);
this.studentDataGroup.controls["regiontk"].setValue(studentDataField.regiontk);
this.studentDataGroup.controls["regionarea"].setValue(studentDataField.regionarea);
this.studentDataGroup.controls["lastschool_schoolname"].setValue(studentDataField.lastschool_schoolname);
this.studentDataGroup.controls["lastschool_schoolyear"].setValue(studentDataField.lastschool_schoolyear);
this.studentDataGroup.controls["lastschool_class"].setValue(studentDataField.lastschool_class);
this.studentDataGroup.controls["relationtostudent"].setValue(studentDataField.relationtostudent);
this.studentDataGroup.controls["telnum"].setValue(studentDataField.telnum);
this.studentDataGroup.controls["studentbirthdate"].setValue(this.populateDate(studentDataField.studentbirthdate));
return studentDataField;
}, {});
}
this.studentDataFields$.next(sdfds);
}, error => {console.log("error selecting studentDataFields");});
};
ngOnDestroy() {
(<any>$("#applicationFormNotice")).remove();
if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe();
if (this.studentDataFields$) this.studentDataFields$.unsubscribe();
if (this.loginInfo$) this.loginInfo$.unsubscribe();
}
navigateBack() {
......
......@@ -66,7 +66,7 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel
</ul>
</div>
<ul *ngIf="(regions$ | async)" class="list-group left-side-view" style="margin-bottom: 20px;">
<ul *ngIf="(selectedSchools$ | async)" class="list-group left-side-view" style="margin-bottom: 20px;">
<div *ngFor="let epal$ of selectedSchools$ | async; let i=index; let isOdd=odd; let isEven=even" >
......@@ -107,67 +107,68 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel
ngOnInit() {
this.currentUrl = this.router.url;
this.sectorsSub = this._ngRedux.select(state => {
state.sectors.reduce((prevSector, sector) => {
sector.courses.reduce((prevCourse, course) => {
if (course.selected === true) {
this.courseActive = course.course_id;
}
return course;
this.sectorsSub = this._ngRedux.select('sectors')
.subscribe(sectors => {
let scs = <ISectors>sectors;
scs.reduce((prevSector, sector) => {
sector.courses.reduce((prevCourse, course) => {
if (course.selected === true) {
this.courseActive = course.course_id;
}
return course;
}, {});
return sector;
}, {});
return sector;
}, {});
//this.numSelectedCourses = numsel;
return state.sectors;
}).subscribe(this.sectors$);
this.regionsSub = this._ngRedux.select(state => {
let numsel = 0, numsel2 = 0;
let selectedSchools = Array<IRegionSchoolRecord>();
if (state.regions.size === 0)
return;
state.regions.reduce((prevRegion, region) => {
region.get("epals").reduce((prevEpal, epal) => {
if (epal.get("selected") === true) {
numsel++;
selectedSchools.push(epal);
}
if (epal.get("order_id") !== 0) {
numsel2++;
}
return epal;
this.sectors$.next(scs);
});
this.regionsSub = this._ngRedux.select('regions')
.subscribe(regions => {
let rgns = <IRegionRecords>regions;
let numsel = 0, numsel2 = 0;
let selectedSchools = Array<IRegionSchoolRecord>();
if (rgns.size === 0)
return;
rgns.reduce((prevRegion, region) => {
region.get("epals").reduce((prevEpal, epal) => {
if (epal.get("selected") === true) {
numsel++;
selectedSchools.push(epal);
}
if (epal.get("order_id") !== 0) {
numsel2++;
}
return epal;
}, {});
return region;
}, {});
return region;
}, {});
this.numSelectedSchools = numsel;
this.numSelectedOrder = numsel2;
this.selectedSchools$.next(selectedSchools.sort(this.compareSchools));
// this.selectedSchools$.next(selectedSchools);
return state.regions;
}).subscribe(this.regions$);
this.sectorFieldsSub = this._ngRedux.select(state => {
state.sectorFields.reduce(({}, sectorField) => {
return sectorField;
}, {});
return state.sectorFields;
}).subscribe(this.sectorFields$);
this.epalclassesSub = this._ngRedux.select(state => {
state.epalclasses.reduce(({}, epalclass) => {
if (epalclass.name === "Α' Λυκείου")
this.classSelected = 1;
else if (epalclass.name === "Β' Λυκείου")
this.classSelected = 2;
else if (epalclass.name === "Γ' Λυκείου")
this.classSelected = 3;
else if (epalclass.name === "Δ' Λυκείου")
this.classSelected = 4;
return epalclass;
}, {});
return state.epalclasses;
}).subscribe(this.epalclasses$);
this.numSelectedSchools = numsel;
this.numSelectedOrder = numsel2;
this.selectedSchools$.next(selectedSchools.sort(this.compareSchools));
});
this.sectorFieldsSub = this._ngRedux.select('sectorFields')
.subscribe(sectorFields => {
this.sectorFields$.next(<ISectorFields>sectorFields);
}, error => {console.log("error selecting sectorFields");});
this.epalclassesSub = this._ngRedux.select('epalclasses')
.subscribe(epalclasses => {
let ecs = <IEpalClasses>epalclasses;
ecs.reduce(({}, epalclass) => {
if (epalclass.name === "Α' Λυκείου")
this.classSelected = 1;
else if (epalclass.name === "Β' Λυκείου")
this.classSelected = 2;
else if (epalclass.name === "Γ' Λυκείου")
this.classSelected = 3;
else if (epalclass.name === "Δ' Λυκείου")
this.classSelected = 4;
return epalclass;
}, {});
this.epalclasses$.next(ecs);
}, error => {console.log("error selecting epalclasses");});
}
......
......@@ -124,8 +124,6 @@ import { HelperDataService } from "../../services/helper-data-service";
private classSelected;
private totalPoints = <number>0;
private studentDataFields$: BehaviorSubject<IStudentDataFields>;
private sectors$: BehaviorSubject<ISectors>;
private sectorFields$: BehaviorSubject<ISectorFields>;
private epalclasses$: BehaviorSubject<IEpalClasses>;
private loginInfo$: BehaviorSubject<ILoginInfo>;
private studentDataFieldsSub: Subscription;
......@@ -160,8 +158,6 @@ import { HelperDataService } from "../../services/helper-data-service";
// this.regions$ = new BehaviorSubject(REGION_SCHOOLS_INITIAL_STATE);
this.epalclasses$ = new BehaviorSubject(EPALCLASSES_INITIAL_STATE);
this.sectors$ = new BehaviorSubject(SECTOR_COURSES_INITIAL_STATE);
this.sectorFields$ = new BehaviorSubject(SECTOR_FIELDS_INITIAL_STATE);
this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE);
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
......@@ -175,38 +171,42 @@ import { HelperDataService } from "../../services/helper-data-service";
ngOnInit() {
(<any>$("#studentFormSentNotice")).appendTo("body");
this.loginInfoSub = this._ngRedux.select(state => {
console.log("SELECTOR5");
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({ }, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.cu_name = loginInfoToken.cu_name;
this.cu_surname = loginInfoToken.cu_surname;
this.cu_fathername = loginInfoToken.cu_fathername;
this.cu_mothername = loginInfoToken.cu_mothername;
this.disclaimer_checked = loginInfoToken.disclaimer_checked;
return loginInfoToken;
}, {});
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.loginInfoSub = this._ngRedux.select('loginInfo')
.subscribe(loginInfo => {
let linfo = <ILoginInfo>loginInfo;
console.log("SELECTOR5");
if (linfo.size > 0) {
linfo.reduce(({ }, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.cu_name = loginInfoToken.cu_name;
this.cu_surname = loginInfoToken.cu_surname;
this.cu_fathername = loginInfoToken.cu_fathername;
this.cu_mothername = loginInfoToken.cu_mothername;
this.disclaimer_checked = loginInfoToken.disclaimer_checked;
return loginInfoToken;
}, {});
}
this.loginInfo$.next(linfo);
}, error => {console.log("error selecting loginInfo")});
this.epalclassesSub = this._ngRedux.select(state => {
this.epalclassesSub = this._ngRedux.select('epalclasses').subscribe(epalclasses => {
let ecs = <IEpalClasses>epalclasses;
console.log("SELECTOR4");
if (state.epalclasses.size > 0) {
state.epalclasses.reduce(({ }, epalclass) => {
if (ecs.size > 0) {
ecs.reduce(({ }, epalclass) => {
this.classSelected = epalclass.name;
return epalclass;
}, {});
}
return state.epalclasses;
}).subscribe(this.epalclasses$);
this.epalclasses$.next(ecs);
}, error => {console.log("error selecting epalclasses")});
this.studentDataFieldsSub = this._ngRedux.select(state => {
return state.studentDataFields;
}).subscribe(this.studentDataFields$);
this.studentDataFieldsSub = this._ngRedux.select('studentDataFields')
.subscribe(studentDataFields => {
this.studentDataFields$.next(<IStudentDataFields>studentDataFields);
}, error => {console.log("error selecting studentDataFields")});
/* this.regionsSub = this._ngRedux.select((state) => {
console.log("SELECTOR3");
......@@ -250,30 +250,32 @@ import { HelperDataService } from "../../services/helper-data-service";
);
this.sectorsSub = this._ngRedux.select(state => {
console.log("SELECTOR2");
state.sectors.reduce((prevSector, sector) => {
sector.courses.reduce((prevCourse, course) => {
if (course.selected === true) {
this.courseSelected = course.course_id;
this.sectorsSub = this._ngRedux.select('sectors')
.subscribe(sectors => {