various fixes(unsubscribe etc). Added intro-statement form(WIP). Application...

various fixes(unsubscribe etc). Added intro-statement form(WIP). Application form modifications(WIP), submission proper validation(WIP)
parent 64c71ff5
......@@ -42,7 +42,7 @@ class ApplicationSubmit extends ControllerBase {
if (!$request->isMethod('POST')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
"error_code" => 2001
], Response::HTTP_METHOD_NOT_ALLOWED);
}
......@@ -55,7 +55,7 @@ class ApplicationSubmit extends ControllerBase {
}
else {
return $this->respondWithStatus([
"message" => t("Bad Request")
"error_code" => 5002
], Response::HTTP_BAD_REQUEST);
}
......@@ -96,6 +96,11 @@ class ApplicationSubmit extends ControllerBase {
'telnum' => $applicationForm[0][telnum]
);
if (($errorCode = $this->validateStudent($student)) > 0) {
return $this->respondWithStatus([
"error_code" => $errorCode ], Response::HTTP_OK);
}
$entity_storage_student = $this->entityTypeManager->getStorage('epal_student');
$entity_object = $entity_storage_student->create($student);
$entity_storage_student->save($entity_object);
......@@ -164,7 +169,7 @@ class ApplicationSubmit extends ControllerBase {
$entity_storage_sector->save($entity_object);
}
return $this->respondWithStatus([
"message" => t("Application saved successfully")
"error_code" => 0
], Response::HTTP_OK);
}
......@@ -172,7 +177,7 @@ class ApplicationSubmit extends ControllerBase {
$this->logger->warning($e->getMessage());
$transaction->rollback();
return $this->respondWithStatus([
"message" => t("An unexpected problem occured")
"error_code" => 5001
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
......@@ -182,4 +187,11 @@ class ApplicationSubmit extends ControllerBase {
$res->setStatusCode($s);
return $res;
}
private function validateStudent($student) {
if(!$student["agreement"]) {
return 1001;
}
return 0;
}
}
import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED } from '../constants';
import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED, STATEMENTAGREE_SAVE } from '../constants';
import { LOGININFO_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
......@@ -41,6 +41,15 @@ saveProfile = (profile) => {
});
};
saveStatementAgree = (disclaimer_checked) => {
return this._ngRedux.dispatch({
type: STATEMENTAGREE_SAVE,
payload: {
disclaimer_checked
}
});
};
initLoginInfo = () => {
return this._ngRedux.dispatch({
......
......@@ -106,6 +106,8 @@ import { API_ENDPOINT } from '../../app.settings';
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
}
......
......@@ -115,6 +115,8 @@ import { API_ENDPOINT } from '../../app.settings';
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
}
......
......@@ -157,6 +157,10 @@ import {
this.loginInfoSub.unsubscribe();
if (this.settingsSub)
this.settingsSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.settings$)
this.settings$.unsubscribe();
}
ngOnInit() {
......
......@@ -169,6 +169,10 @@ import { API_ENDPOINT } from '../../app.settings';
this.loginInfoSub.unsubscribe();
if (this.settingsSub)
this.settingsSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.settings$)
this.settings$.unsubscribe();
}
ngOnInit() {
......
......@@ -313,6 +313,21 @@ import { API_ENDPOINT } from '../../app.settings';
this.SectorSelectionsSub.unsubscribe();
if (this.CourseSelectionsSub)
this.CourseSelectionsSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.generalReport$)
this.generalReport$.unsubscribe();
if (this.RegionSelections$)
this.RegionSelections$.unsubscribe();
if (this.AdminAreaSelections$)
this.AdminAreaSelections$.unsubscribe();
if (this.SchoolSelections$)
this.SchoolSelections$.unsubscribe();
if (this.SectorSelections$)
this.SectorSelections$.unsubscribe();
if (this.CourseSelections$)
this.CourseSelections$.unsubscribe();
if (this.showAdminList)
this.showAdminList.unsubscribe();
if (this.showSectorList)
......@@ -321,6 +336,8 @@ import { API_ENDPOINT } from '../../app.settings';
this.showCourseList.unsubscribe();
if (this.RegionRetrieveSub)
this.RegionRetrieveSub.unsubscribe();
if (this.RegionRetrieve$)
this.RegionRetrieve$.unsubscribe();
}
......
......@@ -149,6 +149,10 @@ import { API_ENDPOINT } from '../../app.settings';
this.loginInfoSub.unsubscribe();
if (this.generalReportSub)
this.generalReportSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.generalReport$)
this.generalReport$.unsubscribe();
}
......
......@@ -147,6 +147,10 @@ import { API_ENDPOINT } from '../../app.settings';
this.loginInfoSub.unsubscribe();
if (this.generalReportSub)
this.generalReportSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.generalReport$)
this.generalReport$.unsubscribe();
}
......
<div class="row">
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="(criteria$ | async).size === 0 || (loginInfo$ | async).size === 0"></div>
<div class = "loading" *ngIf="(loginInfo$ | async).size === 0"></div>
<div id="applicationFormNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
......@@ -22,7 +22,7 @@
</div>
</div>
<h4> Προσωπικά Στοιχεία Μαθητή </h4>
<form novalidate [formGroup]="studentDataGroup" #form>
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ συμπληρώστε τα στοιχεία του μαθητή και στη συνέχεια επιλέξτε <i>Συνέχεια</i>. <strong>Προσοχη!</strong> Παρακαλώ να συμπληρώσετε τα στοιχεία ακριβώς όπως είναι στον τελευταίο τίτλο κτήσης απολυτηρίου/ πτυχίου του μαθητή.</p>
......@@ -49,6 +49,9 @@
</div>
</div>
<div class="row evenin" style="margin: 20px 2px 10px 2px; line-height: 2em;">
<div class="col-md-12" style="font-size: 1.5em; font-weight: bold; text-align: center;">Στοιχεία μαθητή</div>
</div>
<div class="form-group">
<label for="name">Όνομα μαθητή(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="name">
</div>
......@@ -110,7 +113,7 @@
</div>
<div class="form-group">
<label for="studentbirthdate">Ημερομηνία γέννησης - Δεν πληκτρολογείτε. Επιλέξτε το εικονίδιο δεξιά!(<span style="color: #ff0000;">*</span>)</label>
<label for="studentbirthdate">Ημερομηνία γέννησης μαθητή- Δεν πληκτρολογείτε. Επιλέξτε το εικονίδιο δεξιά!(<span style="color: #ff0000;">*</span>)</label>
<my-date-picker name="studentbirthdate" [options]="myDatePickerOptions"
formControlName="studentbirthdate" locale="el"></my-date-picker>
</div>
......@@ -192,7 +195,7 @@
</div>
<form novalidate [formGroup]="studentCriteriaGroup">
<!-- <form novalidate [formGroup]="studentCriteriaGroup">
<div formArrayName="formArray">
......@@ -231,9 +234,9 @@
</div>
</form>
</form> -->
<div class="row" style="margin-top: 20px; margin-bottom: 20px;" *ngIf="(criteria$ | async).size > 0">
<div class="row" style="margin-top: 20px; margin-bottom: 20px;">
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-left" (click)="navigateBack()">
<i class="fa fa-backward"></i>
......
......@@ -85,9 +85,9 @@ import {
telnum: ['', [Validators.pattern(VALID_DIGITS_PATTERN),Validators.required]],
});
this.studentCriteriaGroup = this.fb.group({
/* this.studentCriteriaGroup = this.fb.group({
formArray: this.rss,
});
}); */
};
......@@ -126,7 +126,7 @@ import {
return state.studentDataFields;
}).subscribe(this.studentDataFields$);
this._sdfb.getCriteria(true);
/* this._sdfb.getCriteria(true);
this.criteriaSub = this._ngRedux.select(state => {
if (state.criter.size > 0) {
state.criter.reduce(({}, criteria) => {
......@@ -140,34 +140,35 @@ import {
}, {});
}
return state.criter;
}).subscribe(this.criteria$);
}).subscribe(this.criteria$); */
}
ngOnDestroy() {
(<any>$('#applicationFormNotice')).remove();
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();
// if (this.criteria$) this.criteria$.unsubscribe();
if (this.loginInfo$) this.loginInfo$.unsubscribe();
}
navigateBack() {
this._sdfa.saveStudentDataFields([this.studentDataGroup.value]);
this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
// this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
this.router.navigate(['/schools-order-select']);
}
submitSelected() {
if (this.studentDataGroup.invalid || this.studentCriteriaGroup.invalid) {
// if (this.studentDataGroup.invalid || this.studentCriteriaGroup.invalid) {
if (this.studentDataGroup.invalid) {
this.modalHeader.next("modal-header-danger");
this.modalTitle.next("Η αίτηση δεν είναι πλήρης");
this.modalText.next("Πρέπει να συμπληρώσετε όλα τα πεδία που συνοδεύονται από (*)");
this.showModal();
} else {
this._sdfa.saveStudentDataFields([this.studentDataGroup.value]);
this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
// this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
this.router.navigate(['/application-submit']);
}
}
......
......@@ -17,11 +17,6 @@ import { REGION_SCHOOLS_INITIAL_STATE } from '../../store/regionschools/regionsc
import { EPALCLASSES_INITIAL_STATE } from '../../store/epalclasses/epalclasses.initial-state';
import { SECTOR_COURSES_INITIAL_STATE } from '../../store/sectorcourses/sectorcourses.initial-state';
import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfields.initial-state';
import { IStudentDataFields } from '../../store/studentdatafields/studentdatafields.types';
import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields/studentdatafields.initial-state';
import { ICriteria, ICriter } from '../../store/criteria/criteria.types';
import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-state';
@Component({
selector: 'application-preview-select',
......@@ -80,62 +75,6 @@ import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-st
</li>
</div>
</ul>
<div *ngIf="currentUrl === '/application-submit'">
<div *ngFor="let studentDataField$ of studentDataFields$ | async;">
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Στοιχεία μαθητή
</li>
</ul>
<div><label for="name">Όνομα μαθητή</label> <p class="form-control" id="name" style="border:1px solid #eceeef;"> {{studentDataField$.name}} </p> </div>
<div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" id = "studentsurname" style="border:1px solid #eceeef;"> {{studentDataField$.studentsurname}} </p></div>
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{studentDataField$.fatherfirstname}} </p></div>
<div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{studentDataField$.fathersurname}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{studentDataField$.motherfirstname}} </p></div>
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{studentDataField$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{studentDataField$.studentbirthdate}} </p></div>
<table>
<tr>
<td>
<div class="form-group">
<label for="regionaddress">Διεύθυνση κατοικίας</label><p class="form-control" id = "regionaddress" style="border:1px solid #eceeef;"> {{studentDataField$.regionaddress}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regiontk">TK </label><p class="form-control" id = "regiontk" style="border:1px solid #eceeef;"> {{studentDataField$.regiontk}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regionarea">Πόλη/Περιοχή</label><p class="form-control" id = "regionarea" style="border:1px solid #eceeef;"> {{studentDataField$.regionarea}} </p>
</div>
</td>
</tr>
</table>
<div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{studentDataField$.certificatetype}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{studentDataField$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{studentDataField$.relationtostudent}} </p></div>
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
<div *ngIf="currentUrl === '/application-submit'">
Κοινωνικά/Εισοδηματικά Κριτήρια
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="currentUrl === '/application-submit'">
<div *ngFor="let criteriaField$ of criteriaFields$ | async;">
<div *ngIf="criteriaField$.selected === true">
{{criteriaField$.name}}
</div>
</div>
</div>
`
})
......@@ -144,14 +83,11 @@ import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-st
private regions$: BehaviorSubject<IRegions>;
private selectedSchools$: BehaviorSubject<Array<IRegionSchool>> = new BehaviorSubject(Array());
private sectorFields$: BehaviorSubject<ISectorFields>;
private criteriaFields$: BehaviorSubject<ICriter>;
private studentDataFields$: BehaviorSubject<IStudentDataFields>;
private epalclasses$: BehaviorSubject<IEpalClasses>;
private sectorsSub: Subscription;
private regionsSub: Subscription;
private sectorFieldsSub: Subscription;
private criteriaFieldsSub: Subscription;
private studentDataFieldsSub: Subscription;
private courseActive = "-1";
private numSelectedSchools = <number>0;
private numSelectedOrder = <number>0;
......@@ -167,8 +103,6 @@ import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-st
this.sectors$ = new BehaviorSubject(SECTOR_COURSES_INITIAL_STATE);
this.sectorFields$ = new BehaviorSubject(SECTOR_FIELDS_INITIAL_STATE);
this.criteriaFields$ = new BehaviorSubject(CRITERIA_INITIAL_STATE);
this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE);
};
ngOnInit() {
......@@ -218,21 +152,6 @@ import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-st
return state.sectorFields;
}).subscribe(this.sectorFields$);
this.studentDataFieldsSub = this._ngRedux.select(state => {
state.studentDataFields.reduce(({}, studentDataField) => {
return studentDataField;
}, {});
return state.studentDataFields;
}).subscribe(this.studentDataFields$);
this.criteriaFieldsSub = this._ngRedux.select(state => {
state.criter.reduce(({}, criteriaField) => {
return criteriaField;
}, {});
return state.criter;
}).subscribe(this.criteriaFields$);
this._ngRedux.select(state => {
state.epalclasses.reduce(({}, epalclass) => {
if (epalclass.name === "Α' Λυκείου")
......
......@@ -32,11 +32,11 @@ import { HelperDataService } from '../../services/helper-data-service';
@Component({
selector: 'application-submit',
template: `
<div class = "loading" *ngIf="(studentDataFields$ | async).size === 0 || (criteria$ | async).size === 0 || (regions$ | async).size === 0 || (epalclasses$ | async).size === 0 || (loginInfo$ | async).size === 0 || (showLoader | async) === true"></div>
<div class = "loading" *ngIf="(studentDataFields$ | async).size === 0 || (regions$ | async).size === 0 || (epalclasses$ | async).size === 0 || (loginInfo$ | async).size === 0 || (showLoader | async) === true"></div>
<div id="studentFormSentNotice" (onHidden)="onHidden()" class="modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header modal-header-success">
<div class="modal-header {{modalHeader | async}}">
<h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i>&nbsp;&nbsp;{{ modalTitle | async }}</h3>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal()">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
......@@ -112,29 +112,29 @@ import { HelperDataService } from '../../services/helper-data-service';
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{studentDataField$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{studentDataField$.relationtostudent}} </p></div>
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<!-- <ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
<div *ngIf="currentUrl === '/application-submit'">
Κοινωνικά/Εισοδηματικά Κριτήρια
</div>
</li>
</ul>
</ul> -->
</div>
<div *ngFor="let criteriaField$ of criteriaFields$ | async;">
<!-- <div *ngFor="let criteriaField$ of criteriaFields$ | async;">
<div *ngIf="criteriaField$.selected === true">
{{criteriaField$.name}}
</div>
</div>
</div> -->
<div class="row" style="margin-top: 20px; margin-bottom: 20px;" *ngIf="(criteria$ | async).size > 0">
<div class="row" style="margin-top: 20px; margin-bottom: 20px;">
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-left" (click)="navigateBack()">
<i class="fa fa-backward"></i>
</button>
</div>
<div class="col-md-6">
<button type="button" *ngIf="(studentDataFields$ | async).size > 0 && (criteria$ | async).size > 0 && (regions$ | async).size > 0 && (epalclasses$ | async).size > 0 && (loginInfo$ | async).size > 0" class="btn-primary btn-lg pull-right isclickable" style="width: 9em;" (click)="submitNow()">
<button type="button" *ngIf="(studentDataFields$ | async).size > 0 && (regions$ | async).size > 0 && (epalclasses$ | async).size > 0 && (loginInfo$ | async).size > 0" class="btn-primary btn-lg pull-right isclickable" style="width: 9em;" (click)="submitNow()">
<span style="font-size: 0.9em; font-weight: bold;">Υποβολή&nbsp;&nbsp;&nbsp;</span><i class="fa fa-forward"></i>
</button>
</div>
......@@ -171,6 +171,7 @@ import { HelperDataService } from '../../services/helper-data-service';
private loginInfoSub: Subscription;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>;
public isModalShown: BehaviorSubject<boolean>;
private showLoader: BehaviorSubject<boolean>;
public currentUrl: string;
......@@ -203,6 +204,7 @@ import { HelperDataService } from '../../services/helper-data-service';
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
this.isModalShown = new BehaviorSubject(false);
this.showLoader = new BehaviorSubject(false);
};
......@@ -264,7 +266,7 @@ import { HelperDataService } from '../../services/helper-data-service';
return state.regions;
}).subscribe(this.regions$);
this.criteriaSub = this._ngRedux.select(state => {
/* this.criteriaSub = this._ngRedux.select(state => {
if (state.criter.size > 0) {
state.criter.reduce(({}, criteria) => {
//code to be replaced in next version
......@@ -278,7 +280,7 @@ import { HelperDataService } from '../../services/helper-data-service';
}, {});
}
return state.criter;
}).subscribe(this.criteria$);
}).subscribe(this.criteria$); */
this.sectorsSub = this._ngRedux.select(state => {
state.sectors.reduce((prevSector, sector) =>{
......@@ -308,7 +310,7 @@ import { HelperDataService } from '../../services/helper-data-service';
ngOnDestroy() {
(<any>$('#studentFormSentNotice')).remove();
if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe();
if (this.criteriaSub) this.criteriaSub.unsubscribe();
// if (this.criteriaSub) this.criteriaSub.unsubscribe();
if (this.regionsSub) this.regionsSub.unsubscribe();
if (this.sectorsSub) this.sectorsSub.unsubscribe();
if (this.sectorFieldsSub) this.sectorFieldsSub.unsubscribe();
......@@ -319,7 +321,7 @@ import { HelperDataService } from '../../services/helper-data-service';
this.sectors$.unsubscribe();
this.sectorFields$.unsubscribe();
this.studentDataFields$.unsubscribe();
this.criteria$.unsubscribe();
// this.criteria$.unsubscribe();
this.loginInfo$.unsubscribe();
}
......@@ -336,23 +338,19 @@ import { HelperDataService } from '../../services/helper-data-service';
aitisiObj[0].cu_fathername = this.cu_fathername;
aitisiObj[0].cu_mothername = this.cu_mothername;
aitisiObj[0].disclaimer_checked = this.disclaimer_checked;
//console.log(aitisiObj[0]['studentbirthdate']);
aitisiObj[0]['currentclass'] = this.classSelected;
//aitisiObj[0]['studentamka'] = ...;
aitisiObj[0]['points'] = this.totalPoints;
for (let i=0; i < this.epalSelected.length; i++)
epalObj[i] =new StudentEpalChosen(null, this.epalSelected[i] , this.epalSelectedOrder[i]);
aitisiObj['1'] = epalObj;
for (let i=0; i < this.studentCriteria.length; i++)
criteriaObj[i] =new StudentCriteriaChosen(null, null, this.studentCriteria[i]);
aitisiObj['2'] = criteriaObj;
// for (let i=0; i < this.studentCriteria.length; i++)
// criteriaObj[i] =new StudentCriteriaChosen(null, null, this.studentCriteria[i]);
// aitisiObj['2'] = criteriaObj;
//if (aitisiObj[0]['currentclass'] === "Β' Λυκείου" )
if (aitisiObj[0]['currentclass'] === "2" )
aitisiObj['3'] = new StudentSectorChosen(null, this.sectorSelected);
//else if (aitisiObj[0]['currentclass'] === "Γ' Λυκείου" )
else if (aitisiObj[0]['currentclass'] === "3" || aitisiObj[0]['currentclass'] === "4" ) {
aitisiObj['3'] = new StudentCourseChosen(null, this.courseSelected);
}
......@@ -380,8 +378,11 @@ import { HelperDataService } from '../../services/helper-data-service';
success => {
(<any>$('.loading')).remove();
this.showLoader.next(false);
let errorCode = parseInt(success.error_code);
if (errorCode === 0) {
this.modalTitle.next("Υποβολή Αίτησης Εγγραφής");
this.modalText.next("Η υποβολή της αίτησής σας πραγματοποιήθηκε. Μπορείτε να την εκτυπώσετε από την επιλογή 'Εμφάνιση - Εκτύπωση Αίτησης'. Θα ειδοποιηθείτε στο e-mail που δηλώσατε για την εξέλιξη της αίτησής σας");
this.modalHeader.next("modal-header-success");
this._eca.initEpalClasses();
this._sfa.initSectorFields();
this._rsa.initRegionSchools();
......@@ -390,10 +391,25 @@ import { HelperDataService } from '../../services/helper-data-service';
this._cria.initCriteria();
console.log("success post");
this.showModal();
}
else if (errorCode === 1001) {
this.modalTitle.next("Αποτυχία Υποβολής Αίτησης");
this.modalText.next("Δεν έχετε αποδεχθεί τους όρους χρήσης");
this.modalHeader.next("modal-header-danger");
console.log("no disclaimer checked");
this.showModal();
} else {
this.modalTitle.next("Αποτυχία Υποβολής Αίτησης");
this.modalText.next("Ελέξτε τη φόρμα σας. Υπάρχουν λάθη - ελλείψεις που δεν επιτρέπουν την υποβολή");
this.modalHeader.next("modal-header-danger");
console.log("other error");
this.showModal();
}
},
error => {
(<any>$('.loading')).remove();
this.showLoader.next(false);
this.modalHeader.next("modal-header-danger");
this.modalTitle.next("Υποβολή Αίτησης Εγγραφής");
this.modalText.next("Η υποβολή της αίτησής σας απέτυχε. Παρακαλούμε προσπαθήστε πάλι και αν το πρόβλημα συνεχίσει να υφίσταται, επικοινωνήστε με την ομάδα υποστήριξης");
this.showLoader.next(false);
......
import { Component, OnInit, OnDestroy } from "@angular/core";
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { Http, Headers, RequestOptions} from '@angular/http';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray,
Validators,
} from '@angular/forms';
@Component({
selector: 'intro-statement',
template: `
<div id="disclaimerNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header {{modalHeader | async}}" >
<h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i>&nbsp;&nbsp;{{ modalTitle | async }}</h3>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal()">