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);
}
......@@ -91,11 +91,16 @@ class ApplicationSubmit extends ControllerBase {
//'currentepal' => $applicationForm[0][currentepal],
//'currentsector' => $applicationForm[0][currentsector],
'points' => $applicationForm[0][points],
'points' => $applicationForm[0][points],
'relationtostudent' => $applicationForm[0][relationtostudent],
'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 === "Α' Λυκείου")
......
This diff is collapsed.
......@@ -40,7 +40,12 @@ import {AppSettings} from '../../app.settings';
</div>
<div class="row">
<div class="col-md-12 col-md-offset-5">
<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" class="btn-primary btn-lg pull-right isclickable" style="width: 9em;" (click)="saveSelected()">
<span style="font-size: 0.9em; font-weight: bold;">Συνέχεια&nbsp;&nbsp;&nbsp;</span><i class="fa fa-forward"></i>
</button>
......@@ -107,6 +112,10 @@ import {AppSettings} from '../../app.settings';
}
navigateBack() {
this.router.navigate(['/intro-statement']);
}
initializestore()
{
......
......@@ -156,7 +156,7 @@ import {AppSettings} from '../../app.settings';
.then(res => {
this._prfa.saveProfile(this.formGroup.value);
this.showLoader.next(false);
this.router.navigate(['/epal-class-select']);})
this.router.navigate(['/intro-statement']);})
.catch(err => {
this.showLoader.next(false);
console.log(err)
......
......@@ -56,6 +56,7 @@ import {AppSettings} from '../../app.settings';
</div>
</div>
<div style="min-height: 500px;">
<h4> Επιλογή Σχολείου</h4>
<form [formGroup]="formGroup">
<div formArrayName="formArray">
......@@ -108,6 +109,7 @@ import {AppSettings} from '../../app.settings';
</div>
</div>
</form>
</div>
`
})
@Injectable() export default class RegionSchoolsSelect implements OnInit, OnDestroy {
......@@ -328,7 +330,7 @@ import {AppSettings} from '../../app.settings';
|| (this.numSelected.value === 0) ) {
//this.modalHeader = "modal-header-success";
this.modalHeader.next("modal-header-success");
this.modalHeader.next("modal-header-danger");
this.modalTitle.next("Επιλογή αριθμού σχολείων");
if (this.numSelected.value === 0)
this.modalText.next("Δεν έχετε επιλέξει κανένα σχολείο!");
......
......@@ -22,6 +22,7 @@ export const EPALCLASSES_INIT = 'EPALCLASSES_INIT';
export const LOGININFO_SAVE = 'LOGININFO_SAVE';
export const PROFILE_SAVE = 'PROFILE_SAVE';
export const STATEMENTAGREE_SAVE = 'STATEMENTAGREE_SAVE';
export const LOGININFO_RECEIVED = 'LOGININFO_RECEIVED';
......
......@@ -12,6 +12,7 @@ import Home from '../components/home';
import SchoolHome from '../components/school.home';
import MinistryHome from '../components/ministry.home';
import CourseFieldsSelect from '../components/student-application-form/course.fields.select';
import Disclaimer from '../components/student-application-form/disclaimer';
import EpalClassesSelect from '../components/student-application-form/epal.class.select';
import SectorFieldsSelect from '../components/student-application-form/sector.fields.select';
import RegionSchoolsSelect from '../components/student-application-form/region.schools.select';
......@@ -51,6 +52,7 @@ export const MainRoutes: Routes = [
{ path: 'student-application-form-main', component: StudentApplicationMain, canActivate: [StudentAuthGuard] },
// { path: 'students-list', component: StudentsList },
{ path: 'course-fields-select', component: CourseFieldsSelect, canActivate: [StudentAuthGuard] },
{ path: 'intro-statement', component: Disclaimer, canActivate: [StudentAuthGuard] },
{ path: 'epal-class-select', component: EpalClassesSelect, canActivate: [StudentAuthGuard] },
{ path: 'sector-fields-select', component: SectorFieldsSelect, canActivate: [StudentAuthGuard] },
{ path: 'region-schools-select', component: RegionSchoolsSelect, canActivate: [StudentAuthGuard] },
......@@ -82,6 +84,7 @@ export const MainDeclarations = [
SchoolHome,
MinistryHome,
CourseFieldsSelect,
Disclaimer,
EpalClassesSelect,
SectorFieldsSelect,
RegionSchoolsSelect,
......
......@@ -310,7 +310,6 @@ export class HelperDataService implements OnInit, OnDestroy {
});
let headers = new Headers({
"Content-Type": "application/json",
"X-CSRF-Token": "LU92FaWYfImfZxfldkF5eVnssdHoV7Aa9fg8K1bWYUc",
});
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
......
......@@ -5,7 +5,8 @@ import { Seq } from 'immutable';
import {
LOGININFO_SAVE,
LOGININFO_INIT,
PROFILE_SAVE
PROFILE_SAVE,
STATEMENTAGREE_SAVE
} from '../../constants';
export function loginInfoReducer(state: ILoginInfo = LOGININFO_INITIAL_STATE, action): ILoginInfo {
......@@ -45,6 +46,15 @@ export function loginInfoReducer(state: ILoginInfo = LOGININFO_INITIAL_STATE, ac
});
return state;
case STATEMENTAGREE_SAVE:
state.forEach(loginInfoToken => {
loginInfoToken.disclaimer_checked = action.payload.disclaimer_checked;
return state.withMutations(function (list) {
list.set(0, loginInfoToken);
});
});
return state;
case LOGININFO_INIT:
return LOGININFO_INITIAL_STATE;
default:
......
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