Commit d4b1a016 authored by Χάρης Παπαδόπουλος's avatar Χάρης Παπαδόπουλος
Browse files

school list now re-initialized when another sector field or course selected....

school list now re-initialized when another sector field or course selected. Also fixed unsubscribe bug
parent 41da12e0
......@@ -107,6 +107,8 @@ import {
ngOnDestroy() {
if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe();
if (this.criteriaSub) this.criteriaSub.unsubscribe();
if (this.studentDataFields$) this.studentDataFields$.unsubscribe();
if (this.criteria$) this.criteria$.unsubscribe();
}
navigateBack() {
......
......@@ -225,6 +225,11 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields
this.sectorsSub.unsubscribe();
this.sectorFieldsSub.unsubscribe();
this.studentDataFieldsSub.unsubscribe();
this.regions$.unsubscribe();
this.epalclasses$.unsubscribe();
this.sectors$.unsubscribe();
this.sectorFields$.unsubscribe();
this.studentDataFields$.unsubscribe();
}
showValues() {
......
......@@ -163,6 +163,13 @@ import {AppSettings} from '../../app.settings';
if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe();
if (this.epalclassesSub) this.epalclassesSub.unsubscribe();
if (this.loginInfoSub) this.loginInfoSub.unsubscribe();
this.regions$.unsubscribe();
this.epalclasses$.unsubscribe();
this.sectors$.unsubscribe();
this.sectorFields$.unsubscribe();
this.studentDataFields$.unsubscribe();
this.criteria$.unsubscribe();
this.loginInfo$.unsubscribe();
}
submitNow() {
......
......@@ -122,10 +122,23 @@ import {AppSettings} from '../../app.settings';
}
ngOnDestroy() {
if (this.epalclassesSub) this.epalclassesSub.unsubscribe();
if (this.regionsSub) this.regionsSub.unsubscribe();
if (this.sectorsSub) this.sectorsSub.unsubscribe();
if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe();
console.log("on destroy");
if (this.epalclassesSub) {
this.epalclassesSub.unsubscribe();
}
if (this.regionsSub) {
this.regionsSub.unsubscribe();
}
if (this.sectorsSub) {
this.sectorsSub.unsubscribe();
}
if (this.sectorFieldsSub) {
this.sectorFieldsSub.unsubscribe();
}
if (this.sectorFields$) this.sectorFields$.unsubscribe();
if (this.sectors$) this.sectors$.unsubscribe();
if (this.regions$) this.regions$.unsubscribe();
if (this.epalclasses$) this.epalclasses$.unsubscribe();
}
selectEpalClasses() {
......@@ -181,6 +194,7 @@ import {AppSettings} from '../../app.settings';
}
getAppropriateSchools(epalClass) {
if (epalClass === "Α' Λυκείου") {
this._rsa.getRegionSchools(1,"-1", false);
}
......@@ -189,6 +203,7 @@ import {AppSettings} from '../../app.settings';
state.sectorFields.reduce(({}, sectorField) =>{
if (sectorField.selected === true) {
this.courseActive = sectorField.id;
console.log(epalClass);
this._rsa.getRegionSchools(2,this.courseActive, false);
}
return sectorField;
......@@ -203,6 +218,7 @@ import {AppSettings} from '../../app.settings';
sector.courses.reduce((prevCourse, course) =>{
if (course.selected === true) {
this.courseActive = parseInt(course.course_id);
console.log(epalClass);
this._rsa.getRegionSchools(3,this.courseActive, false);
}
return course;
......
......@@ -9,7 +9,7 @@ import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import {RemoveSpaces} from '../../pipes/removespaces';
//import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import {
FormBuilder,
......@@ -74,7 +74,7 @@ import {AppSettings} from '../../app.settings';
constructor(private fb: FormBuilder,
private _sca: SectorCoursesActions,
//private _rsa: RegionSchoolsActions,
private _rsa: RegionSchoolsActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router
) {
......@@ -114,6 +114,7 @@ import {AppSettings} from '../../app.settings';
ngOnDestroy() {
if (this.sectorsSub) this.sectorsSub.unsubscribe();
this.sectors$.unsubscribe();
}
setActiveSector(ind) {
......@@ -125,11 +126,10 @@ import {AppSettings} from '../../app.settings';
saveSelected() {
this._sca.saveSectorCoursesSelected(this.formGroup.value.formArray, this.sectorsList);
//this._rsa.initRegionSchools();
this._rsa.initRegionSchools();
}
navigateToSchools() {
//this._rsa.initRegionSchools();
this.router.navigate(['/region-schools-select']);
}
......
......@@ -8,7 +8,7 @@ import { ISectorFields } from '../../store/sectorfields/sectorfields.types';
import { IAppState } from '../../store/store';
import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfields.initial-state';
//import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import {
FormBuilder,
......@@ -61,7 +61,7 @@ import {AppSettings} from '../../app.settings';
constructor(private fb: FormBuilder,
private _cfa: SectorFieldsActions,
//private _rsa: RegionSchoolsActions,
private _rsa: RegionSchoolsActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router) {
this.sectorFields$ = new BehaviorSubject(SECTOR_FIELDS_INITIAL_STATE);
......@@ -91,6 +91,7 @@ import {AppSettings} from '../../app.settings';
ngOnDestroy() {
if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe();
this.sectorFields$.unsubscribe();
}
navigateToSchools() {
......@@ -105,7 +106,7 @@ import {AppSettings} from '../../app.settings';
this._cfa.saveSectorFieldsSelected(this.formGroup.value.formArray);
//this._rsa.initRegionSchools();
this._rsa.initRegionSchools();
}
setActiveSectorAndSave(ind) {
......
......@@ -53,6 +53,7 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
{
if (this.SubmitedUsersSub)
this.SubmitedUsersSub.unsubscribe();
this.SubmitedApplic$.unsubscribe();
}
......
......@@ -65,8 +65,8 @@ import * as html2canvas from "html2canvas"
this.SubmitedDetailsSub.unsubscribe();
if (this.EpalChosenSub)
this.EpalChosenSub.unsubscribe();
this.SubmitedDetails$.unsubscribe();
this.EpalChosen$.unsubscribe();
}
ngOnInit() {
......
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