Commit 2fb14a14 authored by Ασπασία Κατσή's avatar Ασπασία Κατσή

Merge branch 'application_preview' into 'develop'

application preview for gel student submission

See merge request itminedu/e-eggrafes!4
parents 5645e5e5 01c6eb63
......@@ -91,7 +91,7 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
constructor(private fb: FormBuilder,
private _ngRedux: NgRedux<IAppState>,
private _cfa: GelClassesActions,
private _gca: GelClassesActions,
private _ogs: OrientationGroupActions,
private _cfe: ElectiveCourseFieldsActions,
......@@ -113,7 +113,7 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
ngOnInit() {
(<any>$("#gelClassNotice")).appendTo("body");
this._cfa.getClassesList(false);
this._gca.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
......@@ -165,7 +165,9 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
public categoryselected(typeId) {
this.categoryChosen = typeId.value;
this._cfa.resetGelClassesSelected();
this._gca.resetGelClassesSelected();
this._ogs.initOrientationGroup();
this._cfe.initElectiveCourseFields();
if (this.categoryChosen == "ΗΜΕΡΗΣΙΟ" || this.categoryChosen == "ΕΣΠΕΡΙΝΟ") {
this.enableclassfilter=true;
......@@ -185,7 +187,7 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
this.showModal();
}
else {
this._cfa.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
this._gca.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
//Όταν class_id = 3 (Γ' Λυκείου - Ημερήσιο), τότε πήγαινε πρώτα στη σελίδα επιλογής για επιλογή προσανατολισμού
//και μετά στην επιλογή για μάθημα επιλογής
if (this.formGroup.value.classId === "2" || this.formGroup.value.classId === "3" || this.formGroup.value.classId === "6" || this.formGroup.value.classId === "7")
......@@ -200,15 +202,19 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
initializestore() {
this._cfa.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
this._gca.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
this.classActive=this.formGroup.value.classId;
this._cfe.initElectiveCourseFields();
this._ogs.initOrientationGroup();
if (this.classActive == 2 || this.classActive == 3 || this.classActive == 6 || this.classActive == 7 )
//Πρεπει να γινουν init και τα 2 καθε φορα
//π.χ. επιλεγει αρχικα Γ - Εσπερινο και διαλεγεις ΟΠ
//επιστρεφεις και αλλαζεις Β - Εσπερινο. Θα πρεπει να κανεις Init το ΟΠ (δεν γινεται πιο κατω)
/* if (this.classActive == 2 || this.classActive == 3 || this.classActive == 6 || this.classActive == 7 )
this._ogs.initOrientationGroup();
if (this.classActive == 1 || this.classActive == 3 || this.classActive == 4 )
this._cfe.initElectiveCourseFields();
this._cfe.initElectiveCourseFields(); */
}
}
......@@ -60,11 +60,12 @@ import { IAppState } from "../../store/store";
ngOnDestroy() {
if (this.electivecourseFieldsSub) this.electivecourseFieldsSub.unsubscribe();
if (this.gelclassesSub) this.gelclassesSub.unsubscribe();
}
selectClass() {
this._cfb.getClassesList(false);
//this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
......
......@@ -113,6 +113,7 @@ import { IAppState } from "../../store/store";
ngOnDestroy() {
(<any>$("#OrientationGroupNotice")).remove();
if (this.OrientationGroupSub) this.OrientationGroupSub.unsubscribe();
if (this.gelclassesSub) this.gelclassesSub.unsubscribe();
}
public showModal(): void {
......@@ -128,7 +129,7 @@ import { IAppState } from "../../store/store";
}
selectClass() {
this._cfb.getClassesList(false);
//this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
......
......@@ -7,6 +7,12 @@ import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { SchoolTypeActions } from "../../actions/schooltype.actions";
import { GelClassesActions } from "../../actions/gelclasses.actions";
import { OrientationGroupActions } from "../../actions/orientationgroup.action";
import { ElectiveCourseFieldsActions } from "../../actions/electivecoursesfields.actions";
import { EpalClassesActions } from "../../actions/epalclass.actions";
import { RegionSchoolsActions } from "../../actions/regionschools.actions";
import { SectorCoursesActions } from "../../actions/sectorcourses.actions";
import { SectorFieldsActions } from "../../actions/sectorfields.actions";
import { SCHOOLTYPE_INITIAL_STATE } from "../../store/schooltype/schooltype.initial-state";
import { ISchoolType, ISchoolTypeRecord, ISchoolTypeRecords } from "../../store/schooltype/schooltype.types";
......@@ -43,8 +49,8 @@ import { schooltypeReducer } from "../../store/schooltype/schooltype.reducer";
<label for="typeId">Τύπος Σχολείου:</label><br/>
<select class="form-control" formControlName="typeId" (change)="initializestore()">
<option value="0">Επιλέξτε Τύπο Σχολείου:</option>
<option value="1">ΓΕΛ - Γενικό Λύκειο</option>
<option value="2">ΕΠΑΛ - Επαγγελματικό Λύκειο</option>
<option value="1">Γενικό Λύκειο (ΓΕΛ)</option>
<option value="2">Επαγγελματικό Λύκειο (ΕΠΑΛ)</option>
</select>
</div>
......@@ -68,19 +74,22 @@ import { schooltypeReducer } from "../../store/schooltype/schooltype.reducer";
@Injectable() export default class SchoolTypeSelection implements OnInit, OnDestroy {
private schooltype$: BehaviorSubject<ISchoolTypeRecords>;
private schooltypeSub: Subscription;
private formGroup: FormGroup;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>;
public isModalShown: BehaviorSubject<boolean>;
constructor(private fb: FormBuilder,
private _ngRedux: NgRedux<IAppState>,
private _cfa: SchoolTypeActions,
private _sta: SchoolTypeActions,
private _gca: GelClassesActions,
private _ogs: OrientationGroupActions,
private _cfe: ElectiveCourseFieldsActions,
private _eca: EpalClassesActions,
private _sca: SectorCoursesActions,
private _sfa: SectorFieldsActions,
private _rsa: RegionSchoolsActions,
private router: Router) {
this.formGroup = this.fb.group({
typeId: []
......@@ -100,7 +109,6 @@ import { schooltypeReducer } from "../../store/schooltype/schooltype.reducer";
.subscribe(ecs => {
if (ecs.size > 0) {
ecs.reduce(({}, type) => {
this.formGroup.controls["typeId"].setValue(type.get("id"));
return type;
}, {});
......@@ -111,26 +119,21 @@ import { schooltypeReducer } from "../../store/schooltype/schooltype.reducer";
}, error => { console.log("error selecting schooltype"); });
}
ngOnDestroy() {
if (this.schooltypeSub)
this.schooltypeSub.unsubscribe();
(<any>$("#SchoolTypeNotice")).remove();
}
public showModal(): void {
(<any>$("#SchoolTypeNotice")).modal("show");
}
public hideModal(): void {
(<any>$("#SchoolTypeNotice")).modal("hide");
}
public onHidden(): void {
this.isModalShown.next(false);
}
navigateBack() {
this.router.navigate(["/school-type-select"]);
}
......@@ -145,19 +148,29 @@ import { schooltypeReducer } from "../../store/schooltype/schooltype.reducer";
}
else {
if (this.formGroup.value.typeId === "1"){
this._cfa.saveSchoolTypeSelected(this.formGroup.value.typeId,"ΓΕΛ");
this.router.navigate(["/gel-class-select"]);
}
else if (this.formGroup.value.typeId === "2"){
this._cfa.saveSchoolTypeSelected(this.formGroup.value.typeId,"ΕΠΑΛ");
this.router.navigate(["/epal-class-select"]);
}
}
}
initializestore() {
this._eca.initEpalClasses();
this._sfa.initSectorFields();
this._rsa.initRegionSchools();
this._sca.initSectorCourses();
this._gca.initGelClasses();
this._ogs.initOrientationGroup();
this._cfe.initElectiveCourseFields();
if (this.formGroup.value.typeId === "1"){
this._sta.saveSchoolTypeSelected(this.formGroup.value.typeId,"Γενικό Λύκειο (ΓΕΛ)");
}
else if (this.formGroup.value.typeId === "2"){
this._sta.saveSchoolTypeSelected(this.formGroup.value.typeId,"Επαγγελματικό Λύκειο (ΕΠΑΛ)");
}
}
}
......@@ -58,6 +58,7 @@ import CoursesOrderSelect from "../components/student-application-form/courses.o
import ClassSelection from "../components/student-application-form/class.selection";
import GelStudentApplicationMain from "../components/student-application-form/gelapplication.form.main";
import SchoolTypeSelection from "../components/student-application-form/schooltype.selection";
import GelApplicationPreview from "../components/student-application-form/gel.application.preview";
......@@ -110,6 +111,7 @@ export const MainRoutes: Routes = [
{ path: "gel-class-select", component: ClassSelection, canActivate: [StudentAuthGuard, StudentLockGuard]},
{ path: "gelstudent-application-form-main", component: GelStudentApplicationMain, canActivate: [StudentAuthGuard, StudentLockGuard] },
{ path: "school-type-select", component: SchoolTypeSelection, canActivate: [StudentAuthGuard, StudentLockGuard]},
{ path: "gel-application-preview", component: GelApplicationPreview, canActivate: [StudentAuthGuard, StudentLockGuard] },
];
......@@ -162,5 +164,6 @@ export const MainDeclarations = [
CoursesOrderSelect,
ClassSelection,
GelStudentApplicationMain,
SchoolTypeSelection
SchoolTypeSelection,
GelApplicationPreview
];
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