Commit d2ac0e08 authored by Νίκος Κατσαούνος's avatar Νίκος Κατσαούνος

added gelAppSubmit functionality

parents d2f3dde1 40347486
......@@ -189,15 +189,19 @@ class GelApplicationSubmit extends ControllerBase
'guardian_mothername' => $applicationForm[0]['cu_mothername']
]),
//sizeof($applicationForm[1]),
$applicationForm[0]['currentclass'],
//$applicationForm[3]['sectorfield_id'],
//$applicationForm[3]['coursefield_id'],
//0,
//$applicationForm[0]['nextclass'],
//null,
//null,
//$applicationForm[1]['choice_id'],
//$applicationForm[2][0]['choice_id'],
$applicantUser, false)) > 0) {
return $this->respondWithStatus([
"msg" => "here I am",
"error_code" => $errorCode
], Response::HTTP_OK);
}
*/
*/
/*
$lastSchoolRegistryNumber = $student['lastschool_registrynumber'];
......@@ -249,39 +253,6 @@ class GelApplicationSubmit extends ControllerBase
$entity_storage_coursechosen->save($entity_object);
}
}
/*
$created_student_id = $entity_object->id();
for ($i = 0; $i < sizeof($applicationForm[1]); $i++) {
$epalchosen = array(
'student_id' => $created_student_id,
'epal_id' => $applicationForm[1][$i]['epal_id'],
'choice_no' => $applicationForm[1][$i]['choice_no']
);
$entity_storage_epalchosen = $this->entityTypeManager->getStorage('epal_student_epal_chosen');
$entity_object = $entity_storage_epalchosen->create($epalchosen);
$entity_storage_epalchosen->save($entity_object);
}
if ($applicationForm[0]['currentclass'] === "3" || $applicationForm[0]['currentclass'] === "4") {
$course = array(
'student_id' => $created_student_id,
'coursefield_id' => $applicationForm[3]['coursefield_id']
);
$entity_storage_course = $this->entityTypeManager->getStorage('epal_student_course_field');
$entity_object = $entity_storage_course->create($course);
$entity_storage_course->save($entity_object);
} elseif ($applicationForm[0]['currentclass'] === "2") {
$sector = array(
'student_id' => $created_student_id,
'sectorfield_id' => $applicationForm[3]['sectorfield_id']
);
$entity_storage_sector = $this->entityTypeManager->getStorage('epal_student_sector_field');
$entity_object = $entity_storage_sector->create($sector);
$entity_storage_sector->save($entity_object);
}
*/
return $this->respondWithStatus([
"error_code" => 0
], Response::HTTP_OK);
......@@ -290,6 +261,7 @@ class GelApplicationSubmit extends ControllerBase
$transaction->rollback();
return $this->respondWithStatus([
"msg2" => "here I am",
"error_code" => 5001
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
......@@ -623,22 +595,19 @@ class GelApplicationSubmit extends ControllerBase
*/
/*
private function validateStudent($student, $numberOfSchools, $chosenClass, $chosenSector, $chosenCourse, $epalUser = null, $appUpdate)
private function validateStudent($student/*, $numberOfSchools, $chosenClass, $chosenOrientation, $chosenElectiveCourse*/, $applicantUser = null, $appUpdate)
{
$error_code = 0;
if (!$student["hasright"] && $appUpdate == false) {
return 997;
}
if (($chosenClass === "3" || $chosenClass === "4") && !isset($chosenCourse)) {
return 998;
}
if ($chosenClass === "2" && !isset($chosenSector)) {
return 999;
}
if ($numberOfSchools < 1) {
return 1000;
}
//if (($chosenClass === "2" || $chosenClass === "3" || $chosenClass === "6" || $chosenClass === "7") && !isset($chosenOrientation)) {
// return 998;
//}
//if ( ($chosenClass === "1" || $chosenClass === "3" || $chosenClass === "4") && !isset($chosenElectiveCourse)) {
// return 999;
//}
if (!$student["agreement"] && $appUpdate == false) {
return 1001;
}
......@@ -677,12 +646,17 @@ class GelApplicationSubmit extends ControllerBase
if (preg_match(self::VALID_NAMES_PATTERN, $student["regionarea"]) !== 1) {
return 1010;
}
if (!$student["currentclass"] || ($student["currentclass"] !== "1" && $student["currentclass"] !== "2" && $student["currentclass"] !== "3" && $student["currentclass"] !== "4")) {
$classIds = array("1", "2", "3", "4", "5", "6", "7");
if (!in_array($student["nextclass"], $classIds)) {
//if (!$student["nextclass"] || ($student["nextclass"] !== "1" && $student["nextclass"] !== "2" && $student["nextclass"] !== "3" && $student["nextclass"] !== "4")) {
return 1013;
}
if (!$student["relationtostudent"]) {
return 1014;
}
if (preg_match(self::VALID_TELEPHONE_PATTERN, $student["telnum"]) !== 1) {
return 1015;
}
......@@ -711,16 +685,36 @@ class GelApplicationSubmit extends ControllerBase
return 1023;
}
// second period: check if application exists
if ($student['second_period'] == 1 && $epalUser !== null && $appUpdate == false) {
// check if application exists in gel_student entity
if (/*$student['second_period'] == 1 &&*/ $applicantUser !== null && $appUpdate == false) {
$retCode = $this->existApp("gel_student", "es.gel_userid", $applicantUser, $student);
//if ($retCode === -1)
// return 8004;
//else
// return 8005;
//return $retCode;
$esQuery = $this->connection->select('epal_student', 'es')
if ($retCode === -1) {
$retCode = $this->existApp("epal_student", "es.epaluser_id", $applicantUser);
}
if ($retCode !== -1)
return $retCode;
/*
$esQuery = $this->connection->select('gel_student', 'es')
->fields('es',
array('name',
'studentsurname',
'birthdate',
));
$esQuery->condition('es.epaluser_id', $epalUser->id(), '=');
$esQuery->condition('es.gel_userid', $applicantUser->id(), '=');
$existing = $esQuery->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -735,14 +729,44 @@ class GelApplicationSubmit extends ControllerBase
}
}
}
*/
}
return $error_code;
}
*/
private function existApp($entityName, $userIdField, $applicantUser, $student) {
$esQuery = $this->connection->select($entityName, 'es')
->fields('es',
array('name',
'studentsurname',
'birthdate',
));
//$esQuery->condition('es.gel_userid', $applicantUser->id(), '=');
$esQuery->condition($userIdField, $applicantUser->id(), '=');
$existing = $esQuery->execute()->fetchAll(\PDO::FETCH_OBJ);
if ($existing && sizeof($existing) > 0) {
$crypt = new Crypt();
foreach ($existing as $candidate) {
if (($crypt->decrypt($candidate->name) == $student['name'])
&& ($crypt->decrypt($candidate->studentsurname) == $student['studentsurname'])
&& ($candidate->birthdate == $student['birthdate'])
) {
return 8004;
}
}
}
return -1;
}
......
File mode changed from 100755 to 100644
......@@ -217,8 +217,10 @@ import {
let sdfds = <IStudentDataFieldRecords>studentDataFields;
if (sdfds.size > 0) {
sdfds.reduce(({}, studentDataField) => {
if (this.appUpdate.getValue() && !this.dataEdit.getValue())
this.lastSchName.next((studentDataField.get("lastschool_schoolname")).name);
//if (this.appUpdate.getValue() && !this.dataEdit.getValue())
this.lastSchName.next((studentDataField.get("lastschool_schoolname")).name);
if (typeof this.lastSchName.getValue() === "undefined" )
this.lastSchName.next("");
this.studentDataGroup.controls["name"].setValue(studentDataField.get("name"));
this.studentDataGroup.controls["studentsurname"].setValue(studentDataField.get("studentsurname"));
......
......@@ -12,13 +12,69 @@ import { SECTOR_COURSES_INITIAL_STATE } from "../../store/sectorcourses/sectorco
import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types";
import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfields.initial-state";
import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types";
import { SCHOOLTYPE_INITIAL_STATE } from "../../store/schooltype/schooltype.initial-state";
import { ISchoolType, ISchoolTypeRecord, ISchoolTypeRecords } from "../../store/schooltype/schooltype.types";
import { GELCLASSES_INITIAL_STATE } from "../../store/gelclasses/gelclasses.initial-state";
import { IGelClassRecords } from "../../store/gelclasses/gelclasses.types";
import { IElectiveCourseFieldRecord, IElectiveCourseFieldRecords } from "../../store/electivecoursesfields/electivecoursesfields.types";
import { IOrientationGroupRecords } from "../../store/orientationgroup/orientationgroup.types";
import { ORIENTATIONGROUP_INITIAL_STATE } from "../../store/orientationgroup/orientationgroup.initial-state";
import { IAppState } from "../../store/store";
import { ELECTIVECOURSE_FIELDS_INITIAL_STATE } from "../../store/electivecoursesfields/electivecoursesfields.initial-state";
@Component({
selector: "application-preview-select",
template: `
<div *ngFor="let schooltypeselected$ of schooltype$ | async;">
<h4 style="margin-top: 20px; line-height: 2em;">Οι επιλογές μου</h4>
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Τυπος Σχολείου στο νέο σχολικό έτος
</li>
<li class="list-group-item">
{{schooltypeselected$.get("name")}}
</li>
</ul>
</div>
<div *ngFor="let gelclass$ of gelclasses$ | async;">
<ul *ngIf= "gelclass$.selected===true" class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Τάξη φοίτησης στο νέο σχολικό έτος
</li>
<li class="list-group-item">
{{gelclass$.name}} - {{gelclass$.category}}
</li>
</ul>
</div>
<div *ngFor="let or_group$ of OrientationGroup$ | async;">
<ul *ngIf= "or_group$.selected===true" class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Ομάδα Προσανατολισμού
</li>
<li class="list-group-item">
{{or_group$.name}}
</li>
</ul>
</div>
<ul *ngIf="(selectedCourses$ | async).length>0" class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Μάθημα Επιλογής
</li>
<div *ngFor="let selectedCourse$ of selectedCourses$ | async; let i=index; let isOdd=odd; let isEven=even">
<li class="list-group-item" [class.oddout]="isOdd" [class.evenout]="isEven">
<span class="roundedNumber">{{(i+1)}}</span>{{selectedCourse$.name}}
</li>
</div>
</ul>
<div *ngFor="let epalclass$ of epalclasses$ | async;">
<h4 style="margin-top: 20px; line-height: 2em; ">Οι επιλογές μου</h4>
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Τάξη φοίτησης στο νέο σχολικό έτος
......@@ -35,7 +91,6 @@ import { IAppState } from "../../store/store";
<li class="list-group-item" *ngIf="epalclass$.get('name') === '4'">
Δ’ Λυκείου
</li>
</ul>
</div>
......@@ -84,12 +139,26 @@ import { IAppState } from "../../store/store";
private sectorsSub: Subscription;
private regionsSub: Subscription;
private sectorFieldsSub: Subscription;
private schooltype$: BehaviorSubject<ISchoolTypeRecords>;
private gelclasses$: BehaviorSubject<IGelClassRecords>;
private electivecourses$: BehaviorSubject<IElectiveCourseFieldRecords>;
private OrientationGroup$: BehaviorSubject<IOrientationGroupRecords>;
private OrientationGroupSub: Subscription;
private electivecoursesSub: Subscription;
private schooltypeSub: Subscription;
private gelclassesSub: Subscription;
private courseActive = "-1";
private numSelectedSchools = <number>0;
private numSelectedOrder = <number>0;
private classSelected = 0;
private currentUrl: string;
private electivecourseSelected = <number>0;
private selectedCourses$: BehaviorSubject<Array<IElectiveCourseFieldRecord>> = new BehaviorSubject(Array());
constructor(private _ngRedux: NgRedux<IAppState>,
private router: Router
) {
......@@ -99,6 +168,12 @@ import { IAppState } from "../../store/store";
this.sectors$ = new BehaviorSubject(SECTOR_COURSES_INITIAL_STATE);
this.sectorFields$ = new BehaviorSubject(SECTOR_FIELDS_INITIAL_STATE);
this.schooltype$ = new BehaviorSubject(SCHOOLTYPE_INITIAL_STATE);
this.gelclasses$ = new BehaviorSubject(GELCLASSES_INITIAL_STATE);
this.OrientationGroup$ = new BehaviorSubject(ORIENTATIONGROUP_INITIAL_STATE);
this.electivecourses$= new BehaviorSubject(ELECTIVECOURSE_FIELDS_INITIAL_STATE);
};
ngOnInit() {
......@@ -164,6 +239,71 @@ import { IAppState } from "../../store/store";
this.epalclasses$.next(ecs);
}, error => { console.log("error selecting epalclasses"); });
this.schooltypeSub = this._ngRedux.select("schooltype")
.map(schooltype => <ISchoolTypeRecords>schooltype)
.subscribe(ecs => {
if (ecs.size > 0) {
ecs.reduce(({}, type) => {
return type;
}, {});
} else {
//this.formGroup.controls["typeId"].setValue("0");
}
this.schooltype$.next(ecs);
}, error => { console.log("error selecting schooltype"); });
this.gelclassesSub = this._ngRedux.select("gelclasses")
.subscribe(gelclasses => {
let ecs = <IGelClassRecords>gelclasses;
ecs.reduce(({}, gelclass) => {
if (gelclass.get("name") === "Α' Λυκείου - ΗΜΕΡΗΣΙΟ")
this.classSelected = 1;
else if (gelclass.get("name") === "Β' Λυκείου")
this.classSelected = 2;
else if (gelclass.get("name") === "Γ' Λυκείου")
this.classSelected = 3;
else if (gelclass.get("name") === "A' Λυκείου")
this.classSelected = 4;
else if (gelclass.get("name") === "B' Λυκείου")
this.classSelected = 5;
else if (gelclass.get("name") === "Γ' Λυκείου")
this.classSelected = 6;
else if (gelclass.get("name") === "Δ' Λυκείου")
this.classSelected = 7;
return gelclass;
}, {});
this.gelclasses$.next(ecs);
}, error => { console.log("error selecting gelclasses"); });
this.electivecoursesSub = this._ngRedux.select("electivecourseFields")
.map(electivecourseFields => <IElectiveCourseFieldRecords>electivecourseFields)
.subscribe(sfds => {
this.electivecourseSelected = 0;
let selectedCourses = Array<IElectiveCourseFieldRecord>();
sfds.reduce(({}, electivecourseField) => {
if (electivecourseField.get("selected") === true) {
++this.electivecourseSelected;
selectedCourses.push(electivecourseField.toJS());
}
return electivecourseField;
}, {});
this.electivecourses$.next(sfds);
selectedCourses.sort(this.compareCourses);
for (let i = 0; i < selectedCourses.length; i++)
selectedCourses[i].order_id = i + 1;
this.selectedCourses$.next(selectedCourses);
}, error => { console.log("error selecting electivecourseFields"); });
this.OrientationGroupSub = this._ngRedux.select("orientationGroup")
.map(orientationGroup => <IOrientationGroupRecords>orientationGroup)
.subscribe(ogs => {
this.OrientationGroup$.next(ogs);
}, error => { console.log("error selecting orientation"); });
}
compareSchools(a: IRegionSchoolRecord, b: IRegionSchoolRecord) {
......@@ -174,6 +314,14 @@ import { IAppState } from "../../store/store";
return 0;
}
compareCourses(a: IElectiveCourseFieldRecord, b: IElectiveCourseFieldRecord) {
if (a.order_id < b.order_id)
return -1;
if (a.order_id > b.order_id)
return 1;
return 0;
}
ngOnDestroy() {
if (this.regionsSub) {
this.regionsSub.unsubscribe();
......@@ -188,6 +336,19 @@ import { IAppState } from "../../store/store";
this.epalclassesSub.unsubscribe();
}
if (this.electivecoursesSub){
this.electivecoursesSub.unsubscribe();
}
if (this.OrientationGroupSub){
this.OrientationGroupSub.unsubscribe();
}
if (this.gelclassesSub){
this.gelclassesSub.unsubscribe();
}
if (this.schooltypeSub){
this.schooltypeSub.unsubscribe();
}
}
}
......@@ -42,9 +42,9 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
<p style="margin-top: 5px; line-height: 2em;"> Παρακαλώ καθορίστε την κατηγορία ΓΕΛ που θα φοιτήσει ο μαθητής
κατά το σχολικό έτος 2018-19, επιλέγοντας ΗΜΕΡΗΣΙΟ ή ΕΣΠΕΡΙΝΟ.</p>
<div style= "margin-top: 50px; margin-bottom: 100px;">
<label for="category">Κατηγορία ΓΕ.Λ.</label><br/>
<label for="category">Τύπος ΓΕ.Λ.:</label><br/>
<select class="form-group" #type_sel class="form-control" formControlName="category" (change)="categoryselected(type_sel)">
<option value="0">Επιλέξτε Τύπο ΓΕΛ</option>
<option value="0">Επιλέξτε Τύπο ΓΕ.Λ.</option>
<option value="ΗΜΕΡΗΣΙΟ">ΗΜΕΡΗΣΙΟ</option>
<option value="ΕΣΠΕΡΙΝΟ">ΕΣΠΕΡΙΝΟ</option>
</select>
......@@ -91,7 +91,7 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
constructor(private fb: FormBuilder,
private _ngRedux: NgRedux<IAppState>,
private _cfa: GelClassesActions,
private _gca: GelClassesActions,
private _ogs: OrientationGroupActions,
private _cfe: ElectiveCourseFieldsActions,
......@@ -113,7 +113,7 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
ngOnInit() {
(<any>$("#gelClassNotice")).appendTo("body");
this._cfa.getClassesList(false);
this._gca.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
......@@ -165,7 +165,9 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
public categoryselected(typeId) {
this.categoryChosen = typeId.value;
this._cfa.resetGelClassesSelected();
this._gca.resetGelClassesSelected();
this._ogs.initOrientationGroup();
this._cfe.initElectiveCourseFields();
if (this.categoryChosen == "ΗΜΕΡΗΣΙΟ" || this.categoryChosen == "ΕΣΠΕΡΙΝΟ") {
this.enableclassfilter=true;
......@@ -185,7 +187,7 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
this.showModal();
}
else {
this._cfa.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
this._gca.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
//Όταν class_id = 3 (Γ' Λυκείου - Ημερήσιο), τότε πήγαινε πρώτα στη σελίδα επιλογής για επιλογή προσανατολισμού
//και μετά στην επιλογή για μάθημα επιλογής
if (this.formGroup.value.classId === "2" || this.formGroup.value.classId === "3" || this.formGroup.value.classId === "6" || this.formGroup.value.classId === "7")
......@@ -200,15 +202,19 @@ import { gelclassesReducer } from "../../store/gelclasses/gelclasses.reducer";
initializestore() {
this._cfa.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
this._gca.saveGelClassesSelected(this.classActive-1, this.formGroup.value.classId-1);
this.classActive=this.formGroup.value.classId;
this._cfe.initElectiveCourseFields();
this._ogs.initOrientationGroup();
if (this.classActive == 2 || this.classActive == 3 || this.classActive == 6 || this.classActive == 7 )
//Πρεπει να γινουν init και τα 2 καθε φορα
//π.χ. επιλεγει αρχικα Γ - Εσπερινο και διαλεγεις ΟΠ
//επιστρεφεις και αλλαζεις Β - Εσπερινο. Θα πρεπει να κανεις Init το ΟΠ (δεν γινεται πιο κατω)
/* if (this.classActive == 2 || this.classActive == 3 || this.classActive == 6 || this.classActive == 7 )
this._ogs.initOrientationGroup();
if (this.classActive == 1 || this.classActive == 3 || this.classActive == 4 )
this._cfe.initElectiveCourseFields();
this._cfe.initElectiveCourseFields(); */
}
}
......@@ -60,11 +60,13 @@ import { IAppState } from "../../store/store";
ngOnDestroy() {
if (this.electivecourseFieldsSub) this.electivecourseFieldsSub.unsubscribe();
if (this.gelclassesSub) this.gelclassesSub.unsubscribe();
}
selectClass() {
this._cfb.getClassesList(false);
//this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
......
......@@ -101,48 +101,50 @@ import {
private _ngRedux: NgRedux<IAppState>,
private router: Router,
private http: Http) {
this.populateSchoolyears();
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.appId = new BehaviorSubject("");
this.appUpdate = new BehaviorSubject(false);
this.dataEdit = new BehaviorSubject(false);
this.lastSchName = new BehaviorSubject("");
this.previousClass = new BehaviorSubject("");
this.previousSector = new BehaviorSubject("");
this.previousCourse = new BehaviorSubject("");
this.previousSchools = new BehaviorSubject("");
this.reltostud = new BehaviorSubject("");
this.numAppSelf = new BehaviorSubject(0);
this.numAppChildren = new BehaviorSubject(0);
this.numChildren = new BehaviorSubject(0);
this.epalUserData$ = new BehaviorSubject(<any>{ userEmail: "", userName: "", userSurname: "", userFathername: "", userMothername: "" ,
representRole: "", numAppSelf: 0, numAppChildren: 0, numChildren: 0 });
this.studentDataFields$ = new BehaviorSubject(GELSTUDENT_DATA_FIELDS_INITIAL_STATE);
this.studentDataGroup = this.fb.group({
name: ["ΑΛΙΚΗ", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]],
studentsurname: ["ΚΑΤΣΑΟΥΝΟΥ", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]],
studentbirthdate: ["2009-07-29", [Validators.required]],
fatherfirstname: ["ΝΙΚΟΣ", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]],
motherfirstname: ["ΚΑΤΕΡΙΝΑ", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]],
regionaddress: ["ΧΑΤΖΗ", [Validators.pattern(VALID_ADDRESS_PATTERN), Validators.required]],
regiontk: ["26334", [Validators.pattern(VALID_ADDRESSTK_PATTERN), Validators.required]],
regionarea: ["ΠΑΤΡA", [Validators.pattern(VALID_NAMES_PATTERN), Validators.required]],
relationtostudent: ["Γονέας/Κηδεμόνας", this.checkChoice],
telnum: ["2610331498", [Validators.pattern(VALID_TELEPHONE_PATTERN), Validators.required]],
lastschool_schoolname: ["ΛΑΠΠΑ", [Validators.required]],
lastschool_schoolyear: ["1997-1998", this.checkChoice],
lastschool_class: ["Β’", this.checkChoice],
});
this.populateSchoolyears();
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.appId = new BehaviorSubject("");
this.appUpdate = new BehaviorSubject(false);
this.dataEdit = new BehaviorSubject(false);
this.lastSchName = new BehaviorSubject("");
this.previousClass = new BehaviorSubject("");
this.previousSector = new BehaviorSubject("");
this.previousCourse = new BehaviorSubject("");
this.previousSchools = new BehaviorSubject("");
this.reltostud = new BehaviorSubject("");
this.numAppSelf = new BehaviorSubject(0);
this.numAppChildren = new BehaviorSubject(0);
this.numChildren = new BehaviorSubject(0);
this.epalUserData$ = new BehaviorSubject(<any>{ userEmail: "", userName: "", userSurname: "", userFathername: "", userMothername: "" ,
representRole: "", numAppSelf: 0, numAppChildren: 0, numChildren: 0 });
this.studentDataFields$ = new BehaviorSubject(GELSTUDENT_DATA_FIELDS_INITIAL_STATE);
this.studentDataGroup = this.fb.group({
name: ["", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]],
studentsurname: ["", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]],
studentbirthdate: ["", [Validators.required]],
fatherfirstname: ["", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]],
motherfirstname: ["", [Validators.pattern(VALID_UCASE_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]],
relationtostudent: ["", this.checkChoice],
telnum: ["", [Validators.pattern(VALID_TELEPHONE_PATTERN), Validators.required]],
lastschool_schoolname: ["", [Validators.required]],
lastschool_schoolyear: ["", this.checkChoice],
lastschool_class: ["", this.checkChoice],
});
};
ngOnInit() {
(<any>$("#applicationFormNotice")).appendTo("body");
this._cfb.getClassesList(false);
//this._cfb.getClassesList(false);
this.gelclassesSub = this._ngRedux.select("gelclasses")
.map(gelclasses => <IGelClassRecords>gelclasses)
.subscribe(ecs => {
......@@ -211,13 +213,15 @@ import {
}, error => { console.log("error selecting datamode"); });
*/
this.studentDataFieldsSub = this._ngRedux.select("studentDataFields")
this.studentDataFieldsSub = this._ngRedux.select("gelstudentDataFields")
.subscribe(studentDataFields => {
let sdfds = <IGelStudentDataFieldRecords>studentDataFields;
if (sdfds.size > 0) {
sdfds.reduce(({}, studentDataField) => {
if (this.appUpdate.getValue() && !this.dataEdit.getValue())
this.lastSchName.next((studentDataField.get("lastschool_schoolname")).name);
//if (this.appUpdate.getValue() && !this.dataEdit.getValue())
this.lastSchName.next((studentDataField.get("lastschool_schoolname")).name);
if (typeof this.lastSchName.getValue() === "undefined" )
this.lastSchName.next("");
this.studentDataGroup.controls["name"].setValue(studentDataField.get("name"));
this.studentDataGroup.controls["studentsurname"].setValue(studentDataField.get("studentsurname"));
......@@ -291,7 +295,8 @@ import {
}
*/
this.router.navigate(["/gel-application-submit"]);
this.router.navigate(["/gel-application-submit"]);
}
}
......
......@@ -552,9 +552,10 @@ import { StudentGelCourseChosen } from "../students/student";
break;
case 8004:
mTitle = "Αποτυχία Υποβολής Δήλωσης Προτίμησης";
mText = "Τα στοιχεία φοίτησης που υποβάλλατε δεν είναι έγκυρα. Παρακαλώ ελέγξτε τη φόρμα σας και προσπαθήστε ξανά. Ελέγξτε επίσης αν έχετε ήδη κάνει δήλωση για τον ίδιο μαθητή.";
mText = "Τα στοιχεία φοίτησης που υποβάλλατε δεν είναι έγκυρα. Παρακαλώ ελέγξτε τη φόρμα σας και προσπαθήστε ξανά. Επιβεβαιώστε ότι δεν έχετε ήδη κάνει δήλωση για τον ίδιο μαθητή.";
mHeader = "modal-header-danger";
break;
/*
case 9001:
let schoolName = success.school_name;
......
......@@ -113,6 +113,7 @@ import { IAppState } from "../../store/store";
ngOnDestroy() {
(<any>$("#OrientationGroupNotice")).remove();
if (this.OrientationGroupSub) this.OrientationGroupSub.unsubscribe();
if (this.gelclassesSub) this.gelclassesSub.unsubscribe();
}
public showModal(): void {
......@@ -127,8 +128,11 @@ import { IAppState } from "../../store/store";
this.isModalShown.next(false);
}
selectClass() {
this._cfb.getClassesList(false);
//this._cfb.getClassesList(false);