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

Merge branch 'school_list_not_updated_bug' into 'develop'

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

See merge request !44
parents 41da12e0 d4b1a016
...@@ -107,6 +107,8 @@ import { ...@@ -107,6 +107,8 @@ import {
ngOnDestroy() { ngOnDestroy() {
if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe(); if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe();
if (this.criteriaSub) this.criteriaSub.unsubscribe(); if (this.criteriaSub) this.criteriaSub.unsubscribe();
if (this.studentDataFields$) this.studentDataFields$.unsubscribe();
if (this.criteria$) this.criteria$.unsubscribe();
} }
navigateBack() { navigateBack() {
......
...@@ -225,6 +225,11 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields ...@@ -225,6 +225,11 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields
this.sectorsSub.unsubscribe(); this.sectorsSub.unsubscribe();
this.sectorFieldsSub.unsubscribe(); this.sectorFieldsSub.unsubscribe();
this.studentDataFieldsSub.unsubscribe(); this.studentDataFieldsSub.unsubscribe();
this.regions$.unsubscribe();
this.epalclasses$.unsubscribe();
this.sectors$.unsubscribe();
this.sectorFields$.unsubscribe();
this.studentDataFields$.unsubscribe();
} }
showValues() { showValues() {
......
...@@ -163,6 +163,13 @@ import {AppSettings} from '../../app.settings'; ...@@ -163,6 +163,13 @@ import {AppSettings} from '../../app.settings';
if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe(); if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe();
if (this.epalclassesSub) this.epalclassesSub.unsubscribe(); if (this.epalclassesSub) this.epalclassesSub.unsubscribe();
if (this.loginInfoSub) this.loginInfoSub.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() { submitNow() {
......
...@@ -122,10 +122,23 @@ import {AppSettings} from '../../app.settings'; ...@@ -122,10 +122,23 @@ import {AppSettings} from '../../app.settings';
} }
ngOnDestroy() { ngOnDestroy() {
if (this.epalclassesSub) this.epalclassesSub.unsubscribe(); console.log("on destroy");
if (this.regionsSub) this.regionsSub.unsubscribe(); if (this.epalclassesSub) {
if (this.sectorsSub) this.sectorsSub.unsubscribe(); this.epalclassesSub.unsubscribe();
if (this.sectorFieldsSub) this.sectorFieldsSub.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() { selectEpalClasses() {
...@@ -181,6 +194,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -181,6 +194,7 @@ import {AppSettings} from '../../app.settings';
} }
getAppropriateSchools(epalClass) { getAppropriateSchools(epalClass) {
if (epalClass === "Α' Λυκείου") { if (epalClass === "Α' Λυκείου") {
this._rsa.getRegionSchools(1,"-1", false); this._rsa.getRegionSchools(1,"-1", false);
} }
...@@ -189,6 +203,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -189,6 +203,7 @@ import {AppSettings} from '../../app.settings';
state.sectorFields.reduce(({}, sectorField) =>{ state.sectorFields.reduce(({}, sectorField) =>{
if (sectorField.selected === true) { if (sectorField.selected === true) {
this.courseActive = sectorField.id; this.courseActive = sectorField.id;
console.log(epalClass);
this._rsa.getRegionSchools(2,this.courseActive, false); this._rsa.getRegionSchools(2,this.courseActive, false);
} }
return sectorField; return sectorField;
...@@ -203,6 +218,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -203,6 +218,7 @@ import {AppSettings} from '../../app.settings';
sector.courses.reduce((prevCourse, course) =>{ sector.courses.reduce((prevCourse, course) =>{
if (course.selected === true) { if (course.selected === true) {
this.courseActive = parseInt(course.course_id); this.courseActive = parseInt(course.course_id);
console.log(epalClass);
this._rsa.getRegionSchools(3,this.courseActive, false); this._rsa.getRegionSchools(3,this.courseActive, false);
} }
return course; return course;
......
...@@ -9,7 +9,7 @@ import { NgRedux, select } from 'ng2-redux'; ...@@ -9,7 +9,7 @@ import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store'; import { IAppState } from '../../store/store';
import {RemoveSpaces} from '../../pipes/removespaces'; import {RemoveSpaces} from '../../pipes/removespaces';
//import { RegionSchoolsActions } from '../../actions/regionschools.actions'; import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { import {
FormBuilder, FormBuilder,
...@@ -74,7 +74,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -74,7 +74,7 @@ import {AppSettings} from '../../app.settings';
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
private _sca: SectorCoursesActions, private _sca: SectorCoursesActions,
//private _rsa: RegionSchoolsActions, private _rsa: RegionSchoolsActions,
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private router: Router private router: Router
) { ) {
...@@ -114,6 +114,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -114,6 +114,7 @@ import {AppSettings} from '../../app.settings';
ngOnDestroy() { ngOnDestroy() {
if (this.sectorsSub) this.sectorsSub.unsubscribe(); if (this.sectorsSub) this.sectorsSub.unsubscribe();
this.sectors$.unsubscribe();
} }
setActiveSector(ind) { setActiveSector(ind) {
...@@ -125,11 +126,10 @@ import {AppSettings} from '../../app.settings'; ...@@ -125,11 +126,10 @@ import {AppSettings} from '../../app.settings';
saveSelected() { saveSelected() {
this._sca.saveSectorCoursesSelected(this.formGroup.value.formArray, this.sectorsList); this._sca.saveSectorCoursesSelected(this.formGroup.value.formArray, this.sectorsList);
//this._rsa.initRegionSchools(); this._rsa.initRegionSchools();
} }
navigateToSchools() { navigateToSchools() {
//this._rsa.initRegionSchools();
this.router.navigate(['/region-schools-select']); this.router.navigate(['/region-schools-select']);
} }
......
...@@ -8,7 +8,7 @@ import { ISectorFields } from '../../store/sectorfields/sectorfields.types'; ...@@ -8,7 +8,7 @@ import { ISectorFields } from '../../store/sectorfields/sectorfields.types';
import { IAppState } from '../../store/store'; import { IAppState } from '../../store/store';
import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfields.initial-state'; import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfields.initial-state';
//import { RegionSchoolsActions } from '../../actions/regionschools.actions'; import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { import {
FormBuilder, FormBuilder,
...@@ -61,7 +61,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -61,7 +61,7 @@ import {AppSettings} from '../../app.settings';
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
private _cfa: SectorFieldsActions, private _cfa: SectorFieldsActions,
//private _rsa: RegionSchoolsActions, private _rsa: RegionSchoolsActions,
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private router: Router) { private router: Router) {
this.sectorFields$ = new BehaviorSubject(SECTOR_FIELDS_INITIAL_STATE); this.sectorFields$ = new BehaviorSubject(SECTOR_FIELDS_INITIAL_STATE);
...@@ -91,6 +91,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -91,6 +91,7 @@ import {AppSettings} from '../../app.settings';
ngOnDestroy() { ngOnDestroy() {
if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe(); if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe();
this.sectorFields$.unsubscribe();
} }
navigateToSchools() { navigateToSchools() {
...@@ -105,7 +106,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -105,7 +106,7 @@ import {AppSettings} from '../../app.settings';
this._cfa.saveSectorFieldsSelected(this.formGroup.value.formArray); this._cfa.saveSectorFieldsSelected(this.formGroup.value.formArray);
//this._rsa.initRegionSchools(); this._rsa.initRegionSchools();
} }
setActiveSectorAndSave(ind) { setActiveSectorAndSave(ind) {
......
...@@ -17,7 +17,7 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx'; ...@@ -17,7 +17,7 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
@Component({ @Component({
selector: 'submited-preview', selector: 'submited-preview',
template: ` template: `
Έχει υποβληθεί αίτηση για εγγραφή στην Επαγγελματική Εκπαίδευση των παρακάτω ατόμων: Έχει υποβληθεί αίτηση για εγγραφή στην Επαγγελματική Εκπαίδευση των παρακάτω ατόμων:
<table class = "submited"> <table class = "submited">
<tr> <tr>
<th>Όνομα</th> <th>Όνομα</th>
...@@ -30,19 +30,19 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx'; ...@@ -30,19 +30,19 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
<td>{{UserData$.studentsurname}} </td> <td>{{UserData$.studentsurname}} </td>
<td> <button type="button" (click)="studentpreview(UserData$.id)"> <i class="fa fa-eye" aria-hidden="true"></i> </button> </td> <td> <button type="button" (click)="studentpreview(UserData$.id)"> <i class="fa fa-eye" aria-hidden="true"></i> </button> </td>
</tr> </tr>
` `
}) })
@Injectable() export default class SubmitedPreview implements OnInit , OnDestroy{ @Injectable() export default class SubmitedPreview implements OnInit , OnDestroy{
private SubmitedApplic$: BehaviorSubject<any>; private SubmitedApplic$: BehaviorSubject<any>;
private SubmitedUsersSub: Subscription; private SubmitedUsersSub: Subscription;
public StudentId; public StudentId;
constructor(private _hds: HelperDataService, constructor(private _hds: HelperDataService,
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private router: Router ) private router: Router )
{ {
...@@ -53,21 +53,22 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx'; ...@@ -53,21 +53,22 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
{ {
if (this.SubmitedUsersSub) if (this.SubmitedUsersSub)
this.SubmitedUsersSub.unsubscribe(); this.SubmitedUsersSub.unsubscribe();
this.SubmitedApplic$.unsubscribe();
} }
ngOnInit() { ngOnInit() {
this.SubmitedUsersSub = this._hds.getSubmittedPreviw().subscribe(this.SubmitedApplic$); this.SubmitedUsersSub = this._hds.getSubmittedPreviw().subscribe(this.SubmitedApplic$);
console.log(this.SubmitedApplic$); console.log(this.SubmitedApplic$);
} }
studentpreview(StudentId) studentpreview(StudentId)
{ {
...@@ -75,4 +76,4 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx'; ...@@ -75,4 +76,4 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
} }
} }
\ No newline at end of file
...@@ -35,23 +35,23 @@ import * as html2canvas from "html2canvas" ...@@ -35,23 +35,23 @@ import * as html2canvas from "html2canvas"
Σχολείο: {{epalChoices$.epal_id}} Σχολείο: {{epalChoices$.epal_id}}
Σειρά Προτίμισης:{{epalChoices$.choice_no}} Σειρά Προτίμισης:{{epalChoices$.choice_no}}
</div> </div>
</div> </div>
<button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button> <button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
` `
}) })
@Injectable() export default class SubmitedStudentDetails implements OnInit , OnDestroy{ @Injectable() export default class SubmitedStudentDetails implements OnInit , OnDestroy{
private SubmitedDetails$: BehaviorSubject<any>; private SubmitedDetails$: BehaviorSubject<any>;
private SubmitedDetailsSub: Subscription; private SubmitedDetailsSub: Subscription;
private EpalChosen$: BehaviorSubject<any>; private EpalChosen$: BehaviorSubject<any>;
private EpalChosenSub: Subscription; private EpalChosenSub: Subscription;
public StudentId: Number; public StudentId: Number;
constructor(private _hds: HelperDataService, constructor(private _hds: HelperDataService,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router ) private router: Router )
{ {
...@@ -65,17 +65,17 @@ import * as html2canvas from "html2canvas" ...@@ -65,17 +65,17 @@ import * as html2canvas from "html2canvas"
this.SubmitedDetailsSub.unsubscribe(); this.SubmitedDetailsSub.unsubscribe();
if (this.EpalChosenSub) if (this.EpalChosenSub)
this.EpalChosenSub.unsubscribe(); this.EpalChosenSub.unsubscribe();
this.SubmitedDetails$.unsubscribe();
this.EpalChosen$.unsubscribe();
} }
ngOnInit() { ngOnInit() {
this.getApplicationId(); this.getApplicationId();
this.SubmitedDetailsSub = this._hds.getStudentDetails(this.StudentId).subscribe(this.SubmitedDetails$); this.SubmitedDetailsSub = this._hds.getStudentDetails(this.StudentId).subscribe(this.SubmitedDetails$);
this.EpalChosenSub = this._hds.getEpalchosen(this.StudentId).subscribe(this.EpalChosen$); this.EpalChosenSub = this._hds.getEpalchosen(this.StudentId).subscribe(this.EpalChosen$);
} }
...@@ -86,7 +86,7 @@ import * as html2canvas from "html2canvas" ...@@ -86,7 +86,7 @@ import * as html2canvas from "html2canvas"
createPdf() createPdf()
{ {
html2canvas(document.getElementById("target")).then(function(canvas) html2canvas(document.getElementById("target")).then(function(canvas)
{ {
var img = canvas.toDataURL(); var img = canvas.toDataURL();
...@@ -96,5 +96,5 @@ import * as html2canvas from "html2canvas" ...@@ -96,5 +96,5 @@ import * as html2canvas from "html2canvas"
}); });
} }
} }
\ No newline at end of file
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