lock flags implementation(WIP) - Added new fields in application form -...

lock flags implementation(WIP) - Added new fields in application form - Updated submission process. Other fixes
parent c2e11bc8
......@@ -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],
......
......@@ -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,
......
......@@ -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,
......
<div class="row">
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="(criteria$ | async).size === 0"></div>
<div class = "loading" *ngIf="(criteria$ | async).size === 0 || (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">
<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()">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<p>{{ modalText | async }}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Κλείσιμο</button>
</div>
</div>
</div>
</div>
<h4> Προσωπικά Στοιχεία Μαθητή </h4>
<form novalidate [formGroup]="studentDataGroup" #form>
<form [formGroup]="applicantDataGroup">
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ συμπληρώστε τα στοιχεία του μαθητή και στη συνέχεια επιλέξτε <i>Συνέχεια</i>. <strong>Προσοχη!</strong> Παρακαλώ να συμπληρώσετε τα στοιχεία ακριβώς όπως είναι στον τελευταίο τίτλο κτήσης απολυτηρίου/ πτυχίου του μαθητή.</p>
<p style="margin-top: 20px; line-height: 2em;"> <strong> Η ακρίβεια των στοιχείων που υποβάλλονται με αυτή τη δήλωση μπορεί να ελεγχθεί με βάση το αρχείο άλλων υπηρεσιών (άρθρο 8 παρ. 4 Ν. 1599/1986)</strong></p>
<p style="margin-top: 20px; line-height: 2em;"> <b> Η ακρίβεια των στοιχείων που υποβάλλονται με αυτή τη δήλωση μπορεί να ελεγχθεί με βάση το αρχείο άλλων υπηρεσιών (άρθρο 8 παρ. 4 Ν. 1599/1986)</b></p>
<p style="margin-top: 20px; line-height: 2em;"> <b> Όλα τα πεδία που συνοδεύονται από (*) είναι απαραίτητο να συμπληρωθούν</b></p>
<table>
<tr><td>
<div class="form-group">
<label for="guardianfirstname">Όνομα κηδεμόνα</label><input class="form-control" type="text" formControlName="guardianfirstname" disabled = "true">
<div *ngFor="let loginInfoRow$ of loginInfo$ | async; let i=index;" style = "margin-bottom: 20px;" >
<div class="row evenin" style="margin: 0px 5px 0px 5px;">
<div class="col-md-12" style="font-size: 1em; font-weight: bold; text-align: center;">Στοιχεία αιτούμενου κηδεμόνα</div>
</div>
</td>
<td>
<div class="form-group">
<label for="guardiansurname">Επώνυμο κηδεμόνα</label><input class="form-control" type="text" formControlName="guardiansurname" disabled = "true">
<div class="row oddin" style="margin: 0px 5px 0px 5px;">
<div class="col-md-3" style="font-size: 0.8em;">Όνομα</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_name }}</div>
<div class="col-md-3" style="font-size: 0.8em;">Επώνυμο</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_surname }}</div>
</div>
</td></tr>
</table>
</form>
<div class="row oddin" style="margin: 0px 5px 0px 5px;">
<div class="col-md-3" style="font-size: 0.8em;">Όνομα πατέρα</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_fathername }}</div>
<div class="col-md-3" style="font-size: 0.8em;">Όνομα μητέρας</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_mothername }}</div>
</div>
</div>
<div class="form-group">
<label for="name">Όνομα μαθητή</label><input class="form-control" type="text" formControlName="name">
<label for="name">Όνομα μαθητή(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="name">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('name').touched && studentDataGroup.get('name').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -34,7 +60,7 @@
</div>
<div class="form-group">
<label for="studentsurname">Επώνυμο μαθητή</label><input class="form-control" type="text" formControlName="studentsurname">
<label for="studentsurname">Επώνυμο μαθητή(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="studentsurname">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentsurname').touched && studentDataGroup.get('studentsurname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -44,7 +70,7 @@
</div>
<div class="form-group">
<label for="fatherfirstname">Όνομα πατέρα</label><input class="form-control" type="text" formControlName="fatherfirstname">
<label for="fatherfirstname">Όνομα πατέρα(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="fatherfirstname">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('fatherfirstname').touched && studentDataGroup.get('fatherfirstname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -54,7 +80,7 @@
</div>
<div class="form-group">
<label for="fathersurname">Επώνυμο πατέρα</label><input class="form-control" type="text" formControlName="fathersurname">
<label for="fathersurname">Επώνυμο πατέρα(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="fathersurname">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('fathersurname').touched && studentDataGroup.get('fathersurname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -64,7 +90,7 @@
</div>
<div class="form-group">
<label for="motherfirstname">Όνομα μητέρας</label><input class="form-control" type="text" formControlName="motherfirstname">
<label for="motherfirstname">Όνομα μητέρας(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="motherfirstname">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('motherfirstname').touched && studentDataGroup.get('motherfirstname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -74,7 +100,7 @@
</div>
<div class="form-group">
<label for="mothersurname">Γένος μητέρας</label><input class="form-control" type="text" formControlName="mothersurname">
<label for="mothersurname">Γένος μητέρας(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="mothersurname">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('mothersurname').touched && studentDataGroup.get('mothersurname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -83,35 +109,21 @@
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
<!--
<div class="form-group">
<label for="studentbirthdate">Ημερομηνία γέννησης</label>
<input class="form-control" type="text" formControlName="studentbirthdate">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').pristine ">
Η ημερομηνία γέννησης πρέπει να είναι της μορφής ΗΗ/ΜΜ/ΕΕΕΕ
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').dirty && studentDataGroup.get('studentbirthdate').hasError('pattern')">
Η ημερομηνία γέννησης πρέπει να είναι της μορφής ΗΗ/ΜΜ/ΕΕΕΕ
</div>
-->
<div class="form-group">
<label for="studentbirthdate">Ημερομηνία γέννησης</label>
<input class="form-control" type="date" formControlName="studentbirthdate">
<label for="studentbirthdate">Ημερομηνία γέννησης - Δεν πληκτρολογείτε. Επιλέξτε το εικονίδιο δεξιά!(<span style="color: #ff0000;">*</span>)</label>
<my-date-picker name="studentbirthdate" [options]="myDatePickerOptions"
formControlName="studentbirthdate" locale="el"></my-date-picker>
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').touched && studentDataGroup.get('studentbirthdate').hasError('required')">
Συμπληρώστε την ημερομηνία γέννησης του μαθητή!
</div>
<table>
<tr>
<td>
<div class="form-group">
<label for="regionaddress">Διεύθυνση κατοικίας</label><input class="form-control" type="text" formControlName="regionaddress">
<label for="regionaddress">Διεύθυνση κατοικίας(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="regionaddress">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionaddress').touched && studentDataGroup.get('regionaddress').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -122,7 +134,7 @@
</td>
<td>
<div class="form-group">
<label for="regiontk">TK </label><input class="form-control" type="text" formControlName="regiontk">
<label for="regiontk">TK(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="regiontk">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regiontk').touched && studentDataGroup.get('regiontk').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -133,7 +145,7 @@
</td>
<td>
<div class="form-group">
<label for="regionarea">Πόλη/Περιοχή</label><input class="form-control" type="text" formControlName="regionarea">
<label for="regionarea">Πόλη/Περιοχή(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="regionarea">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionarea').touched && studentDataGroup.get('regionarea').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -146,9 +158,9 @@
</table>
<div class="form-group">
<label for="certificatetype">Τύπος απολυτηρίου</label><br/>
<label for="certificatetype">Τύπος απολυτηρίου(<span style="color: #ff0000;">*</span>)</label><br/>
<select class="form-control" formControlName="certificatetype">
<option value="noincomecriterio">Παρακαλώ επιλέξτε..</option>
<option value="">Παρακαλώ επιλέξτε...</option>
<option value="Απολυτήριο Γυμνασίου">Απολυτήριο Γυμνασίου</option>
<option value="Απολυτήριο Λυκείου">Απολυτήριο Λυκείου</option>
</select>
......@@ -158,9 +170,9 @@
</div>
<div class="form-group">
<label for="relationtostudent">Η αίτηση γίνεται από:</label><br/>
<label for="relationtostudent">Η αίτηση γίνεται από:(<span style="color: #ff0000;">*</span>)</label><br/>
<select class="form-control" formControlName="relationtostudent">
<option value="noincomecriterio">Παρακαλώ επιλέξτε..</option>
<option value="">Παρακαλώ επιλέξτε...</option>
<option value="Γονέας/Κηδεμόνας">Γονέας/Κηδεμόνας</option>
<option value="Μαθητής">Μαθητής</option>
</select>
......@@ -170,7 +182,7 @@
</div>
<div class="form-group">
<label for="telnum">Κινητό Τηλέφωνο</label><input class="form-control" type="text" formControlName="telnum">
<label for="telnum">Κινητό Τηλέφωνο(<span style="color: #ff0000;">*</span>)</label><input class="form-control" type="text" formControlName="telnum">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('telnum').touched && studentDataGroup.get('telnum').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
......@@ -181,36 +193,6 @@
<form novalidate [formGroup]="studentCriteriaGroup">
<!--
<fieldset class="group">
-->
<!-- TEST for defining income in combolist in a redux-dynamic way-->
<!--
<select #cblsttest class="form-control" (change)="checkstatus(cblsttest)" formControlName="incometest">
<option *ngFor="let criterIncome$ of criteriaIncome$ | async; let i=index">
<div *ngIf="criter$.name === 'Εισόδημα' && criter$.name !== 'Απόσταση'">
{{criterIncome$.name}}> </div> </option>
</select>
-->
<!--
<div class="form-group">
<label for="income">Το κατά κεφαλήν εισόδημα στο προηγούμενο φορολογικό έτος είναι:</label><br/>
<select #cblst class="form-control" (change)="checkstatus(cblst)" formControlName="income">
<option value="noincomecriterio" [selected] = "selectionIncomeId === 0" >Παρακαλώ επιλέξτε..</option>
<option value="<= 3000 Ευρώ" [selected] = "selectionIncomeId === 8" >μικρότερο ή ίσο των 3000 Ευρώ</option>
<option value="<= 6000 Ευρώ" [selected] = "selectionIncomeId === 9" >μικρότερο ή ίσο των 6000 Ευρώ</option>
<option value="<= 9000 Ευρώ" [selected] = "selectionIncomeId === 10" >μικρότερο ή ίσο των 9000 Ευρώ</option>
<option value="> 9000 Ευρώ" [selected] = "selectionIncomeId === 11" >μεγαλύτερο των 9000 Ευρώ</option>
</select>
<div class="alert alert-danger" *ngIf=" studentCriteriaGroup.get('income').hasError('status')">
Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
</div>
</div>
-->
<div formArrayName="formArray">
......@@ -247,9 +229,6 @@
<div class="row">
</div>
<!--
</fieldset>
-->
</div>
</form>
......@@ -261,7 +240,7 @@
</button>
</div>
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right isclickable" style="width: 9em;" (click)="submitSelected()" [disabled]="studentDataGroup.invalid || studentCriteriaGroup.invalid ">
<button type="button" class="btn-primary btn-lg pull-right isclickable" style="width: 9em;" (click)="submitSelected()">
<span style="font-size: 0.9em; font-weight: bold;">Συνέχεια&nbsp;&nbsp;&nbsp;</span><i class="fa fa-forward"></i>
</button>
</div>
......@@ -269,3 +248,5 @@
</div>
</form>
<!-- <pre>{{studentDataGroup.value | json}}</pre> -->
......@@ -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<ILoginInfo>;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>;
private rss = new FormArray([]);
//private selectionIncomeId = <number>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<IAppState>,
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() {
(<any>$('#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() {
(<any>$('#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<mutual_ids.length; i++) {
this.studentCriteriaGroup.controls['formArray']['controls'][mutual_ids[i]-1].setValue(false);
//console.log("Hi!");
//console.log(mutual_ids);
console.log(this.studentCriteriaGroup.controls['formArray']['controls']);
console.log(this.studentCriteriaGroup.controls['formArray']['controls'][mutual_ids[i]-1]); }
}
}
//this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
}
/*
checkstatus(cb) {
if (cb.value === "<= 3000 Ευρώ")
this.selectionIncomeId = 8;
else if (cb.value === "<= 6000 Ευρώ")
this.selectionIncomeId = 9;
else if (cb.value === "<= 9000 Ευρώ")
this.selectionIncomeId = 10;
else if (cb.value === "> 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 {
(<any>$('#applicationFormNotice')).modal('show');
}
public hideModal():void {
(<any>$('#applicationFormNotice')).modal('hide');
}
}
......@@ -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) => {
......
......@@ -90,6 +90,11 @@ import { HelperDataService } from '../../services/helper-data-service';
public isModalShown: BehaviorSubject<boolean>;
private showLoader: BehaviorSubject<boolean>;
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() {
(<any>$('#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<Student | StudentEpalChosen[] | StudentCriteriaChosen[] | StudentCourseChosen | StudentSectorChosen > = [];
// let aitisiObj: Array<Student | StudentEpalChosen[] | StudentCriteriaChosen[] | StudentCourseChosen | StudentSectorChosen > = [];
let aitisiObj: Array<any> = [];
let epalObj: Array<StudentEpalChosen> = [];
let criteriaObj: Array<StudentCriteriaChosen> = [];
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({
......
......@@ -134,7 +134,6 @@ import {AppSettings} from '../../app.settings';
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
//private modalHeader: string;
private modalHeader: BehaviorSubject<string>;
......@@ -197,7 +196,6 @@ import {AppSettings} from '../../app.settings';
}