From 3e2c4ae9d20b90b59ba1f875cf82c87cf630df45 Mon Sep 17 00:00:00 2001 From: Haris Papadopoulos Date: Wed, 24 May 2017 23:59:09 +0300 Subject: [PATCH] lock flags implementation(WIP) - Added new fields in application form - Updated submission process. Other fixes --- .../epal/src/Controller/ApplicationSubmit.php | 6 + .../epal/src/Controller/CurrentUser.php | 8 +- package.json | 1 + source/app.ts | 2 + .../application.form.main.html | 139 +++++++-------- .../application.form.main.ts | 158 ++++++++++++------ .../application.preview.ts | 1 - .../application.submit.ts | 24 ++- .../region.schools.select.ts | 7 - source/constants.ts | 2 +- source/services/helper-data-service.ts | 93 +---------- .../studentdatafields.reducer.ts | 8 + .../studentdatafields.types.ts | 1 + 13 files changed, 209 insertions(+), 241 deletions(-) diff --git a/drupal/modules/epal/src/Controller/ApplicationSubmit.php b/drupal/modules/epal/src/Controller/ApplicationSubmit.php index d9a87e9..c463de2 100755 --- a/drupal/modules/epal/src/Controller/ApplicationSubmit.php +++ b/drupal/modules/epal/src/Controller/ApplicationSubmit.php @@ -83,6 +83,12 @@ class ApplicationSubmit extends ControllerBase { 'certificatetype' => $applicationForm[0][certificatetype], //'lastam' => $applicationForm[0][lastam], 'currentclass' => $applicationForm[0][currentclass], + 'guardian_name' => $applicationForm[0][cu_name], + 'guardian_surnname' => $applicationForm[0][cu_surname], + 'guardian_fathername' => $applicationForm[0][cu_fathername], + 'guardian_mothername' => $applicationForm[0][cu_mothername], + 'agreement' => $applicationForm[0][disclaimer_checked], + //'currentepal' => $applicationForm[0][currentepal], //'currentsector' => $applicationForm[0][currentsector], 'points' => $applicationForm[0][points], diff --git a/drupal/modules/epal/src/Controller/CurrentUser.php b/drupal/modules/epal/src/Controller/CurrentUser.php index 8875064..8bb3150 100755 --- a/drupal/modules/epal/src/Controller/CurrentUser.php +++ b/drupal/modules/epal/src/Controller/CurrentUser.php @@ -63,10 +63,10 @@ class CurrentUser extends ControllerBase if (($userRole === 'epal') || ($userRole === 'regioneduadmin') || ($userRole === 'eduadmin')) { return $this->respondWithStatus([ 'cu_name' => $user->mail->value, - 'cu_surname' => mb_substr($epalUser->surname->value,0,4,'UTF-8') !== "####" ? $epalUser->surname->value : '', - 'cu_fathername' => mb_substr($epalUser->fathername->value,0,4,'UTF-8') !== "####" ? $epalUser->fathername->value : '', - 'cu_mothername' => mb_substr($epalUser->mothername->value,0,4,'UTF-8') !== "####" ? $epalUser->mothername->value : '', - 'cu_email' => mb_substr($user->mail->value,0,4,'UTF-8') !== "####" ? $user->mail->value : '', + 'cu_surname' => '', + 'cu_fathername' => '', + 'cu_mothername' => '', + 'cu_email' => '', 'minedu_username' => '', 'minedu_userpassword' => '', 'lock_capacity' => $epalConfig->lock_school_capacity->value, diff --git a/package.json b/package.json index d19eda6..dee666e 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "immutable": "^3.8.1", "jquery": "^3.1.1", "jspdf": "^1.3.3", + "mydatepicker": "^2.0.13", "ng2-redux": "^5.1.0", "ng2-smart-table": "^0.4.0-5", "ngx-cookie": "^1.0.0", diff --git a/source/app.ts b/source/app.ts index 685c0d0..2579571 100644 --- a/source/app.ts +++ b/source/app.ts @@ -6,6 +6,7 @@ import { NgModule } from '@angular/core'; import { NgReduxModule, DevToolsExtension, NgRedux } from 'ng2-redux'; import {BrowserModule} from '@angular/platform-browser'; import { CookieModule } from 'ngx-cookie'; +import { MyDatePickerModule } from 'mydatepicker'; import { FormsModule, ReactiveFormsModule, @@ -55,6 +56,7 @@ class MyLocalization extends NgLocalization { @NgModule({ imports: [ BrowserModule, + MyDatePickerModule, FormsModule, RouterModule, ReactiveFormsModule, diff --git a/source/components/student-application-form/application.form.main.html b/source/components/student-application-form/application.form.main.html index 81013e5..fb161e2 100644 --- a/source/components/student-application-form/application.form.main.html +++ b/source/components/student-application-form/application.form.main.html @@ -1,30 +1,56 @@
-
+
+ + +

Προσωπικά Στοιχεία Μαθητή

-

Παρακαλώ συμπληρώστε τα στοιχεία του μαθητή και στη συνέχεια επιλέξτε Συνέχεια. Προσοχη! Παρακαλώ να συμπληρώσετε τα στοιχεία ακριβώς όπως είναι στον τελευταίο τίτλο κτήσης απολυτηρίου/ πτυχίου του μαθητή.

-

Η ακρίβεια των στοιχείων που υποβάλλονται με αυτή τη δήλωση μπορεί να ελεγχθεί με βάση το αρχείο άλλων υπηρεσιών (άρθρο 8 παρ. 4 Ν. 1599/1986)

+

Η ακρίβεια των στοιχείων που υποβάλλονται με αυτή τη δήλωση μπορεί να ελεγχθεί με βάση το αρχείο άλλων υπηρεσιών (άρθρο 8 παρ. 4 Ν. 1599/1986)

+ +

Όλα τα πεδία που συνοδεύονται από (*) είναι απαραίτητο να συμπληρωθούν

+ - - - -
-
- +
+
+
Στοιχεία αιτούμενου κηδεμόνα
-
-
- +
+
Όνομα
+
{{ loginInfoRow$.cu_name }}
+
Επώνυμο
+
{{ loginInfoRow$.cu_surname }}
-
-
+
+
Όνομα πατέρα
+
{{ loginInfoRow$.cu_fathername }}
+
Όνομα μητέρας
+
{{ loginInfoRow$.cu_mothername }}
+
+
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -34,7 +60,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -44,7 +70,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -54,7 +80,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -64,7 +90,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -74,7 +100,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -83,35 +109,21 @@ Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
-
- - + +
Συμπληρώστε την ημερομηνία γέννησης του μαθητή!
- - -
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -122,7 +134,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -133,7 +145,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -146,9 +158,9 @@
-
+
@@ -158,9 +170,9 @@
-
+
@@ -170,7 +182,7 @@
- +
Το πεδίο δεν μπορεί να αφεθεί κενό! @@ -181,36 +193,6 @@
- - - - - - -
@@ -247,9 +229,6 @@
-
@@ -261,7 +240,7 @@
-
@@ -269,3 +248,5 @@ + + diff --git a/source/components/student-application-form/application.form.main.ts b/source/components/student-application-form/application.form.main.ts index 965970d..bb12796 100644 --- a/source/components/student-application-form/application.form.main.ts +++ b/source/components/student-application-form/application.form.main.ts @@ -11,6 +11,9 @@ import { IAppState } from '../../store/store'; import { VALID_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_DIGITS_PATTERN, VALID_DATE_PATTERN } from '../../constants'; import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields/studentdatafields.initial-state'; import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-state'; +import { ILoginInfo, ILoginInfoToken } from '../../store/logininfo/logininfo.types'; +import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state'; +import {IMyDpOptions} from 'mydatepicker'; import { FormBuilder, @@ -34,62 +37,88 @@ import { private criteriaSub: Subscription; public studentDataGroup: FormGroup; - public applicantDataGroup: FormGroup; public studentCriteriaGroup: FormGroup; + private loginInfo$: BehaviorSubject; + + private modalTitle: BehaviorSubject; + private modalText: BehaviorSubject; + private modalHeader: BehaviorSubject; + private rss = new FormArray([]); - //private selectionIncomeId = 0; - //private sdate;// = new Date(2013,7,29); // = Date.now(); - //date: [datePipe.transform(this.event.date, 'yyyy-MM-dd'), [Validators.required]] + private myDatePickerOptions: IMyDpOptions = { + // other options... + sunHighlight: false, + editableDateField: false, + dateFormat: 'dd/mm/yyyy', + }; constructor(private fb: FormBuilder, private _sdfa: StudentDataFieldsActions, private _sdfb: CriteriaActions, private _ngRedux: NgRedux, private router: Router) { + this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); + this.modalTitle = new BehaviorSubject(""); + this.modalText = new BehaviorSubject(""); + this.modalHeader = new BehaviorSubject(""); this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE); this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE); this.studentDataGroup = this.fb.group({ - epaluser_id: [,[]], - name: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], - studentsurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], +// epaluser_id: [,[]], + + name: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + studentsurname: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], studentbirthdate: ['', [Validators.required]], //studentbirthdate: ['', [Validators.pattern(VALID_DATE_PATTERN),Validators.required]], - fatherfirstname: ['ΑΝΑΣΤΑΣΙΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], - fathersurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], - motherfirstname: ['ΚΑΤΕΡΙΝΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], - mothersurname: ['ΚΑΤΣΑΟΥΝΟΥ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], - regionaddress: ['ΓΙΑΝΝΙΤΣΩΝ 5', [Validators.pattern(VALID_ADDRESS_PATTERN),Validators.required]], - regiontk: ['26334', [Validators.pattern(VALID_ADDRESSTK_PATTERN),Validators.required]], - regionarea: ['ΠΑΤΡΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], - certificatetype: ['Απολυτήριο Λυκείου', this.checkChoice], - relationtostudent: ['Μαθητής', this.checkChoice], - telnum: ['6978333235', [Validators.pattern(VALID_DIGITS_PATTERN),Validators.required]], - }); - - this.applicantDataGroup = this.fb.group({ - guardianfirstname: ['ΑΝΑΣΤΑΣΙΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], - guardiansurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + fatherfirstname: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + fathersurname: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + motherfirstname: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + mothersurname: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + regionaddress: ['', [Validators.pattern(VALID_ADDRESS_PATTERN),Validators.required]], + regiontk: ['', [Validators.pattern(VALID_ADDRESSTK_PATTERN),Validators.required]], + regionarea: ['', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + certificatetype: ['', this.checkChoice], + relationtostudent: ['', this.checkChoice], + telnum: ['', [Validators.pattern(VALID_DIGITS_PATTERN),Validators.required]], }); this.studentCriteriaGroup = this.fb.group({ formArray: this.rss, - //income: ['', this.checkChoice ], - //income: ['noincomecriterio', Validators.required ], - //income: [this.selectionIncomeId, this.checkChoice ], - //incometest: ['noincomecriterio', this. checkChoice ], }); }; ngOnInit() { + ($('#applicationFormNotice')).appendTo("body"); + + this._ngRedux.select(state => { + if (state.loginInfo.size > 0) { + state.loginInfo.reduce(({}, loginInfoToken) => { + console.log(loginInfoToken.cu_name); + return loginInfoToken; + }, {}); + } + return state.loginInfo; + }).subscribe(this.loginInfo$); this.studentDataFieldsSub = this._ngRedux.select(state => { if (state.studentDataFields.size > 0) { state.studentDataFields.reduce(({}, studentDataField) => { - this.studentDataGroup.setValue(studentDataField); + this.studentDataGroup.controls['name'].setValue(studentDataField.name); + this.studentDataGroup.controls['studentsurname'].setValue(studentDataField.studentsurname); + this.studentDataGroup.controls['fatherfirstname'].setValue(studentDataField.fatherfirstname); + this.studentDataGroup.controls['fathersurname'].setValue(studentDataField.fathersurname); + this.studentDataGroup.controls['motherfirstname'].setValue(studentDataField.motherfirstname); + this.studentDataGroup.controls['mothersurname'].setValue(studentDataField.mothersurname); + this.studentDataGroup.controls['regionaddress'].setValue(studentDataField.regionaddress); + this.studentDataGroup.controls['regiontk'].setValue(studentDataField.regiontk); + this.studentDataGroup.controls['regionarea'].setValue(studentDataField.regionarea); + this.studentDataGroup.controls['certificatetype'].setValue(studentDataField.certificatetype); + this.studentDataGroup.controls['telnum'].setValue(studentDataField.telnum); + this.studentDataGroup.setValue({studentbirthdate: this.populateDate(studentDataField.studentbirthdate)}); return studentDataField; }, {}); } @@ -115,21 +144,31 @@ import { } ngOnDestroy() { + ($('#applicationFormNotice')).remove(); if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe(); if (this.criteriaSub) this.criteriaSub.unsubscribe(); if (this.studentDataFields$) this.studentDataFields$.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.router.navigate(['/schools-order-select']); } submitSelected() { - this._sdfa.saveStudentDataFields([this.studentDataGroup.value]); - this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]); - - this.router.navigate(['/application-submit']); + if (this.studentDataGroup.invalid || this.studentCriteriaGroup.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.router.navigate(['/application-submit']); + } } checkcriteria(cb, mutual_disabled) { @@ -138,38 +177,49 @@ import { let mutual_ids = mutual_disabled.split(","); for (let i=0; i 9000 Ευρώ") - this.selectionIncomeId = 11; - } - */ - - //checkChoice(c: FormControl) { checkChoice(c: FormControl) { - if (c.value === "noincomecriterio" ) { + if (c.value === "" ) { return {status: true} } else // Null means valid, believe it or not return null; } + + populateDate(d) { + return { + date: { + year: d ? parseInt(d.substr(0,4)) : 0, + month: d ? parseInt(d.substr(6,8)) : 0, + day: d ? parseInt(d.substr(8,10)) : 0 + } + }; + } + + setDate() { + let date = new Date(); + return { date: { + year: date.getFullYear() - 14, + month: date.getMonth() + 1, + day: date.getDate()} + }; + } + + clearDate() { + return null; + } + + public showModal():void { + ($('#applicationFormNotice')).modal('show'); + } + + public hideModal():void { + ($('#applicationFormNotice')).modal('hide'); + } + } diff --git a/source/components/student-application-form/application.preview.ts b/source/components/student-application-form/application.preview.ts index 9ca5886..4713289 100644 --- a/source/components/student-application-form/application.preview.ts +++ b/source/components/student-application-form/application.preview.ts @@ -173,7 +173,6 @@ import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-st ngOnInit() { this.currentUrl = this.router.url; - console.log(this.currentUrl,"url"); this.sectorsSub = this._ngRedux.select(state => { state.sectors.reduce((prevSector, sector) => { sector.courses.reduce((prevCourse, course) => { diff --git a/source/components/student-application-form/application.submit.ts b/source/components/student-application-form/application.submit.ts index 4cef1f0..566e603 100644 --- a/source/components/student-application-form/application.submit.ts +++ b/source/components/student-application-form/application.submit.ts @@ -90,6 +90,11 @@ import { HelperDataService } from '../../services/helper-data-service'; public isModalShown: BehaviorSubject; private showLoader: BehaviorSubject; public currentUrl: string; + private cu_name: string; + private cu_surname: string; + private cu_fathername: string; + private cu_mothername: string; + private disclaimer_checked: number; constructor( private _hds: HelperDataService, @@ -123,14 +128,18 @@ import { HelperDataService } from '../../services/helper-data-service'; ngOnInit() { - - - ($('#studentFormSentNotice')).appendTo("body"); this.loginInfoSub = this._ngRedux.select(state => { if (state.loginInfo.size > 0) { state.loginInfo.reduce(({}, loginInfoToken) => { this.authToken = loginInfoToken.auth_token; + + this.cu_name = loginInfoToken.cu_name; + this.cu_surname = loginInfoToken.cu_surname; + this.cu_fathername = loginInfoToken.cu_fathername; + this.cu_mothername = loginInfoToken.cu_mothername; + this.disclaimer_checked = loginInfoToken.disclaimer_checked; + return loginInfoToken; }, {}); } @@ -232,11 +241,17 @@ import { HelperDataService } from '../../services/helper-data-service'; submitNow() { //αποστολή στοιχείων μαθητή στο entity: epal_student - let aitisiObj: Array = []; + // let aitisiObj: Array = []; + let aitisiObj: Array = []; let epalObj: Array = []; let criteriaObj: Array = []; aitisiObj[0] = this.student; + aitisiObj[0].cu_name = this.cu_name; + aitisiObj[0].cu_surname = this.cu_surname; + 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'] = ...; @@ -263,7 +278,6 @@ import { HelperDataService } from '../../services/helper-data-service'; submitRecord(record) { - let auth_str = this.authToken + ":" + this.authToken; let authTokenPost = this.authToken + ":" + this.authToken; let headers = new Headers({ diff --git a/source/components/student-application-form/region.schools.select.ts b/source/components/student-application-form/region.schools.select.ts index 80cb871..071c8f1 100644 --- a/source/components/student-application-form/region.schools.select.ts +++ b/source/components/student-application-form/region.schools.select.ts @@ -134,7 +134,6 @@ import {AppSettings} from '../../app.settings'; private modalTitle: BehaviorSubject; private modalText: BehaviorSubject; - //private modalHeader: string; private modalHeader: BehaviorSubject; @@ -197,7 +196,6 @@ import {AppSettings} from '../../app.settings'; } public showModal():void { - console.log("about to show modal"); ($('#choiceSentNotice')).modal('show'); } @@ -214,12 +212,9 @@ import {AppSettings} from '../../app.settings'; if (state.epalclasses.size > 0) { state.epalclasses.reduce(({}, epalclass, i) => { this.setClassActive(epalclass.name); - console.log("My class:"); - console.log(epalclass.name); if (epalclass.name === "4") { //this.selectionLimitOptional.next(true); this.classNight.next(true); - console.log("Mphka!"); } this.getAppropriateSchools(epalclass.name); return epalclass; @@ -258,7 +253,6 @@ import {AppSettings} from '../../app.settings'; return region; }, {}); this.numSelected.next(numsel); - console.log("numselected=" + this.numSelected.getValue()); return state.regions; }).subscribe(this.regions$); } @@ -332,7 +326,6 @@ import {AppSettings} from '../../app.settings'; // || ( (numSelected | async) === 0)" if ( (this.selectionLimitOptional.value === false && this.classNight.value === false && this.numSelected.value < this.selectionLimit.value ) || (this.numSelected.value === 0) ) { - console.log("check Behaviours.."); //this.modalHeader = "modal-header-success"; this.modalHeader.next("modal-header-success"); diff --git a/source/constants.ts b/source/constants.ts index cc980a2..67ac4ba 100644 --- a/source/constants.ts +++ b/source/constants.ts @@ -34,7 +34,7 @@ export const CRITERIA_SAVE = 'CRITERIA_SAVE'; export const CRITERIA_INIT = 'CRITERIA_INIT'; //export const VALID_NAMES_PATTERN = '[Α-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$'; -export const VALID_NAMES_PATTERN = '[A-Za-zΑ-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$'; +export const VALID_NAMES_PATTERN = '[A-Za-zΑ-ΩΆΈΉΊΙΎΌΏα-ωάέήίΐύόώ ]*$'; export const VALID_ADDRESS_PATTERN = '[0-9A-Za-zΑ-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$'; export const VALID_ADDRESSTK_PATTERN = '[0-9 ]*$'; export const VALID_DIGITS_PATTERN = '69[0-9]*$'; diff --git a/source/services/helper-data-service.ts b/source/services/helper-data-service.ts index be85eeb..398a77a 100644 --- a/source/services/helper-data-service.ts +++ b/source/services/helper-data-service.ts @@ -42,11 +42,6 @@ export class HelperDataService implements OnInit, OnDestroy { state.loginInfo.reduce(({}, loginInfoToken) => { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role; - //this.minedu_userName = loginInfoToken.minedu_username; - //this.minedu_userPassword = loginInfoToken.minedu_userpassword; - console.log("Auth details.."); - console.log(this.authToken); - console.log(this.authRole); return loginInfoToken; }, {}); } @@ -115,8 +110,6 @@ export class HelperDataService implements OnInit, OnDestroy { }); let headers = new Headers({ "Content-Type": "application/json", - // "Accept": "*/*", - // "Access-Control-Allow-Credentials": "true", }); this.createAuthorizationHeader(headers); // let options = new RequestOptions({ headers: headers, withCredentials: true }); @@ -166,16 +159,7 @@ export class HelperDataService implements OnInit, OnDestroy { this.authRole = loginInfoToken.auth_role; }); let headers = new Headers({ - //"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass - // "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=", - "Content-Type": "application/json", - // "Content-Type": "text/plain", // try to skip preflight - //"X-CSRF-Token": "hVtACDJjFRSyE4bgGJENHbXY0B9yNhF71Fw-cYHSDNY" - //"X-CSRF-Token": "fj1QtF_Z_p6kE19EdCnN08zoSjVfcT4Up-ciW6I0IG8" - "X-CSRF-Token": "EHu964c7gN7M399UfHiHHv06x1Tx5cl-P-9ZyMdmGbw", - // "X-oauth-enabled": "true", - // "X-Auth-Token": this.authToken }); this.createAuthorizationHeader(headers); let options = new RequestOptions({ headers: headers }); @@ -199,15 +183,7 @@ export class HelperDataService implements OnInit, OnDestroy { this.authRole = loginInfoToken.auth_role; }); let headers = new Headers({ - //"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass - // "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=", "Content-Type": "application/json", - // "Content-Type": "text/plain", // try to skip preflight - //"X-CSRF-Token": "hVtACDJjFRSyE4bgGJENHbXY0B9yNhF71Fw-cYHSDNY" - //"X-CSRF-Token": "fj1QtF_Z_p6kE19EdCnN08zoSjVfcT4Up-ciW6I0IG8" - "X-CSRF-Token": "LU92FaWYfImfZxfldkF5eVnssdHoV7Aa9fg8K1bWYUc", - // "X-oauth-enabled": "true", - // "X-Auth-Token": this.authToken }); this.createAuthorizationHeader(headers); let options = new RequestOptions({ headers: headers }); @@ -231,15 +207,7 @@ export class HelperDataService implements OnInit, OnDestroy { this.authRole = loginInfoToken.auth_role; }); let headers = new Headers({ - //"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass - // "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=", "Content-Type": "application/json", - // "Content-Type": "text/plain", // try to skip preflight - //"X-CSRF-Token": "hVtACDJjFRSyE4bgGJENHbXY0B9yNhF71Fw-cYHSDNY" - //"X-CSRF-Token": "fj1QtF_Z_p6kE19EdCnN08zoSjVfcT4Up-ciW6I0IG8" - "X-CSRF-Token": "LU92FaWYfImfZxfldkF5eVnssdHoV7Aa9fg8K1bWYUc", - // "X-oauth-enabled": "true", - // "X-Auth-Token": this.authToken }); this.createAuthorizationHeader(headers); let options = new RequestOptions({ headers: headers }); @@ -463,12 +431,8 @@ export class HelperDataService implements OnInit, OnDestroy { }); } - - - getSubmittedPreviw() { - this.loginInfo$.getValue().forEach(loginInfoToken => { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role; @@ -516,7 +480,7 @@ export class HelperDataService implements OnInit, OnDestroy { getSectorPerSchool() { - + this.loginInfo$.getValue().forEach(loginInfoToken => { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role; @@ -532,7 +496,7 @@ export class HelperDataService implements OnInit, OnDestroy { getSpecialityPerSchool( SectorId) { - + let SectorIdNew = SectorId.toString(); this.loginInfo$.getValue().forEach(loginInfoToken => { this.authToken = loginInfoToken.auth_token; @@ -550,7 +514,7 @@ export class HelperDataService implements OnInit, OnDestroy { getStudentPerSchool( SelectId, classId, limitdown, limitup) { - + let SelectIdNew = SelectId.toString(); @@ -610,19 +574,13 @@ export class HelperDataService implements OnInit, OnDestroy { let options = new RequestOptions({ headers: headers }); return this.http.post(`${AppSettings.API_ENDPOINT}/epal/savecapacity/` + taxi + '/' + tomeas + '/' + specialit, { capacity }, options) .map(response => response.json()); - - } sendMinisrtyCredentials(username, userpassword) { let headers = new Headers({ "Content-Type": "application/json", - //"Accept": "*/*", - //"Access-Control-Allow-Credentials": "true", - //"X-CSRF-Token": "..." - //"Authorization": "Basic " + btoa("..."), }); this.createMinistryAuthorizationHeader(headers, username, userpassword); let options = new RequestOptions({ headers: headers }); @@ -649,9 +607,6 @@ export class HelperDataService implements OnInit, OnDestroy { this.createMinistryAuthorizationHeader(headers, username, userpassword ); let options = new RequestOptions({ headers: headers }); - //return this.http.get(`${AppSettings.API_ENDPOINT}/epal/distribution/` , options) - // .map(response => response.json()); - return new Promise((resolve, reject) => { this.http.post(`${AppSettings.API_ENDPOINT}/epal/distribution`, {username: username, userpassword: userpassword}, options) .map(response => response.json()) @@ -669,9 +624,6 @@ export class HelperDataService implements OnInit, OnDestroy { makeReport(username, userpassword, routepath, regionsel, adminsel, schsel, clsel, secsel, coursel) { - //console.log("Service..Nikos.."); - //console.log(regionsel); - let headers = new Headers({ "Content-Type": "application/json", }); @@ -709,36 +661,17 @@ export class HelperDataService implements OnInit, OnDestroy { }); this.createMinistryAuthorizationHeader(headers, username, userpassword ); let options = new RequestOptions({ headers: headers }); - /* - return new Promise((resolve, reject) => { - this.http.post(`${AppSettings.API_ENDPOINT}/ministry/send-massive-mail`, {username: username, userpassword: userpassword}, options) - .map(response => response.json()) - .subscribe(data => { - resolve(data); - }, - error => { - reject("Error POST in informUnlocatedStudents"); - }, - () => console.log("")); - }); - */ return this.http.get(`${AppSettings.API_ENDPOINT}/ministry/send-massive-mail` , options) .map(response => response.json()); } getSchoolPerPerfecture() { - - //let PerfectureIdNew = PerfectureId.toString(); - this.loginInfo$.getValue().forEach(loginInfoToken => { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role; }); - console.log("authToken=" + this.authToken); - console.log("authRole=" + this.authRole); - let headers = new Headers({ "Content-Type": "application/json", }); @@ -749,7 +682,6 @@ export class HelperDataService implements OnInit, OnDestroy { } getCoursePerPerfecture(PerfectureId){ - console.log(PerfectureId,"a"); let PerfectureIdNew = PerfectureId.toString(); @@ -757,8 +689,6 @@ export class HelperDataService implements OnInit, OnDestroy { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role; }); - console.log("authToken=" + this.authToken); - console.log("authRole=" + this.authRole); let headers = new Headers({ "Content-Type": "application/json", @@ -794,9 +724,6 @@ getAdminAreas(username, userpassword, regionid) { this.createMinistryAuthorizationHeader(headers, username, userpassword ); let options = new RequestOptions({ headers: headers }); - //return this.http.get(`${AppSettings.API_ENDPOINT}` + routepath , options) - // .map(response => response.json()); - console.log("Test"); console.log(`${AppSettings.API_ENDPOINT}/adminfields/list/?region=` + regionid); return this.http.get(`${AppSettings.API_ENDPOINT}/adminfields/list/?region=` + regionid , options) @@ -812,8 +739,6 @@ getSchoolsPerRegion(username, userpassword, regionid) { this.createMinistryAuthorizationHeader(headers, username, userpassword ); let options = new RequestOptions({ headers: headers }); - console.log("Test2"); - console.log(`${AppSettings.API_ENDPOINT}/schoolfields_per_region/list/?region=` + regionid); return this.http.get(`${AppSettings.API_ENDPOINT}/schoolfields_per_region/list/?region=` + regionid , options) .map(response => response.json()); } @@ -827,8 +752,6 @@ getSchoolsPerAdminArea(username, userpassword, adminid) { this.createMinistryAuthorizationHeader(headers, username, userpassword ); let options = new RequestOptions({ headers: headers }); - console.log("Test3"); - console.log(`${AppSettings.API_ENDPOINT}/schoolfields_per_admin/list/?adminarea=` + adminid); return this.http.get(`${AppSettings.API_ENDPOINT}/schoolfields_per_admin/list/?adminarea=` + adminid , options) .map(response => response.json()); } @@ -859,8 +782,6 @@ getSectors(username, userpassword, classid) { this.createMinistryAuthorizationHeader(headers, username, userpassword ); let options = new RequestOptions({ headers: headers }); - console.log("Test"); - console.log(`${AppSettings.API_ENDPOINT}/sectorfields/list`); return this.http.get(`${AppSettings.API_ENDPOINT}/sectorfields/list` , options) .map(response => response.json()); } @@ -916,8 +837,6 @@ getCapacityPerSchool(taxi, tomeas, specialit) { getSchoolId() { - - this.loginInfo$.getValue().forEach(loginInfoToken => { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role; @@ -949,10 +868,4 @@ gettypeofschool(){ } - - - - - - } diff --git a/source/store/studentdatafields/studentdatafields.reducer.ts b/source/store/studentdatafields/studentdatafields.reducer.ts index 3c2a637..4485c91 100644 --- a/source/store/studentdatafields/studentdatafields.reducer.ts +++ b/source/store/studentdatafields/studentdatafields.reducer.ts @@ -10,6 +10,14 @@ export function studentDataFieldsReducer(state: IStudentDataFields = STUDENT_DAT let ind=0; action.payload.studentDataFields.forEach(studentDataField => { + let transformedDate = studentDataField.studentbirthdate.date.year + "-"; + transformedDate += studentDataField.studentbirthdate.date.month < 10 ? "0" + studentDataField.studentbirthdate.date.month + "-" : studentDataField.studentbirthdate.date.month + "-"; + transformedDate += studentDataField.studentbirthdate.date.day < 10 ? "0" + studentDataField.studentbirthdate.date.day : studentDataField.studentbirthdate.date.day; + // transformedDate = studentDataField.studentbirthdate.jsDate; + + studentDataField.studentbirthdate = transformedDate; + + studentDataFields.push(studentDataField); ind++; }); diff --git a/source/store/studentdatafields/studentdatafields.types.ts b/source/store/studentdatafields/studentdatafields.types.ts index 5c856b1..e3250e9 100644 --- a/source/store/studentdatafields/studentdatafields.types.ts +++ b/source/store/studentdatafields/studentdatafields.types.ts @@ -31,6 +31,7 @@ export interface IStudentDataField { relationtostudent: string; currentclass: string; points: number; + telnum: string; } export type IStudentDataFields = List; -- GitLab