resolved issues regarding edit app and smallclasses, fixed bug regarding...

resolved issues regarding edit app and smallclasses, fixed bug regarding deletions and num of app, several optimizations
parent 6909fc86
......@@ -355,7 +355,7 @@ class ApplicationSubmit extends ControllerBase
}
//έλεγχος πληρότητας τμήματος
if ( $epalConfig->activate_second_period->value === "1")
if ( $epalConfig->lock_small_classes->value === "1")
{
$classIdChecked = $applicationForm[0]['currentclass'];
$secIdChecked = "-1";
......@@ -402,6 +402,35 @@ class ApplicationSubmit extends ControllerBase
}
//τέλος ελέγχου πληρότητας
//έλεγχος μη εγκεκριμένων τμημάτων - γίνεται στην τροποποίηση αίτησης και όταν είναι ενεργή η μη προβολή μη εγκεκριμένων τμημάτων
if ($epalConfig->lock_small_classes) {
for ($i = 0; $i < sizeof($applicationForm[1]); $i++) {
if ($applicationForm[0]['currentclass'] === "1")
$epalSchools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(
array('id' => $applicationForm[1][$i]['epal_id'], 'approved_a' => 1));
else if ($applicationForm[0]['currentclass'] === "2")
$epalSchools = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(
array('epal_id' => $applicationForm[1][$i]['epal_id'] ,'sector_id' => $applicationForm[3]['sectorfield_id'], 'approved_sector' => 1));
else if ($applicationForm[0]['currentclass'] === "3")
$epalSchools = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(
array('epal_id' => $applicationForm[1][$i]['epal_id'] ,'specialty_id' => $applicationForm[3]['coursefield_id'], 'approved_speciality' => 1));
else if ($applicationForm[0]['currentclass'] === "4")
$epalSchools = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(
array('epal_id' => $applicationForm[1][$i]['epal_id'] ,'specialty_id' => $applicationForm[3]['coursefield_id'], 'approved_speciality_d' => 1));
$epalSchool = reset($epalSchools);
if (!$epalSchool) {
$schoolName = $this->retrieveSchoolName($applicationForm[1][$i]['epal_id']);
$err_code = 9003;
return $this->respondWithStatus([
"error_code" => $err_code,
"school_name" => $schoolName
], Response::HTTP_OK);
}
}
}
//end
$crypt = new Crypt();
try {
......@@ -883,6 +912,7 @@ class ApplicationSubmit extends ControllerBase
'birthdate',
));
$esQuery->condition('es.' . $userIdField, $applicantUser->id(), '=');
$esQuery->condition('es.delapp' , 0, '=');
$existing = $esQuery->execute()->fetchAll(\PDO::FETCH_OBJ);
if ($existing && sizeof($existing) > 0) {
$crypt = new Crypt();
......
......@@ -658,6 +658,7 @@ class GelApplicationSubmit extends ControllerBase
'birthdate',
));
$esQuery->condition('es.' . $userIdField, $applicantUser->id(), '=');
$esQuery->condition('es.delapp' , 0, '=');
$existing = $esQuery->execute()->fetchAll(\PDO::FETCH_OBJ);
if ($existing && sizeof($existing) > 0) {
$crypt = new Crypt();
......
......@@ -16,10 +16,10 @@ export class RegionSchoolsActions {
private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) { }
getRegionSchools = (classActive, courseActive, reload) => {
getRegionSchools = (classActive, courseActive, editApp, reload) => {
const { regions } = this._ngRedux.getState();
if (reload === true || (reload === false && regions.size === 0)) {
return this._hds.getRegionsWithSchools(classActive, courseActive).then(regions => {
return this._hds.getRegionsWithSchools(classActive, courseActive, editApp).then(regions => {
return this._ngRedux.dispatch({
type: REGIONSCHOOLS_RECEIVED,
payload: {
......
......@@ -25,7 +25,7 @@ import { HelperDataService } from "../../services/helper-data-service";
</div>
</div>
</div>
<div style="min-height: 500px;">
<form>
......@@ -45,10 +45,10 @@ import { HelperDataService } from "../../services/helper-data-service";
<p></p>
<div class = "row" [hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-8">&nbsp;</div>
<div [hidden]="SchoolNames$.id !== regionActive" class="col-md-4 pull-right" style="color: black;" >
<div [hidden]="SchoolNames$.id !== regionActive" class="col-md-4 pull-right" style="color: black;" >
<span aria-hidden="true">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="setActiveRegion(SchoolNames$.id)">Κλείσιμο</button>
</span>
</span>
</div>
</div>
......@@ -56,7 +56,7 @@ import { HelperDataService } from "../../services/helper-data-service";
[class.oddin]="isOdd2" [class.evenin]="isEven2" [class.changecolor]="calccolor(CoursesNames$.size,CoursesNames$.limitdown)"
[class.changecolorbalck]="calccolor(CoursesNames$.limitdown, CoursesNames$.size)"
[class.selectedappout]="regionActive === j"
[hidden]="(SchoolNames$.id !== regionActive) ||(calccolor(CoursesNames$.size,CoursesNames$.limitdown) === false) "
[hidden]="(SchoolNames$.id !== regionActive) ||(calccolor(CoursesNames$.size,CoursesNames$.limitdown) === false) "
style="margin: 0px 2px 0px 2px;" >
......@@ -143,14 +143,11 @@ import { HelperDataService } from "../../services/helper-data-service";
setActiveRegion(ind) {
this.CoursesPerPerf$.next([{}]);
console.log(this.regionActive , ind, "test");
if (ind === this.regionActive) {
ind = -1;
this.regionActive = ind;
console.log("kleisimo");
}
else {
console.log("anoigma");
this.regionActive = ind;
this.showLoader.next(true);
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive)
......@@ -176,7 +173,6 @@ import { HelperDataService } from "../../services/helper-data-service";
if (cb.value === 2)
rtype = "0";
let type = cb.value;
console.log(type,"type");
let std = this.CoursesPerPerf$.getValue();
std[ind].approved = rtype;
......@@ -188,7 +184,7 @@ import { HelperDataService } from "../../services/helper-data-service";
this.SavedSApproved$.next([{}]);
console.log("Error saving Approved");
this.showLoader.next(false);
});
});
}
......
......@@ -199,7 +199,8 @@
<option *ngIf = "(appUpdate | async)" [selected]="true" value={{reltostud.value}}>{{reltostud.value}}</option>
<option *ngIf = "(appUpdate | async) && (reltostud.value != 'Γονέας/Κηδεμόνας') && (numAppChildren | async) < (numChildren | async)" value="Γονέας/Κηδεμόνας">Γονέας/Κηδεμόνας</option>
<option *ngIf = "(appUpdate | async) && (reltostud.value != 'Μαθητής') && !(numAppSelf | async)" value="Μαθητής">Μαθητής</option>
<option *ngIf = "(appUpdate | async) && (reltostud.value != 'Μαθητής') && (numAppSelf | async) == 0 " value="Μαθητής">Μαθητής</option>
</select>
......
......@@ -139,6 +139,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
private epalclassesSub: Subscription;
private loginInfoSub: Subscription;
private datamodeSub: Subscription;
private epalUserDataSub: Subscription;
private datamode$: BehaviorSubject<IDataModeRecords>;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
......@@ -203,6 +204,11 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
(<any>$("#studentFormSentNotice")).appendTo("body");
window.scrollTo(0, 0);
this.epalUserDataSub = this._hds.getApplicantUserData().subscribe(x => {
if ( Number(x.numAppSelf) > 0 && Number(x.numAppChildren) >= Number(x.numChildren))
this.hasright = 0;
});
this.loginInfoSub = this._ngRedux.select("loginInfo")
.map(loginInfo => <ILoginInfoRecords>loginInfo)
.subscribe(linfo => {
......@@ -214,8 +220,8 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
this.cu_fathername = loginInfoObj.cu_fathername;
this.cu_mothername = loginInfoObj.cu_mothername;
this.disclaimer_checked = loginInfoObj.disclaimer_checked;
if ( Number(loginInfoObj.numapp_self) > 0 && Number(loginInfoObj.numapp_children) >= Number(loginInfoObj.numchildren) )
this.hasright = 0;
//if ( Number(loginInfoObj.numapp_self) > 0 && Number(loginInfoObj.numapp_children) >= Number(loginInfoObj.numchildren) )
// this.hasright = 0;
return loginInfoObj;
}, {});
......@@ -228,18 +234,6 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
.subscribe(ecs => {
if (ecs.size > 0) {
ecs.reduce(({}, datamode,i) => {
//ΠΡΟΣΟΧΗ: να τροποποιήσω τον τρόπο για έλεγχο πληρότητας..
/*
if (datamode.get("app_update") === true) {
this.app_update.next(true);
this.appId.next(datamode.get("appid"));
this.previousClass.next(datamode.get("currentclass"));
this.previousSector.next(datamode.get("sector_name"));
this.previousCourse.next(datamode.get("course_name"));
for (let i=0; i < datamode.get("epal_name_choice").length; i++)
this.previousSchools.next(datamode.get("epal_name_choice")[i].epal_id + "," + this.previousSchools.getValue());
}
*/
if (datamode.get("app_update") === true) {
this.app_update.next(true);
this.appId.next(datamode.get("appid"));
......@@ -249,7 +243,6 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
for (let i=0; i < datamode.get("epal_choice").length; i++)
this.previousSchools.next(datamode.get("epal_choice")[i].id + "," + this.previousSchools.getValue());
}
return datamode;
}, {});
} else {
......@@ -331,26 +324,22 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
ngOnDestroy() {
(<any>$("#studentFormSentNotice")).remove();
if (this.studentDataFieldsSub) {
if (this.studentDataFieldsSub)
this.studentDataFieldsSub.unsubscribe();
}
if (this.regionsSub) {
if (this.regionsSub)
this.regionsSub.unsubscribe();
}
if (this.sectorsSub) {
if (this.sectorsSub)
this.sectorsSub.unsubscribe();
}
if (this.sectorFieldsSub) {
if (this.sectorFieldsSub)
this.sectorFieldsSub.unsubscribe();
}
if (this.epalclassesSub) {
if (this.epalclassesSub)
this.epalclassesSub.unsubscribe();
}
if (this.loginInfoSub) {
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
}
if (this.datamodeSub)
this.datamodeSub.unsubscribe();
this.datamodeSub.unsubscribe();
if (this.epalUserDataSub)
this.epalUserDataSub.unsubscribe();
}
submitNow(newapp) {
......@@ -358,15 +347,6 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
//έλεγχος αν πρέπει να γίνει έλεγχος πληρότητας
let nonCheckOccupancy = "$";
if (newapp === false) {
/*
if (this.classSelected === this.previousClass.getValue() && this.sectorSelectedName === this.previousSector.getValue() && this.courseSelectedName === this.previousCourse.getValue()) {
for (let i=0; i < this.epalSelectedName.length; i++) {
if (this.previousSchools.getValue().indexOf(this.epalSelectedName[i]) !== -1) {
nonCheckOccupancy += this.epalSelectedId[i] + "$";
}
}
}
*/
if (this.classSelected === this.previousClass.getValue() && this.sectorSelected === this.previousSector.getValue() && this.courseSelected === this.previousCourse.getValue()) {
for (let i=0; i < this.epalSelectedId.length; i++) {
if (this.previousSchools.getValue().indexOf(this.epalSelectedId[i]) !== -1) {
......@@ -374,18 +354,6 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
}
}
}
/*
console.log(this.classSelected);
console.log(this.previousClass.getValue());
console.log(this.sectorSelected);
console.log(this.previousSector.getValue());
console.log(this.courseSelected);
console.log(this.previousCourse.getValue());
console.log(this.previousSchools.getValue());
console.log(this.epalSelectedId);
console.log(nonCheckOccupancy);
*/
}
......@@ -584,9 +552,14 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
mHeader = "modal-header-danger";
break;
case 9001:
let schoolName = success.school_name;
//let schoolName = success.school_name;
mTitle = "Αποτυχία Υποβολής Δήλωσης Προτίμησης";
mText = "Το σχολείο " + success.school_name + " που επιλέξατε, δεν έχει αυτή τη στιγμή διαθέσιμες θέσεις εγγραφής. Για να ολοκληρώσετε την υποβολή της αίτησης θα πρέπει να τροποποιήσετε τις επιλογές σχολικών μονάδων που κάνατε.";
mHeader = "modal-header-danger";
break;
case 9003:
mTitle = "Αποτυχία Υποβολής Δήλωσης Προτίμησης";
mText = "Το σχολείο " + schoolName + " που επιλέξατε, δεν έχει αυτή τη στιγμή διαθέσιμες θέσεις εγγραφής. Για να ολοκληρώσετε την υποβολή της αίτησης θα πρέπει να τροποποιήσετε τις επιλογές σχολικών μονάδων που κάνατε.";
mText = "Το τμήμα στο σχολείο " + success.school_name + " που επιλέξατε, είναι ΜΗ ΕΓΚΕΚΡΙΜΕΝΟ. Για να ολοκληρώσετε την υποβολή της αίτησης θα πρέπει να τροποποιήσετε τις επιλογές σχολικών μονάδων που κάνατε.";
mHeader = "modal-header-danger";
break;
default:
......
......@@ -11,8 +11,6 @@ import { SectorCoursesActions } from "../../actions/sectorcourses.actions";
import { SectorFieldsActions } from "../../actions/sectorfields.actions";
import { EPALCLASSES_INITIAL_STATE } from "../../store/epalclasses/epalclasses.initial-state";
import { IEpalClassRecords } from "../../store/epalclasses/epalclasses.types";
import { IDataModeRecords } from "../../store/datamode/datamode.types";
import { DataModeActions } from "../../actions/datamode.actions";
import { IAppState } from "../../store/store";
@Component({
......@@ -76,9 +74,6 @@ import { IAppState } from "../../store/store";
@Injectable() export default class EpalClassesSelect implements OnInit, OnDestroy {
private epalclasses$: BehaviorSubject<IEpalClassRecords>;
private epalclassesSub: Subscription;
private datamodeSub: Subscription;
private datamode$: BehaviorSubject<IDataModeRecords>;
private formGroup: FormGroup;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
......@@ -87,7 +82,6 @@ import { IAppState } from "../../store/store";
constructor(private fb: FormBuilder,
private _cfa: EpalClassesActions,
private _cfd: DataModeActions,
private _ngRedux: NgRedux<IAppState>,
private _csa: SectorCoursesActions,
private _sfa: SectorFieldsActions,
......@@ -107,38 +101,6 @@ import { IAppState } from "../../store/store";
(<any>$("#epalClassNotice")).appendTo("body");
window.scrollTo(0, 0);
this.datamodeSub = this._ngRedux.select("datamode")
.map(datamode => <IDataModeRecords>datamode)
.subscribe(ecs => {
if (ecs.size > 0) {
ecs.reduce(({}, datamode,i) => {
if (datamode.get("edit_class") === true) {
//console.log("edit class is true!");
this._cfa.saveEpalClassesSelected({name: datamode.get("currentclass")});
//this._cfd.saveDataModeSelected({edit: true, edit_class: false, app_update: true});
/*
this._cfd.saveDataModeSelected({edit: true, edit_class: false, app_update: true, currentclass: datamode.get("currentclass"),
appid: datamode.get("appid"), studentfirstname: datamode.get("studentfirstname"),
studentsurname: datamode.get("studentsurname"), fatherfirstname: datamode.get("fatherfirstname"),
motherfirstname: datamode.get("motherfirstname"), studentbirthdate: datamode.get("studentbirthdate"),
regionaddress: datamode.get("regionaddress"), regiontk: datamode.get("regiontk"),
regionarea: datamode.get("regionarea"), lastschool_schoolname: datamode.get("lastschool_schoolname"),
lastschool_registrynumber: datamode.get("lastschool_registrynumber"), lastschool_unittypeid: datamode.get("lastschool_unittypeid"),
lastschool_schoolyear: datamode.get("lastschool_schoolyear"), lastschool_class: datamode.get("lastschool_class"),
relationtostudent: datamode.get("relationtostudent"), telnum: datamode.get("telnum"),
sector_name: datamode.get("sector_name"), course_name: datamode.get("course_name"),
epal_name_choice: datamode.get("epal_name_choice")
});
*/
}
return datamode;
}, {});
} else {
}
}, error => { console.log("error selecting datamode"); });
this.epalclassesSub = this._ngRedux.select("epalclasses")
.map(epalClasses => <IEpalClassRecords>epalClasses)
.subscribe(ecs => {
......@@ -156,11 +118,10 @@ import { IAppState } from "../../store/store";
}
ngOnDestroy() {
(<any>$("#epalClassNotice")).remove();
if (this.epalclassesSub)
this.epalclassesSub.unsubscribe();
if (this.datamodeSub)
this.datamodeSub.unsubscribe();
(<any>$("#epalClassNotice")).remove();
}
public showModal(): void {
......
......@@ -198,7 +198,7 @@
<option *ngIf = "!(appUpdate | async) && !(numAppSelf | async)" value="Μαθητής">Μαθητής</option>
<option *ngIf = "(appUpdate | async)" [selected]="true" value={{reltostud.value}}>{{reltostud.value}}</option>
<option *ngIf = "(appUpdate | async) && (reltostud.value != 'Γονέας/Κηδεμόνας') && (numAppChildren| async) < (numChildren | async)" value="Γονέας/Κηδεμόνας">Γονέας/Κηδεμόνας</option>
<option *ngIf = "(appUpdate | async) && (reltostud.value != 'Γονέας/Κηδεμόνας') && (numAppChildren | async) < (numChildren | async)" value="Γονέας/Κηδεμόνας">Γονέας/Κηδεμόνας</option>
<option *ngIf = "(appUpdate | async) && (reltostud.value != 'Μαθητής') && (numAppSelf | async) == 0 " value="Μαθητής">Μαθητής</option>
</select>
......
......@@ -6,8 +6,8 @@ import { Http } from "@angular/http";
import { Router } from "@angular/router";
import { IMyDpOptions } from "mydatepicker";
import { BehaviorSubject, Observable, Subscription } from "rxjs/Rx";
import { IDataModeRecords } from "../../store/datamode/datamode.types";
import { DataModeActions } from "../../actions/datamode.actions";
//import { IDataModeRecords } from "../../store/datamode/datamode.types";
//import { DataModeActions } from "../../actions/datamode.actions";
import { GelStudentDataFieldsActions } from "../../actions/gelstudentdatafields.actions";
import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state";
import { ILoginInfoRecords } from "../../store/logininfo/logininfo.types";
......@@ -35,12 +35,12 @@ import {
private loginInfo$: BehaviorSubject<ILoginInfoRecords>;
private studentDataFields$: BehaviorSubject<IGelStudentDataFieldRecords>;
private datamode$: BehaviorSubject<IDataModeRecords>;
//private datamode$: BehaviorSubject<IDataModeRecords>;
private studentDataFieldsSub: Subscription;
private loginInfoSub: Subscription;
private criteriaSub: Subscription;
private datamodeSub: Subscription;
//private datamodeSub: Subscription;
private gelUserDataSub: Subscription;
private gelclassesSub: Subscription;
......@@ -63,7 +63,7 @@ import {
private numAppSelf: BehaviorSubject<number>;
private numAppChildren: BehaviorSubject<number>;
private numChildren: BehaviorSubject<number>;
private gelUserData$: BehaviorSubject<any>;
//private gelUserData$: BehaviorSubject<any>;
private activeClassId = -1;
private myDatePickerOptions: IMyDpOptions = {
......@@ -97,7 +97,7 @@ import {
private _sdfa: GelStudentDataFieldsActions,
private _cfb: GelClassesActions,
private hds: HelperDataService,
private _cfa: DataModeActions,
//private _cfa: DataModeActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router,
private http: Http) {
......@@ -119,8 +119,8 @@ import {
this.numAppSelf = new BehaviorSubject(0);
this.numAppChildren = new BehaviorSubject(0);
this.numChildren = new BehaviorSubject(0);
this.gelUserData$ = new BehaviorSubject(<any>{ userEmail: "", userName: "", userSurname: "", userFathername: "", userMothername: "" ,
representRole: "", numAppSelf: 0, numAppChildren: 0, numChildren: 0 });
//this.gelUserData$ = 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({
......@@ -160,7 +160,7 @@ import {
}, error => { console.log("error selecting gelclasses"); });
this.gelUserDataSub = this.hds.getApplicantUserData().subscribe(x => {
this.gelUserData$.next(x);
//this.gelUserData$.next(x);
this.numAppSelf.next(Number(x.numAppSelf));
this.numAppChildren.next(Number(x.numAppChildren));
this.numChildren.next(Number(x.numChildren));
......@@ -189,15 +189,15 @@ import {
this.studentDataGroup.controls["telnum"].setValue(studentDataField.get("telnum"));
this.studentDataGroup.controls["studentbirthdate"].setValue(this.populateDate(studentDataField.get("studentbirthdate")));
//εναλλακτικός τρόπος για προβλήματος πεδίου "Αίτηση από" στο edit app
if (this.appUpdate.getValue() === true) {
if (studentDataField.get("relationtostudent") === 'Γονέας/Κηδεμόνας')
this.numAppChildren.next(this.numAppChildren.getValue() -1) ;
else if (studentDataField.get("relationtostudent") === 'Μαθητής')
this.numAppSelf.next(this.numAppSelf.getValue() - 1);
console.log("Test drive:");
console.log(this.numAppSelf.getValue());
console.log(this.numAppChildren.getValue());
}
return studentDataField;
}, {});
......@@ -215,19 +215,18 @@ import {
}, error => { console.log("error selecting loginInfo"); });
/*
this.datamodeSub = this._ngRedux.select("datamode")
.map(datamode => <IDataModeRecords>datamode)
.subscribe(ecs => {
if (ecs.size > 0) {
ecs.reduce(({}, datamode,i) => {
this.appUpdate.next(datamode.get("app_update"));
if (this.appUpdate.getValue() === true) {
;
}
return datamode;
}, {});
}
}, error => { console.log("error selecting datamode"); });
*/
};
......@@ -268,18 +267,6 @@ import {
this.showModal();
} else {
this._sdfa.saveGelStudentDataFields([this.studentDataGroup.value]);
/*
if (this.appUpdate.getValue() === true) {
this._cfa.saveDataModeSelected({edit: false, app_update: true, appid: this.appId.getValue(),
currentclass: this.previousClass.getValue(), sector_name: this.previousSector.getValue(),
course_name: this.previousCourse.getValue(), epal_name_choice: this.previousSchools.getValue(),
relationtostudent: this.reltostud.getValue()
});
}
else {
this._cfa.saveDataModeSelected({edit: false, app_update: false});
}
*/
this.router.navigate(["/gel-application-submit"]);
......
......@@ -9,13 +9,8 @@ import { AppSettings } from "../../app.settings";
import { IAppState } from "../../store/store";
import { HelperDataService } from "../../services/helper-data-service";
import { DataModeActions } from "../../actions/datamode.actions";
//import { EpalClassesActions } from "../../actions/epalclass.actions";
//import { RegionSchoolsActions } from "../../actions/regionschools.actions";
//import { SectorCoursesActions } from "../../actions/sectorcourses.actions";
//import { SectorFieldsActions } from "../../actions/sectorfields.actions";
//import { StudentDataFieldsActions } from "../../actions/studentdatafields.actions";
import { SchoolTypeActions } from "../../actions/schooltype.actions";
import { GelClassesActions } from "../../actions/gelclasses.actions";
import { ElectiveCourseFieldsActions } from "../../actions/electivecoursesfields.actions";
......@@ -27,16 +22,8 @@ import { GELCLASSES_INITIAL_STATE } from "../../store/gelclasses/gelclasses.init
import { GELSTUDENT_DATA_FIELDS_INITIAL_STATE } from "../../store/gelstudentdatafields/gelstudentdatafields.initial-state";
import { ORIENTATIONGROUP_INITIAL_STATE } from "../../store/orientationgroup/orientationgroup.initial-state";
import { ELECTIVECOURSE_FIELDS_INITIAL_STATE } from "../../store/electivecoursesfields/electivecoursesfields.initial-state";
//import { EPALCLASSES_INITIAL_STATE } from "../../store/epalclasses/epalclasses.initial-state";
//import { STUDENT_DATA_FIELDS_INITIAL_STATE } from "../../store/studentdatafields/studentdatafields.initial-state";
import { IDataModeRecords } from "../../store/datamode/datamode.types";
//import { IEpalClassRecords } from "../../store/epalclasses/epalclasses.types";
//import { ILoginInfoRecords } from "../../store/logininfo/logininfo.types";
//import { IRegionRecords } from "../../store/regionschools/regionschools.types";
//import { ISectorRecords } from "../../store/sectorcourses/sectorcourses.types";
//import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types";
//import { IStudentDataFieldRecords } from "../../store/studentdatafields/studentdatafields.types";
import { ILoginInfoRecords } from "../../store/logininfo/logininfo.types";
import { ISchoolTypeRecords } from "../../store/schooltype/schooltype.types";
import { IGelClassRecords } from "../../store/gelclasses/gelclasses.types";
......@@ -158,12 +145,6 @@ import { StudentGelCourseChosen } from "../students/student";
private orientationSelected: BehaviorSubject<number>;
private courseSelected$: BehaviorSubject<Array<number>> = new BehaviorSubject(new Array());
//private orientationSelected;
//private electiveCoursesSelected$: BehaviorSubject<Array<number>> = new BehaviorSubject(new Array());
//private electiveCoursesSelectedOrder: Array<number> = new Array();
//private epalSelectedName: Array<string> = new Array();
//private epalSelectedId: Array<string> = new Array();
private loginInfo$: BehaviorSubject<ILoginInfoRecords>;
private gelclasses$: BehaviorSubject<IGelClassRecords>;
......@@ -177,6 +158,7 @@ import { StudentGelCourseChosen } from "../students/student";
private orientationGroupSub: Subscription;
private electivecourseFieldsSub: Subscription;
private gelstudentDataFieldsSub: Subscription;
private gelUserDataSub: Subscription;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
......@@ -231,6 +213,11 @@ import { StudentGelCourseChosen } from "../students/student";
(<any>$("#studentFormSentNotice")).appendTo("body");
window.scrollTo(0, 0);
this.gelUserDataSub = this._hds.getApplicantUserData().subscribe(x => {
if ( Number(x.numAppSelf) > 0 && Number(x.numAppChildren) >= Number(x.numChildren))
this.hasright = 0;
});
this.loginInfoSub = this._ngRedux.select("loginInfo")
.map(loginInfo => <ILoginInfoRecords>loginInfo)
.subscribe(linfo => {
......@@ -242,9 +229,8 @@ import { StudentGelCourseChosen } from "../students/student";
this.cu_fathername = loginInfoObj.cu_fathername;
this.cu_mothername = loginInfoObj.cu_mothername;
this.disclaimer_checked = loginInfoObj.disclaimer_checked;
if ( Number(loginInfoObj.numapp_self) > 0 && Number(loginInfoObj.numapp_children) >= Number(loginInfoObj.numchildren) )
this.hasright = 0;
//if ( Number(loginInfoObj.numapp_self) > 0 && Number(loginInfoObj.numapp_children) >= Number(loginInfoObj.numchildren) )
// this.hasright = 0;
return loginInfoObj;
}, {});
}
......@@ -271,10 +257,7 @@ import { StudentGelCourseChosen } from "../students/student";
.subscribe(ecs => {
ecs.reduce(({ }, gelclass) => {
if (gelclass.get("selected") == true) {
//this.classSelected = gelclass.get("id");
this.classSelected.next(gelclass.get("id"));
console.log("Debug");
console.log(this.classSelected.getValue());
}
return gelclass;
}, {});
......@@ -307,8 +290,6 @@ import { StudentGelCourseChosen } from "../students/student";
this.courseSelectedOrder.push(electivecourseField.order_id);
this.courseSelectedId.push(electivecourseField.id);
}
//console.log("Test");
//console.log(this.courseSelected$.length);
return electivecourseField;
}, {});
this.electivecourseFields$.next(sfds);
......@@ -335,6 +316,8 @@ import { StudentGelCourseChosen } from "../students/student";
}
if (this.datamodeSub)
this.datamodeSub.unsubscribe();
if (this.gelUserDataSub)
this.gelUserDataSub.unsubscribe();
}
......@@ -345,8 +328,6 @@ import { StudentGelCourseChosen } from "../students/student";
return;
let aitisiObj: Array<any> = [];
//let epalObj: Array<StudentEpalChosen> = [];
let std = this.gelstudentDataFields$.getValue().get(0);
//aitisiObj[0]: στοιχεία μαθητών
......@@ -379,10 +360,7 @@ import { StudentGelCourseChosen } from "../students/student";
aitisiObj[0].nextclass = this.classSelected.getValue();
//aitisiObj[1]: ομάδα προσανατολισμού
//$classIds = array("2", "3", "6", "7");
let classIds = ["2", "3", "6", "7"];
//if (aitisiObj[0]["nextclass"] === "2") {
//if (in_array(aitisiObj[0]["nextclass"], $classIds)) {
if (classIds.indexOf(aitisiObj[0]["nextclass"]) != -1) {
aitisiObj[1] = <any>{};
aitisiObj[1].choice_id = this.orientationSelected.getValue();
......@@ -396,34 +374,9 @@ import { StudentGelCourseChosen } from "../students/student";
for (let i = 0; i < courseSelected.length; i++) {
courseObj[i] = new StudentGelCourseChosen(null, courseSelected[i], this.courseSelectedOrder[i]);
}
//courseObj[courseSelected.length] = new StudentGelCourseChosen(null, this.orientationSelected.getValue(), null);
aitisiObj["2"] = courseObj;
}
console.log("Debugging...");
console.log(aitisiObj);
/*
let epalSelected = this.epalSelected$.getValue();
for (let i = 0; i < epalSelected.length; i++) {
epalObj[i] = new StudentEpalChosen(null, epalSelected[i], this.epalSelectedOrder[i]);
}
aitisiObj["1"] = epalObj;
*/
/*
if (aitisiObj[0]["currentclass"] === "2") {
aitisiObj["3"] = new StudentSectorChosen(null, this.sectorSelected);
} else if (aitisiObj[0]["currentclass"] === "3" || aitisiObj[0]["currentclass"] === "4") {
aitisiObj["3"] = new StudentCourseChosen(null, this.courseSelected);
}
*/
//this.submitRecord(newapp, nonCheckOccupancy, aitisiObj);
this.submitRecord(newapp, aitisiObj);
......
......@@ -184,20 +184,6 @@ import { IAppState } from "../../store/store";
}
}
/*
private saveSelected(ind: number): void {
console.log("Test value:");
console.log(this.activechoice);
console.log(ind);
if (this.activechoice == ind)
return;
this._ogs.saveOrientationGroupSelected(this.activechoice, ind);
this.activechoice = ind;
}
*/
private saveSelected(ind: number , sel: number): void {
for (let i=0; i<this.listsize; i++)
......
......@@ -16,8 +16,8 @@ import { HelperDataService } from "../../services/helper-data-service";
public formGroup: FormGroup;
private respond: any;
private epalUserData$: BehaviorSubject<any>;