transfered CurrentUser Controller to Oauthost Module, modified CurrentUser...

transfered CurrentUser Controller to Oauthost Module, modified CurrentUser Controller, modified front-end navigation routes, modified OrientationGroup Component
parent be87e3df
epal.user.send_verification_code:
path: '/epal/user/sendvercode'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\CurrentUser::sendVerificationCode'
requirements:
_user_is_logged_in: 'TRUE'
epal.user.verify_verification_code:
path: '/epal/user/verifyvercode'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\CurrentUser::verifyVerificationCode'
requirements:
_user_is_logged_in: 'TRUE'
epal.user.save_profile:
path: '/epal/user/save'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\CurrentUser::saveUserProfile'
requirements:
_user_is_logged_in: 'TRUE'
epal.user.get_data:
path: '/epal/userdata'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\CurrentUser::getEpalUserData'
requirements:
_user_is_logged_in: 'TRUE'
epal.current_user:
path: '/epal/curuser'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\CurrentUser::getLoginInfo'
requirements:
_user_is_logged_in: 'TRUE'
epal.applicationdetails:
path: '/epal/application/{studentId}'
options:
......@@ -435,4 +395,4 @@ epal.undomergeall:
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::UndoMergeAll'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
_user_is_logged_in: 'TRUE'
......@@ -16,7 +16,7 @@ class Crypt
if (is_string($fname)) {
$this->fname = $fname;
} else {
$this->fname = __DIR__ . "/../../../../../app.txt";
$this->fname = __DIR__ . "/../../../app.txt";
}
}
......
......@@ -18,3 +18,44 @@ oauthost.log_out_go:
_controller: '\Drupal\oauthost\Controller\OAuthLogout::logoutGo'
requirements:
_user_is_logged_in: 'TRUE'
oauthost.user.send_verification_code:
path: '/oauth/user/sendvercode'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\oauthost\Controller\CurrentUser::sendVerificationCode'
requirements:
_user_is_logged_in: 'TRUE'
oauthost.user.verify_verification_code:
path: '/oauth/user/verifyvercode'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\oauthost\Controller\CurrentUser::verifyVerificationCode'
requirements:
_user_is_logged_in: 'TRUE'
oauthost.user.save_profile:
path: '/oauth/user/save'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\oauthost\Controller\CurrentUser::saveUserProfile'
requirements:
_user_is_logged_in: 'TRUE'
oauthost.user.get_data:
path: '/oauth/userdata'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\oauthost\Controller\CurrentUser::getApplicantUserData'
requirements:
_user_is_logged_in: 'TRUE'
oauthost.current_user:
path: '/oauth/curuser'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\oauthost\Controller\CurrentUser::getLoginInfo'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -16,7 +16,7 @@ class Crypt
if (is_string($fname)) {
$this->fname = $fname;
} else {
$this->fname = __DIR__ . "/../../../../../app.txt";
$this->fname = __DIR__ . "/../../../app.txt";
}
}
......
{
"name": "e-gel",
"description": "e-GEL student registration system for Greek Ministry of Education",
"name": "e-eggrafes",
"description": "e-eggrafes student registration system for Greek Ministry of Education",
"license": "EUPL-1.1",
"repository": {
"type": "git",
"url": "https://git.minedu.gov.gr/itminedu/e-gel.git"
"url": "https://git.minedu.gov.gr/itminedu/e-eggrafes.git"
},
"scripts": {
"start": "webpack-dashboard -- webpack --progress --colors --watch --display-error-details --display-cached",
......
......@@ -26,7 +26,7 @@ export class OrientationGroupActions {
}
};
/*
saveOrientationGroupSelected = (prevChoice: number, newChoice: number) => {
return this._ngRedux.dispatch({
type: ORIENTATIONGROUP_SAVE,
......@@ -36,9 +36,23 @@ export class OrientationGroupActions {
}
});
};
*/
saveOrientationGroupSelected = (newChoice: number, isSelected: number) => {
return this._ngRedux.dispatch({
type: ORIENTATIONGROUP_SAVE,
payload: {
newChoice: newChoice,
isSelected: isSelected,
}
});
};
initOrientationGroup = () => {
return this._ngRedux.dispatch({
type: ORIENTATIONGROUP_INIT,
......
......@@ -139,7 +139,7 @@ import {
//new
//this.showLoader.next(true);
this.epalUserDataSub = this.hds.getEpalUserData().subscribe(x => {
this.epalUserDataSub = this.hds.getApplicantUserData().subscribe(x => {
this.epalUserData$.next(x);
this.numAppSelf.next(Number(x.numAppSelf));
this.numAppChildren.next(Number(x.numAppChildren));
......
......@@ -6,6 +6,8 @@ import { Router } from "@angular/router";
import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { GelClassesActions } from "../../actions/gelclasses.actions";
import { OrientationGroupActions } from "../../actions/orientationgroup.action";
import { ElectiveCourseFieldsActions } from "../../actions/electivecoursesfields.actions";
import { GELCLASSES_INITIAL_STATE } from "../../store/gelclasses/gelclasses.initial-state";
import { IGelClass, IGelClassRecord, IGelClassRecords } from "../../store/gelclasses/gelclasses.types";
import { IAppState } from "../../store/store";
......@@ -81,18 +83,17 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
private enableclassfilter: boolean;
private classActive=0;
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: GelClassesActions,
private _ogs: OrientationGroupActions,
private _cfe: ElectiveCourseFieldsActions,
private router: Router) {
this.formGroup = this.fb.group({
classId: [],
......@@ -178,16 +179,28 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
}
else {
this._cfa.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
if (this.formGroup.value.classId != "0")
//this.router.navigate(["/orientation-group-select"]);
this.router.navigate(["/electivecourse-fields-select"]);
//Όταν class_id = 3 (Γ' Λυκείου - Ημερήσιο), τότε πήγαινε πρώτα στη σελίδα επιλογής για επιλογή προσανατολισμού
//και μετά στην επιλογή για μάθημα επιλογής
if (this.formGroup.value.classId === "2" || this.formGroup.value.classId === "3" || this.formGroup.value.classId === "6" || this.formGroup.value.classId === "7")
this.router.navigate(["/orientation-group-select"]);
else if (this.formGroup.value.classId === "1" || this.formGroup.value.classId === "4")
this.router.navigate(["/electivecourse-fields-select"]);
else if (this.formGroup.value.classId === "5")
this.router.navigate(["/gelstudent-application-form-main"]);
}
}
initializestore() {
this._cfa.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
this.classActive=this.formGroup.value.classId;
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();
}
}
......@@ -7,6 +7,8 @@ import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { ElectiveCourseFieldsActions } from "../../actions/electivecoursesfields.actions";
import { ELECTIVECOURSE_FIELDS_INITIAL_STATE } from "../../store/electivecoursesfields/electivecoursesfields.initial-state";
import { IElectiveCourseFieldRecords, IElectiveCourseFieldRecord } from "../../store/electivecoursesfields/electivecoursesfields.types";
import { GelClassesActions } from "../../actions/gelclasses.actions";
import { IGelClass, IGelClassRecord, IGelClassRecords } from "../../store/gelclasses/gelclasses.types";
import { IAppState } from "../../store/store";
......@@ -78,6 +80,7 @@ import { IAppState } from "../../store/store";
private electivecourseFields$: BehaviorSubject<IElectiveCourseFieldRecords>;
private electivecourseFieldsSub: Subscription;
private gelclassesSub: Subscription;
private selectedCourses$: BehaviorSubject<Array<IElectiveCourseFieldRecord>> = new BehaviorSubject(Array());
private nonselectedCourses$: BehaviorSubject<Array<IElectiveCourseFieldRecord>> = new BehaviorSubject(Array());
private modalTitle: BehaviorSubject<string>;
......@@ -85,8 +88,10 @@ import { IAppState } from "../../store/store";
private modalHeader: BehaviorSubject<string>;
public isModalShown: BehaviorSubject<boolean>;
private electivecourseSelected = <number>0;
private activeClassId = -1;
constructor(private _cfa: ElectiveCourseFieldsActions,
private _cfb: GelClassesActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router) {
this.electivecourseFields$ = new BehaviorSubject(ELECTIVECOURSE_FIELDS_INITIAL_STATE);
......@@ -102,6 +107,20 @@ import { IAppState } from "../../store/store";
(<any>$("#electivecourseNotice")).appendTo("body");
this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
if (ecs.size > 0) {
ecs.reduce(({}, gelclass) => {
if (gelclass.get("selected")===true ){
this.activeClassId = gelclass.get("id");
}
return gelclass;
}, {});
}
}, error => { console.log("error selecting gelclasses"); });
this.electivecourseFieldsSub = this._ngRedux.select("electivecourseFields")
.map(electivecourseFields => <IElectiveCourseFieldRecords>electivecourseFields)
.subscribe(sfds => {
......@@ -204,14 +223,17 @@ import { IAppState } from "../../store/store";
else {
this.updateStore();
this.router.navigate(["/gelstudent-application-form-main"]);
//this.router.navigate(["/langcourse-fields-select"]);
}
}
navigateBack() {
this.updateStore();
this.router.navigate(["/intro-statement"]);
if (this.activeClassId == 3)
this.router.navigate(["/orientation-group-select"]);
else
this.router.navigate(["/gel-class-select"]);
}
}
......@@ -196,8 +196,8 @@ import { IAppState } from "../../store/store";
} else {
this._lia.saveStatementAgree(this.formGroup.controls["disclaimerChecked"].value);
//this.router.navigate(["epal-class-select"]);
this.router.navigate(["gel-class-select"]);
this.router.navigate(["epal-class-select"]);
//this.router.navigate(["gel-class-select"]);
}
}
}
......@@ -21,17 +21,16 @@ import { IAppState } from "../../store/store";
<breadcrumbs></breadcrumbs>
</div>
<h4> Επιλογή Μαθήματος Επιλογής </h4>
<div class = "loading" *ngIf="(electivecourseFields$ | async).size === 0">
</div>
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ επιλέξτε το μάθημα επιλογής το οποίο θα παρακολουθήσει ο μαθητής το νέο σχολικό έτος.
<div class = "loading" *ngIf=" !(electivecourseFields$ | async) || (electivecourseFields$ | async).size === 0"></div>
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ επιλέξτε το μάθημα επιλογής το οποίο θα παρακολουθήσει ο μαθητής το νέο σχολικό έτος.
Μπορείτε να επιλέξετε / απο-επιλέξετε περισσότερες προτιμήσεις, κάνοντας κλικ πάνω στην αντίστοιχη επιλογή.
Σε περίπτωση περισσοτέρων της μίας επιλογής, βάλτε τις επιλογές σας σε επιθυμητή σειρά προτίμησης στην εμφανιζόμενη λίστα στο κάτω μέρος της οθόνης.
Έπειτα επιλέξτε <i>Συνέχεια</i>.</p>
<div class="list-group" *ngFor="let electivecourseField$ of electivecourseFields$ | async; let i=index;">
<button *ngIf = "electivecourseField$.selected === true" type="button" class="list-group-item list-group-item-action active" (click)="saveSelected(i, 1)" >{{electivecourseField$.name}}</button>
<button *ngIf = "electivecourseField$.selected === false" type="button" class="list-group-item list-group-item-action" (click)="saveSelected(i, 0)" >{{electivecourseField$.name}}</button>
</div>
</div>
<div>
<course-order-select></course-order-select>
</div>
......@@ -43,7 +42,7 @@ import { IAppState } from "../../store/store";
private electivecourseFields$: BehaviorSubject<IElectiveCourseFieldRecords>;
private electivecourseFieldsSub: Subscription;
private gelclassesSub: Subscription;
private activeClassId: number;
//private activeClassId: number;
constructor(private _cfa: ElectiveCourseFieldsActions,
private _cfb: GelClassesActions,
......@@ -54,7 +53,16 @@ import { IAppState } from "../../store/store";
ngOnInit() {
this.activeClassId = -1;
//this.activeClassId = -1;
this.selectClass();
}
ngOnDestroy() {
if (this.electivecourseFieldsSub) this.electivecourseFieldsSub.unsubscribe();
}
selectClass() {
this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
......@@ -63,31 +71,28 @@ import { IAppState } from "../../store/store";
if (ecs.size > 0) {
ecs.reduce(({}, gelclass) => {
if (gelclass.get("selected")===true ){
this.activeClassId = gelclass.get("id");
//this.activeClassId = gelclass.get("id");
this.getAppropriateCourses(gelclass.get("id"));
}
return gelclass;
}, {});
}
}, error => { console.log("error selecting gelclasses"); });
this._cfa.getElectiveCourseFields(false, this.activeClassId);
this.electivecourseFieldsSub = this._ngRedux.select("electivecourseFields")
.map(electivecourseFields => <IElectiveCourseFieldRecords>electivecourseFields)
.subscribe(sfds => {
//sfds.reduce(({}, electivecourseField) => {
//if (electivecourseField.get("selected") === true) {
// ;
//}
}
//return electivecourseField;
//}, {});
this.electivecourseFields$.next(sfds);
}, error => { console.log("error selecting electivecourseFields"); });
getAppropriateCourses(classId) {
}
this._cfa.getElectiveCourseFields(false, /*this.activeClassId*/ classId);
this.electivecourseFieldsSub = this._ngRedux.select("electivecourseFields")
.map(electivecourseFields => <IElectiveCourseFieldRecords>electivecourseFields)
.subscribe(sfds => {
//sfds.reduce(({}, electivecourseField) => {
//return electivecourseField;
//}, {});
this.electivecourseFields$.next(sfds);
}, error => { console.log("error selecting electivecourseFields"); });
ngOnDestroy() {
if (this.electivecourseFieldsSub) this.electivecourseFieldsSub.unsubscribe();
}
private saveSelected(ind: number, sel: number): void {
......
......@@ -14,6 +14,8 @@ import { ILoginInfoRecords } from "../../store/logininfo/logininfo.types";
import { IAppState } from "../../store/store";
import { GELSTUDENT_DATA_FIELDS_INITIAL_STATE } from "../../store/gelstudentdatafields/gelstudentdatafields.initial-state";
import { IGelStudentDataFieldRecords } from "../../store/gelstudentdatafields/gelstudentdatafields.types";
import { GelClassesActions } from "../../actions/gelclasses.actions";
import { IGelClass, IGelClassRecord, IGelClassRecords } from "../../store/gelclasses/gelclasses.types";
import { HelperDataService } from "../../services/helper-data-service";
import {
FIRST_SCHOOL_YEAR,
......@@ -40,6 +42,7 @@ import {
private criteriaSub: Subscription;
//private datamodeSub: Subscription;
private epalUserDataSub: Subscription;
private gelclassesSub: Subscription;
private studentDataGroup: FormGroup;
private studentCriteriaGroup: FormGroup;
......@@ -61,6 +64,7 @@ import {
private numAppChildren: BehaviorSubject<number>;
private numChildren: BehaviorSubject<number>;
private epalUserData$: BehaviorSubject<any>;
private activeClassId = -1;
private myDatePickerOptions: IMyDpOptions = {
// other options...
......@@ -91,6 +95,7 @@ import {
constructor(private fb: FormBuilder,
private _sdfa: GelStudentDataFieldsActions,
private _cfb: GelClassesActions,
private hds: HelperDataService,
//private _cfa: DataModeActions,
private _ngRedux: NgRedux<IAppState>,
......@@ -137,33 +142,26 @@ import {
ngOnInit() {
(<any>$("#applicationFormNotice")).appendTo("body");
//new
//this.showLoader.next(true);
this.epalUserDataSub = this.hds.getEpalUserData().subscribe(x => {
this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
if (ecs.size > 0) {
ecs.reduce(({}, gelclass) => {
if (gelclass.get("selected")===true ){
this.activeClassId = gelclass.get("id");
}
return gelclass;
}, {});
}
}, error => { console.log("error selecting gelclasses"); });
this.epalUserDataSub = this.hds.getApplicantUserData().subscribe(x => {
this.epalUserData$.next(x);
this.numAppSelf.next(Number(x.numAppSelf));
this.numAppChildren.next(Number(x.numAppChildren));
this.numChildren.next(Number(x.numChildren));
});
//end new
//obsolete
/*
this.loginInfoSub = this._ngRedux.select("loginInfo")
.map(loginInfo => <ILoginInfoRecords>loginInfo)
.subscribe(linfo => {
if (linfo.size > 0) {
linfo.reduce(({}, loginInfoObj) => {
//obsolete
//this.numAppSelf.next(Number(loginInfoObj.numapp_self));
//this.numAppChildren.next(Number(loginInfoObj.numapp_children));
//this.numChildren.next(Number(loginInfoObj.numchildren));
return loginInfoObj;
}, {});
}
this.loginInfo$.next(linfo);
}, error => { console.log("error selecting loginInfo"); });
*/
this.loginInfoSub = this._ngRedux.select("loginInfo")
.map(loginInfo => <ILoginInfoRecords>loginInfo)
......@@ -252,8 +250,15 @@ import {
navigateBack() {
this._sdfa.saveGelStudentDataFields([this.studentDataGroup.value]);
//this.router.navigate(["/schools-order-select"]);
this.router.navigate(["/electivecourse-fields-select"]);
if (this.activeClassId == 1 || this.activeClassId == 3 || this.activeClassId == 4)
this.router.navigate(["/electivecourse-fields-select"]);
else if (this.activeClassId == 2 || this.activeClassId == 6 || this.activeClassId == 7)
this.router.navigate(["/orientation-group-select"]);
else if (this.activeClassId == 5) {
//this._cfb.resetGelClassesSelected();
this.router.navigate(["/gel-class-select"]);
}
}
submitSelected() {
......
......@@ -7,6 +7,8 @@ import { FormBuilder, FormGroup } from "@angular/forms";
import { OrientationGroupActions } from "../../actions/orientationgroup.action";
import { ORIENTATIONGROUP_INITIAL_STATE } from "../../store/orientationgroup/orientationgroup.initial-state";
import { IOrientationGroupRecords } from "../../store/orientationgroup/orientationgroup.types";
import { GelClassesActions } from "../../actions/gelclasses.actions";
import { IGelClass, IGelClassRecord, IGelClassRecords } from "../../store/gelclasses/gelclasses.types";
import { IAppState } from "../../store/store";
@Component({
......@@ -30,10 +32,12 @@ import { IAppState } from "../../store/store";
</div>
</div>
</div>
<h4> Επιλογή Ομάδας Προσανατολισμού </h4>
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ επιλέξτε την ομάδα προσανατολισμού στην οποία θα φοιτήσει ο μαθητής το νέο σχολικό έτος. Έπειτα επιλέξτε <i>Συνέχεια</i>.</p>
<div class = "loading" *ngIf=" !(OrientationGroup$ | async) || (OrientationGroup$ | async).size === 0"></div>
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ επιλέξτε την ομάδα προσανατολισμού στην οποία θα φοιτήσει ο μαθητής το νέο σχολικό έτος. Έπειτα επιλέξτε <i>Συνέχεια</i>.</p>
<!--
<ul class="list-group main-view">
<div *ngFor="let orientgroup$ of OrientationGroup$| async; let i=index; let isOdd=odd; let isEven=even">
<li class="list-group-item isclickable" (click)="saveSelected(i)" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="activechoice === i">
......@@ -41,11 +45,18 @@ import { IAppState } from "../../store/store";
</li>
</div>
</ul>
-->
<div class="list-group" *ngFor="let orientgroup$ of OrientationGroup$ | async; let i=index;">
<button *ngIf = "orientgroup$.selected === true" type="button" class="list-group-item list-group-item-action active" (click)="saveSelected(i,1)" >{{orientgroup$.name}}</button>
<button *ngIf = "orientgroup$.selected === false" type="button" class="list-group-item list-group-item-action" (click)="saveSelected(i,0)" >{{orientgroup$.name}}</button>
</div>
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-left" (click)="router.navigate(['/epal-class-select']);" >
<button type="button" class="btn-primary btn-lg pull-left" (click)="router.navigate(['/gel-class-select']);" >
<i class="fa fa-backward"></i>
</button>
</div>
......@@ -54,23 +65,27 @@ import { IAppState } from "../../store/store";
<span style="font-size: 0.9em; font-weight: bold;">Συνέχεια&nbsp;&nbsp;&nbsp;</span><i class="fa fa-forward"></i>
</button>
</div>
`
})
@Injectable() export default class OrientationGroup implements OnInit, OnDestroy {
private OrientationGroup$: BehaviorSubject<IOrientationGroupRecords>;
private OrientationGroupSub: Subscription;
private gelclassesSub: Subscription;
private formGroup: FormGroup;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>;
public isModalShown: BehaviorSubject<boolean>;
private activechoice = <number>-1;
private activeChoice = <number>-1;
private activeClassId = <number>-1;
private listsize = <number>0;
constructor(private fb: FormBuilder,
private _cfb: GelClassesActions,
private _ogs: OrientationGroupActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router) {
......@@ -86,28 +101,12 @@ import { IAppState } from "../../store/store";
};
ngOnInit() {
let classid = 2;
let typeid = "ΟΠ";
(<any>$("#OrientationGroupNotice")).appendTo("body");
this._ogs.getOrientationGroups(false,classid,typeid);
this.OrientationGroupSub = this._ngRedux.select("orientationGroup")
.map(orientationGroup => <IOrientationGroupRecords>orientationGroup)
.subscribe(ogs => {
ogs.reduce(({}, orientationgroup) => {
if (orientationgroup.get("selected") === true)
{
this.activechoice = orientationgroup.get("id") -1;
}
return orientationgroup;
}, {});
this.OrientationGroup$.next(ogs);
console.log("7");
}, error => { console.log("error selecting orientation"); });
this.selectClass();
}
......@@ -128,23 +127,79 @@ import { IAppState } from "../../store/store";
this.isModalShown.next(false);
}
selectClass() {
this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
this.activeClassId = -1;
if (ecs.size > 0) {
ecs.reduce(({}, gelclass) => {
if (gelclass.get("selected")===true ){
this.activeClassId = gelclass.get("id");
this.getAppropriateOrientations();
}
return gelclass;
}, {});
}
}, error => { console.log("error selecting gelclasses"); });
}
getAppropriateOrientations() {
this._ogs.getOrientationGroups(false, this.activeClassId, 'ΟΠ');
this.OrientationGroupSub = this._ngRedux.select("orientationGroup")
.map(orientationGroup => <IOrientationGroupRecords>orientationGroup)
.subscribe(ogs => {
this.listsize = 0;
this.activeChoice = -1;
ogs.reduce(({}, orientationgroup) => {
++this.listsize;
if (orientationgroup.get("selected") === true) {
this.activeChoice = orientationgroup.get("id") -1;
}
return orientationgroup;
}, {});
this.OrientationGroup$.next(ogs);
}, error => { console.log("error selecting orientation"); });
}
navigateNext() {
this.router.navigate(["/electivecourse-fields-select"]);
if (this.activeChoice == -1) {
this.modalTitle.next("Δεν επιλέχθηκε Ομάδα Προσανατολισμού");
this.modalText.next("Παρακαλούμε να επιλέξετε πρώτα μία Ομάδα Προσανατολισμού");
this.modalHeader.next("modal-header-danger");
this.showModal();
}
else {
if (this.activeClassId == 3)
this.router.navigate(["/electivecourse-fields-select"]);
else
this.router.navigate(["/gelstudent-application-form-main"]);
}
}
/*
private saveSelected(ind: number): void {
if (this.activechoice == ind)
console.log("Test value:");
console.log(this.activechoice);
console.log(ind);
if (this.activechoice == ind)
return;
this._ogs.saveOrientationGroupSelected(this.activechoice, ind);
this.activechoice = ind;
this._ogs.saveOrientationGroupSelected(this.activechoice, ind);
this.activechoice = ind;