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) {
......
......@@ -17,7 +17,7 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
@Component({
selector: 'submited-preview',
template: `
Έχει υποβληθεί αίτηση για εγγραφή στην Επαγγελματική Εκπαίδευση των παρακάτω ατόμων:
Έχει υποβληθεί αίτηση για εγγραφή στην Επαγγελματική Εκπαίδευση των παρακάτω ατόμων:
<table class = "submited">
<tr>
<th>Όνομα</th>
......@@ -30,19 +30,19 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
<td>{{UserData$.studentsurname}} </td>
<td> <button type="button" (click)="studentpreview(UserData$.id)"> <i class="fa fa-eye" aria-hidden="true"></i> </button> </td>
</tr>
`
})
@Injectable() export default class SubmitedPreview implements OnInit , OnDestroy{
private SubmitedApplic$: BehaviorSubject<any>;
private SubmitedUsersSub: Subscription;
public StudentId;
constructor(private _hds: HelperDataService,
constructor(private _hds: HelperDataService,
private activatedRoute: ActivatedRoute,
private router: Router )
{
......@@ -53,21 +53,22 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
{
if (this.SubmitedUsersSub)
this.SubmitedUsersSub.unsubscribe();
this.SubmitedApplic$.unsubscribe();
}
ngOnInit() {
this.SubmitedUsersSub = this._hds.getSubmittedPreviw().subscribe(this.SubmitedApplic$);
console.log(this.SubmitedApplic$);
}
studentpreview(StudentId)
{
......@@ -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"
Σχολείο: {{epalChoices$.epal_id}}
Σειρά Προτίμισης:{{epalChoices$.choice_no}}
</div>
</div>
<button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
<button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
`
})
@Injectable() export default class SubmitedStudentDetails implements OnInit , OnDestroy{
private SubmitedDetails$: BehaviorSubject<any>;
private SubmitedDetailsSub: Subscription;
private EpalChosen$: BehaviorSubject<any>;
private EpalChosenSub: Subscription;
public StudentId: Number;
constructor(private _hds: HelperDataService,
constructor(private _hds: HelperDataService,
private route: ActivatedRoute,
private router: Router )
{
......@@ -65,17 +65,17 @@ import * as html2canvas from "html2canvas"
this.SubmitedDetailsSub.unsubscribe();
if (this.EpalChosenSub)
this.EpalChosenSub.unsubscribe();
this.SubmitedDetails$.unsubscribe();
this.EpalChosen$.unsubscribe();
}
ngOnInit() {
this.getApplicationId();
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"
createPdf()
{
html2canvas(document.getElementById("target")).then(function(canvas)
{
var img = canvas.toDataURL();
......@@ -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