Commit 566d628e authored by Ασπασία Κατσή's avatar Ασπασία Κατσή

Merge branch 'gelEditApp' into 'develop'

Gel edit app

See merge request itminedu/e-eggrafes!19
parents bcaf2e8f 6909fc86
......@@ -134,14 +134,13 @@ import { IAppState } from "../../store/store";
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-md-1 ">
<input type="checkbox" [checked]="smallClassApproved" formControlName="smallClassApproved"
(click)="toggleSmallClassesFilter()" >
</div>
<div class="col-md-9">
<label for="smallClassApproved">Ενεργοποίηση της επιλογής για περιορισμό των μη εγκεκριμένων ολιγομελών τμημάτων</label>
<label for="smallClassApproved">Ενεργοποίηση μη διαθεσιμότητας μη εγκεκριμένων τμημάτων</label>
</div>
</div>
<br>
......
......@@ -310,6 +310,7 @@ import {
this.showModal();
} else {
this._sdfa.saveStudentDataFields([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(),
......@@ -320,6 +321,7 @@ import {
else {
this._cfa.saveDataModeSelected({edit: false, app_update: false});
}
*/
this.router.navigate(["/application-submit"]);
}
......
......@@ -125,8 +125,8 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
private courseSelected;
private sectorSelected;
private classSelected;
private courseSelectedName;
private sectorSelectedName;
//private courseSelectedName;
//private sectorSelectedName;
private epalSelectedName: Array<string> = new Array();
private epalSelectedId: Array<string> = new Array();
private studentDataFields$: BehaviorSubject<IStudentDataFieldRecords>;
......@@ -190,8 +190,10 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
this.previousCourse = new BehaviorSubject("");
this.previousSchools = new BehaviorSubject("");
this.sectorSelectedName = null;
this.courseSelectedName = null;
//this.sectorSelectedName = null;
//this.courseSelectedName = null;
this.sectorSelected = null;
this.courseSelected = null;
this.hasright = 1;
this.previousSchools.next("");
};
......@@ -200,7 +202,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
(<any>$("#studentFormSentNotice")).appendTo("body");
window.scrollTo(0, 0);
this.loginInfoSub = this._ngRedux.select("loginInfo")
.map(loginInfo => <ILoginInfoRecords>loginInfo)
.subscribe(linfo => {
......@@ -241,6 +243,11 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
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_id"));
this.previousCourse.next(datamode.get("course_id"));
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;
......@@ -300,7 +307,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
sector.get("courses").reduce((prevCourse, course) => {
if (course.get("selected") === true) {
this.courseSelected = course.get("course_id");
this.courseSelectedName = course.get("course_name");
//this.courseSelectedName = course.get("course_name");
}
return course;
}, {});
......@@ -314,7 +321,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
sfds.reduce(({ }, sectorField) => {
if (sectorField.selected === true) {
this.sectorSelected = sectorField.id;
this.sectorSelectedName = sectorField.name;
//this.sectorSelectedName = sectorField.name;
}
return sectorField;
}, {});
......@@ -351,17 +358,37 @@ 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 entry of this.epalSelectedName) {
for (let i=0; i < this.epalSelectedName.length; i++) {
if (this.previousSchools.getValue().indexOf(this.epalSelectedName[i]) !== -1) {
nonCheckOccupancy += this.epalSelectedId[i] + "$";
}
}
}
//return;
*/
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) {
nonCheckOccupancy += this.epalSelectedId[i] + "$";
}
}
}
/*
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);
*/
}
if (this.studentDataFields$.getValue().size === 0 || this.epalSelected$.getValue().length === 0 || this.epalclasses$.getValue().size === 0 || this.loginInfo$.getValue().size === 0)
return;
......@@ -411,6 +438,7 @@ import { StudentCourseChosen, StudentEpalChosen, StudentSectorChosen } from "../
aitisiObj["3"] = new StudentCourseChosen(null, this.courseSelected);
}
this.submitRecord(newapp, nonCheckOccupancy, aitisiObj);
}
......
......@@ -117,6 +117,7 @@ import { IAppState } from "../../store/store";
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"),
......@@ -129,6 +130,7 @@ import { IAppState } from "../../store/store";
sector_name: datamode.get("sector_name"), course_name: datamode.get("course_name"),
epal_name_choice: datamode.get("epal_name_choice")
});
*/
}
return datamode;
}, {});
......
......@@ -5,7 +5,6 @@ import { Injectable } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { DataModeActions } from "../../actions/datamode.actions";
import { DATAMODE_INITIAL_STATE } from "../../store/datamode/datamode.initial-state";
import { IDataModeRecords } from "../../store/datamode/datamode.types";
import { EpalClassesActions } from "../../actions/epalclass.actions";
......@@ -212,7 +211,7 @@ import { IAppState } from "../../store/store";
<div *ngIf="GelStudentDetails$.nextclass==='1' || GelStudentDetails$.nextclass==='3' || GelStudentDetails$.nextclass==='4' " class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;">Μάθημα Επιλογης:</div>
</div>
<div *ngIf="GelStudentDetails$.nextclass==='1' || GelStudentDetails$.nextclass==='3' || GelStudentDetails$.nextclass==='4' " class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-2" style="font-size: 0.8em;"></div>
<div class="col-md-4" style="font-size: 0.8em;">Σειρά Προτίμησης</div>
......@@ -496,7 +495,6 @@ import { IAppState } from "../../store/store";
private router: Router,
private loc: Location
) {
// this.datamode$ = new BehaviorSubject(DATAMODE_INITIAL_STATE);
this.SubmitedApplic$ = new BehaviorSubject([{}]);
this.EpalSubmittedDetails$ = new BehaviorSubject([{}]);
this.showLoader$ = new BehaviorSubject(false);
......@@ -538,6 +536,8 @@ import { IAppState } from "../../store/store";
(<any>jQuery("#applicationDeleteError")).appendTo("body");
this.showLoader$.next(true);
this.resetStore();
this.SubmitedUsersSub = this._hds.getSubmittedPreviw().subscribe(
data => {
this.SubmitedApplic$.next(data);
......@@ -563,12 +563,15 @@ import { IAppState } from "../../store/store";
setActiveEpalUser(ind: number): void {
if (ind === this.applicationEpalIdActive) {
this.applicationEpalIdActive = 0;
return;
}
if (this.applicationGelIdActive != -1 || this.applicationEpalIdActive != -1)
this.resetStore();
//if (this.applicationGelIdActive != -1 || this.applicationEpalIdActive != -1)
this.resetStore();
this.applicationEpalIdActive = ind;
this.showLoader$.next(true);
......@@ -587,12 +590,15 @@ import { IAppState } from "../../store/store";
}
setActiveGelUser(ind: number): void {
if (ind === this.applicationGelIdActive) {
this.applicationGelIdActive = 0;
return;
}
if (this.applicationGelIdActive != -1 || this.applicationEpalIdActive != -1)
this.resetStore();
//if (this.applicationGelIdActive != -1 || this.applicationEpalIdActive != -1)
this.resetStore();
this.applicationGelIdActive = ind;
this.showLoader$.next(true);
......@@ -642,6 +648,7 @@ import { IAppState } from "../../store/store";
this.showConfirmModal();
}
/*
editApplication(appId: number): void {
this.applicationId = appId;
......@@ -667,6 +674,7 @@ import { IAppState } from "../../store/store";
});
}
*/
deleteApplicationDo(): void {
this.hideConfirmModal();
......@@ -726,7 +734,10 @@ import { IAppState } from "../../store/store";
//this._sta.saveSchoolTypeSelected(this.schooltype_id, this.schooltype_name);
this._eca.saveEpalClassesSelected({name: this.EpalSubmittedDetails$.getValue()[0].currentclass});
//this._eca.saveEpalClassesSelected({name: this.EpalSubmittedDetails$.getValue()[0].currentclass});
//this._eca.saveEpalClassesSelected({name: "2"});
//console.log("Test");
// console.log(this.EpalSubmittedDetails$.getValue()[0].currentclass);
/*
if (this.sector_index != -1)
......@@ -748,8 +759,9 @@ import { IAppState } from "../../store/store";
createStoreWithEpalAppData() {
//to be considered
this._eca.initEpalClasses();
//this._eca.initEpalClasses();
//
this._eca.saveEpalClassesSelected({name: this.EpalSubmittedDetails$.getValue()[0].currentclass});
let class_id = this.EpalSubmittedDetails$.getValue()[0].currentclass;
if (class_id === "2" )
......@@ -765,7 +777,11 @@ import { IAppState } from "../../store/store";
else if (class_id === "3" || class_id === "4" )
this._rsa.getRegionSchools(parseInt(class_id), parseInt(this.EpalSubmittedDetails$.getValue()[0].currentcourse_id), false);
this._cfa.saveDataModeSelected({app_update: true, appid: this.EpalSubmittedDetails$.getValue()[0].applicationId});
this._cfa.saveDataModeSelected({
app_update: true, appid: this.EpalSubmittedDetails$.getValue()[0].applicationId,
sector_id: this.EpalSubmittedDetails$.getValue()[0].currentsector_id, course_id: this.EpalSubmittedDetails$.getValue()[0].currentcourse_id,
epal_choice: this.EpalSubmittedDetails$.getValue()[0].epalSchoolsChosen, currentclass: this.EpalSubmittedDetails$.getValue()[0].currentclass
});
this._sta.saveSchoolTypeSelected(2, "ΕΠΑΛ");
let birthdate = this.EpalSubmittedDetails$.getValue()[0].birthdate;
......@@ -879,10 +895,6 @@ import { IAppState } from "../../store/store";
editGelApplication() {
//this._cfa.saveDataModeSelected({app_update: true, appid: this.GelSubmittedDetails$.getValue()[0].applicationId});
//this._sta.saveSchoolTypeSelected(this.schooltype_id, this.schooltype_name);
//this._gca.saveGelClassesSelected(-1, parseInt(this.GelSubmittedDetails$.getValue()[0].nextclass) -1 );
this.router.navigate(["/gel-class-select"]);
}
......
......@@ -227,12 +227,11 @@ export class HelperDataService implements OnInit, OnDestroy {
this.lockApprovSub = this.getStatusofLockSmallClasses().subscribe(data => {
this.lockApprov$.next(data);
this.lockApprov$.getValue().forEach(lockapp =>
{
this.lockapp = lockapp.res;
console.log(this.lockapp,"lookapp");
if (this.lockapp === 0){
this.lockApprov$.getValue().forEach(lockapp =>
{
this.lockapp = lockapp.res;
if (this.lockapp === 0){
console.log("1");
; if (classActive === 1)
getConnectionString = `${AppSettings.API_ENDPOINT}/regions/list`;
......@@ -242,11 +241,9 @@ export class HelperDataService implements OnInit, OnDestroy {
getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool/list?course_id=${courseActive}`;
else if (classActive === 4)
getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool_night/list?course_id=${courseActive}`;
}
else
{
console.log("2");
}
else
{
if (classActive === 1)
getConnectionString = `${AppSettings.API_ENDPOINT}/epal/getregions`;
else if (classActive === 2)
......@@ -255,10 +252,7 @@ export class HelperDataService implements OnInit, OnDestroy {
getConnectionString = `${AppSettings.API_ENDPOINT}/epal/getcoursesperschoolsmallclasses/`+ courseActive;
else if (classActive === 4)
getConnectionString = `${AppSettings.API_ENDPOINT}/epal/getcoursesperschoolsmallclasses_night/`+ courseActive;
}
}
this.http.get(getConnectionString, options)
.map(response => response.json())
......@@ -277,8 +271,8 @@ export class HelperDataService implements OnInit, OnDestroy {
error => {
this.lockApprov$.next([{}]);
console.log("Error getting Settings");
});
});
});
};
......@@ -324,7 +318,7 @@ export class HelperDataService implements OnInit, OnDestroy {
rsa[trackIndex].epals.push(<IRRegionSchool>{ "epal_id": regionSchool.epal_id, "epal_name": regionSchool.epal_name, "epal_special_case": regionSchool.epal_special_case, "globalIndex": j, "selected": false, "order_id": 0 });
j++;
});
return rsa;
}
......@@ -1354,7 +1348,6 @@ getStatusofLockSmallClasses()
});
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
console.log("test");
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/locksmallclasses`, options)
.map(response => response.json());
......
......@@ -10,18 +10,19 @@ export function datamodeReducer(state: IDataModeRecords = DATAMODE_INITIAL_STATE
switch (action.type) {
case DATAMODE_SAVE:
let newDataMode = Array<IDataModeRecord>();
newDataMode.push(recordify<IDataMode, IDataModeRecord>({ edit: action.payload.dataMode.edit, edit_class: action.payload.dataMode.edit_class,
app_update: action.payload.dataMode.app_update, currentclass: action.payload.dataMode.currentclass,
appid: action.payload.dataMode.appid, studentfirstname: action.payload.dataMode.studentfirstname,
newDataMode.push(recordify<IDataMode, IDataModeRecord>({
/*edit: action.payload.dataMode.edit, edit_class: action.payload.dataMode.edit_class,*/
app_update: action.payload.dataMode.app_update, appid: action.payload.dataMode.appid,
/*studentfirstname: action.payload.dataMode.studentfirstname,
studentsurname: action.payload.dataMode.studentsurname, fatherfirstname: action.payload.dataMode.fatherfirstname,
motherfirstname: action.payload.dataMode.motherfirstname, studentbirthdate: action.payload.dataMode.studentbirthdate,
regionaddress: action.payload.dataMode.regionaddress, regiontk: action.payload.dataMode.regiontk,
regionarea: action.payload.dataMode.regionarea, lastschool_schoolname: action.payload.dataMode.lastschool_schoolname,
lastschool_registrynumber: action.payload.dataMode.lastschool_registrynumber, lastschool_unittypeid: action.payload.dataMode.lastschool_unittypeid,
lastschool_schoolyear: action.payload.dataMode.lastschool_schoolyear, lastschool_class: action.payload.dataMode.lastschool_class,
relationtostudent: action.payload.dataMode.relationtostudent, telnum: action.payload.dataMode.telnum,
sector_name: action.payload.dataMode.sector_name, course_name: action.payload.dataMode.course_name,
epal_name_choice: action.payload.dataMode.epal_name_choice
relationtostudent: action.payload.dataMode.relationtostudent, telnum: action.payload.dataMode.telnum,*/
sector_id: action.payload.dataMode.sector_id, course_id: action.payload.dataMode.course_id,
epal_choice: action.payload.dataMode.epal_choice, currentclass: action.payload.dataMode.currentclass
}));
return List(newDataMode);
......
......@@ -2,31 +2,29 @@ import { List } from "immutable";
import { TypedRecord } from "typed-immutable-record";
export interface IDataMode {
edit: boolean;
edit_class: boolean;
//edit: boolean;
//edit_class: boolean;
app_update: boolean;
appid: string;
//studentfirstname: string;
//studentsurname: string;
//fatherfirstname: string;
//motherfirstname: string;
//studentbirthdate: Date;
//regionaddress: string;
//regiontk: string;
//regionarea: string;
//lastschool_schoolname: any;
//lastschool_registrynumber: string;
//lastschool_unittypeid: number;
//lastschool_schoolyear: string;
//lastschool_class: string;
//relationtostudent: string;
//telnum: string;
currentclass: string;
studentfirstname: string;
studentsurname: string;
fatherfirstname: string;
motherfirstname: string;
studentbirthdate: Date;
regionaddress: string;
regiontk: string;
regionarea: string;
lastschool_schoolname: any;
lastschool_registrynumber: string;
lastschool_unittypeid: number;
lastschool_schoolyear: string;
lastschool_class: string;
relationtostudent: string;
telnum: string;
sector_name: string;
course_name: string;
epal_name_choice: string;
sector_id: string;
course_id: string;
epal_choice: string;
}
export interface IDataModeRecord extends TypedRecord<IDataModeRecord>, IDataMode { };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment