front-end sweepping. Deleted unneeded code. Various fixes

parent a3ed18c2
......@@ -28,7 +28,7 @@ import {
<div style="min-height: 500px;">
<form [formGroup]="formGroup">
<p style="margin-top: 20px; line-height: 2em;"> Στην παρακάτω λίστα βλέπετε τα τμήματα του σχολείου σας με την αντίστοιχη δυναμίκη τους σε αίθουσες. Παρακαλώ για να τροποποποιήσετε τη δυναμικήαυτή κάντε κλικ στον αντίστοιχο σύμβολο,
επιλέξτε τη νέα δυναμική και πατήστε το σύμβολο <i>ok</i>. Προσοχή! Κανένα τμήμα δεν πρέπει να έχει δυναμική 0.</p>
<div class="row" style="margin-top: 20px; line-height: 2em;" > <b> Οι δηλώσεις σας </b></div>
......@@ -42,17 +42,17 @@ import {
<label style="font-weight:bold!important" *ngIf="!isEdit || CapacityPerCourses$.globalindex !== courseActive" > {{CapacityPerCourses$.capacity}} </label>
<i *ngIf="!isEdit || CapacityPerCourses$.globalindex !== courseActive" (click)= "modifycapc(i,$event)" class="fa fa-pencil isclickable pull-right" style="font-size: 1.5em;"></i>
<input *ngIf="isEdit && CapacityPerCourses$.globalindex === courseActive"
id="{{CapacityPerCourses$.globalindex}}" type="number"
id="{{CapacityPerCourses$.globalindex}}" type="number"
name="{{CapacityPerCourses$.globalindex}}" value ={{CapacityPerCourses$.capacity}} (change)="handleChange($event)">
</div>
<div class="col-md-1">
<div class="col-md-1">
<i *ngIf="isEdit && CapacityPerCourses$.globalindex === courseActive" (click)= "isEdit = false" class="fa fa-ban isclickable" style="font-size: 1.5em;"></i>
</div>
<div class="col-md-2">
<div class="col-md-2">
<button *ngIf="isEdit && CapacityPerCourses$.globalindex === courseActive" type="button" class="btn-primary pull-right"
(click)="isEdit=false" (click) ="saveCapacity(CapacityPerCourses$.newspecialit, CapacityPerCourses$.newsector, CapacityPerCourses$.class, CapacityPerCourses$.capacity, CapacityPerCourses$.globalindex )">
......@@ -97,12 +97,12 @@ import {
private CapacityPerCourse$: BehaviorSubject<any>;
private CapacityPerCourseSub: Subscription;
private saveCapacitySub: Subscription;
private newvalue:number;
private newvalue: number;
private isEdit: boolean;
private courseActive = <number>-1;
private showLoader: BehaviorSubject<boolean>;
......@@ -114,27 +114,25 @@ import {
this.CapacityPerCourse$ = new BehaviorSubject([{}]);
this.showLoader = new BehaviorSubject(false);
this.isEdit = false;
this.formGroup = this.fb.group({
});
});
}
public showModal(popupMsgId):void {
console.log("about to show modal",popupMsgId);
//(<any>$('#distributionWaitingNotice')).modal('show');
public showModal(popupMsgId): void {
(<any>$(popupMsgId)).modal('show');
}
public hideModal(popupMsgId):void {
public hideModal(popupMsgId): void {
//(<any>$('#distributionWaitingNotice')).modal('hide');
(<any>$(popupMsgId)).modal('hide');
}
public onHidden(popupMsgId):void {
public onHidden(popupMsgId): void {
}
......@@ -144,89 +142,64 @@ import {
}
ngOnInit() {
(<any>$('#checksaved1')).appendTo("body");
this.CapacityPerCourseSub = this._hds.FindCapacityPerSchool().subscribe(x => {
this.CapacityPerCourse$.next(x);
},
error => {
this.CapacityPerCourse$.next([{}]);
console.log("Error Getting Capacity perSchool");
},
() => console.log("Getting School "));
(<any>$('#checksaved1')).appendTo("body");
this.CapacityPerCourseSub = this._hds.FindCapacityPerSchool().subscribe(x => {
this.CapacityPerCourse$.next(x);
},
error => {
this.CapacityPerCourse$.next([{}]);
console.log("Error Getting Capacity perSchool");
});
}
handleChange ( e: Event) {
handleChange(e: Event) {
this.newvalue = e.target['value'];
}
saveCapacity(spec,sect,taxi,oldvalue,ind){
console.log(taxi, sect, spec);
console.log(this.newvalue,"newvalue", oldvalue);
if (this.newvalue!= null)
{
if (this.newvalue <=0 || this.newvalue >10)
{
this.showModal("#checksaved1");
}
else
{
this.showLoader.next(true);
let std = this.CapacityPerCourse$.getValue();
std[ind].capacity = this.newvalue;
this.saveCapacitySub = this._hds.saveCapacity(taxi, sect, spec, this.newvalue).subscribe(data => {
this.showLoader.next(false);
this.CapacityPerCourse$.next(std);
},
error => {
std[ind].capacity = oldvalue;
this.CapacityPerCourse$.next(std);
saveCapacity(spec, sect, taxi, oldvalue, ind) {
if (this.newvalue != null) {
if (this.newvalue <= 0 || this.newvalue > 10) {
this.showModal("#checksaved1");
}
else {
this.showLoader.next(true);
let std = this.CapacityPerCourse$.getValue();
std[ind].capacity = this.newvalue;
this.saveCapacitySub = this._hds.saveCapacity(taxi, sect, spec, this.newvalue).subscribe(data => {
this.showLoader.next(false);
console.log("Error Saving Capacity");
this.CapacityPerCourse$.next(std);
},
() =>{
console.log("Saved Capacity");
error => {
std[ind].capacity = oldvalue;
this.CapacityPerCourse$.next(std);
this.showLoader.next(false);
console.log("Error Saving Capacity");
});
}
}
}
else
{
if (oldvalue === null)
this.showModal("#checksaved1");
}
}
else {
if (oldvalue === null)
this.showModal("#checksaved1");
}
}
setActive(ind) {
this.courseActive = ind;
console.log(this.courseActive, ind, "ind");
setActive(ind) {
this.courseActive = ind;
}
modifycapc(ind, e:Event)
{
this.isEdit=true;
this.setActive(ind);
this.handleChange(e);
}
modifycapc(ind, e: Event) {
this.isEdit = true;
this.setActive(ind);
this.handleChange(e);
}
}
......@@ -112,8 +112,9 @@ import {
</div>
<div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-3" style="font-size: 0.8em;">Ημερομηνία Γέννησης</div>
<div class="col-md-9" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.birthdate}}</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.birthdate}}</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">{{StudentDetails$.telnum}}</div>
</div>
<div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
......@@ -121,20 +122,24 @@ import {
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.lastschool_schoolname}}</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">{{StudentDetails$.lastschool_schoolyear}}</div>
</div>
<div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-3" style="font-size: 0.8em;">Τάξη τελευταίας φοίτησης</div>
<div *ngIf="StudentDetails$.lastschool_class === '1'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Α</div>
<div *ngIf="StudentDetails$.lastschool_class === '2'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Β</div>
<div *ngIf="StudentDetails$.lastschool_class === '3'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Γ</div>
<div *ngIf="StudentDetails$.lastschool_class === '4'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Δ</div>
<div *ngIf="StudentDetails$.lastschool_class === '1'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Α</div>
<div *ngIf="StudentDetails$.lastschool_class === '2'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Β</div>
<div *ngIf="StudentDetails$.lastschool_class === '3'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Γ</div>
<div *ngIf="StudentDetails$.lastschool_class === '4'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Δ</div>
</div>
<div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-3" style="font-size: 0.8em;">Δήλωση από:</div>
<div class="col-md-9" style="font-size: 0.8em; font-weight: bold">{{ StudentDetails$.relationtostudent }}</div>
</div>
<div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-3" style="font-size: 0.8em;">Τάξη φοίτησης για το νέο σχολικό έτος</div>
<div *ngIf="StudentDetails$.currentclass === '1'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Α</div>
<div *ngIf="StudentDetails$.currentclass === '2'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Β</div>
<div *ngIf="StudentDetails$.currentclass === '3'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Γ</div>
<div *ngIf="StudentDetails$.currentclass === '4'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Δ</div>
<div *ngIf="StudentDetails$.currentclass === '1'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Α</div>
<div *ngIf="StudentDetails$.currentclass === '2'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Β</div>
<div *ngIf="StudentDetails$.currentclass === '3'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Γ</div>
<div *ngIf="StudentDetails$.currentclass === '4'" class="col-md-9" style="font-size: 0.8em; font-weight: bold">Δ</div>
</div>
<div *ngIf="StudentDetails$.currentclass === '2'" class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-3" style="font-size: 0.8em;">Τομέας φοίτησης για το νέο σχολικό έτος</div>
......@@ -260,8 +265,6 @@ import {
public showModal(popupMsgId): void {
console.log("about to show modal", popupMsgId);
(<any>$(popupMsgId)).modal('show');
}
......@@ -293,8 +296,7 @@ import {
this.CoursesPerSchool$.next([{}]);
console.log("Error Getting courses perSchool");
this.showLoader.next(false);
},
() => console.log("Getting School "));
});
}
......@@ -313,8 +315,7 @@ import {
console.log("Error Getting Students");
this.showLoader.next(false);
this.showModal("#emptyselection");
},
() => console.log("Getting Students"));
});
}
......@@ -325,7 +326,6 @@ import {
ind = -1;
}
this.courseActive = ind;
console.log(this.courseActive, ind, "ind");
}
setActiveStudent(ind) {
......@@ -334,7 +334,6 @@ import {
ind = -1;
}
this.StudentActive = ind;
console.log(this.courseActive, ind, "ind");
}
setActiveStudentnew(ind) {
......@@ -343,7 +342,6 @@ import {
ind = -1;
}
this.StudentActive = ind;
console.log(this.courseActive, ind, "ind");
}
......@@ -357,7 +355,6 @@ import {
if (cb.value == 3)
rtype = null;
var type = cb.value;
console.log(type, "aaa");
this.showLoader.next(true);
let std = this.StudentInfo$.getValue();
......@@ -367,19 +364,14 @@ import {
this.SavedStudents$.next(data);
this.StudentInfo$.next(std);
this.showLoader.next(false);
this.showModal("#checksaved");
},
error => {
this.SavedStudents$.next([{}]);
console.log("Error saving Students");
this.showLoader.next(false);
this.showModal("#dangermodal");
},
() => {
console.log("saved Students");
this.showModal("#checksaved");
});
}
}
......@@ -32,16 +32,16 @@ import {
[class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<div class="col-md-12" style="font-size: 0.8em; font-weight: bold;" >{{SchoolNames$.name}}</div>
</li>
<div class = "row" *ngFor="let CoursesNames$ of CoursesPerPerf$ | async; let j=index; let isOdd2=odd; let isEven2=even"
<div class = "row" *ngFor="let CoursesNames$ of CoursesPerPerf$ | async; let j=index; let isOdd2=odd; let isEven2=even"
[class.oddin]="isOdd2" [class.evenin]="isEven2" [class.changecolor]="calccolor(CoursesNames$.size,CoursesNames$.limitdown)"
[class.selectedappout]="regionActive === j"
[class.selectedappout]="regionActive === j"
[hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.name}}</div>
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.size}}</div>
</div>
</div>
</form>
</div>
......@@ -61,7 +61,7 @@ import {
private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription;
private showLoader: BehaviorSubject<boolean>;
public perfecture ;
public perfecture;
private regionActive = <number>-1;
private School$: BehaviorSubject<any>;
private SchoolSub: Subscription;
......@@ -69,9 +69,9 @@ import {
constructor(private fb: FormBuilder,
private router: Router,
private _hds: HelperDataService,
) {
private router: Router,
private _hds: HelperDataService,
) {
this.SchoolsPerPerf$ = new BehaviorSubject([{}]);
this.LimitPerCateg$ = new BehaviorSubject([{}]);
this.CoursesPerPerf$ = new BehaviorSubject([{}]);
......@@ -84,65 +84,56 @@ import {
}
ngOnDestroy() {
}
}
ngOnInit() {
this.showLoader.next(true);
this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => {
this.SchoolsPerPerf$.next(data);
this.showLoader.next(false);
},
error => {
this.SchoolsPerPerf$.next([{}]);
console.log("Error Getting Schools");
},
() => console.log("Getting Schools"));
this.showLoader.next(true);
this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => {
this.SchoolsPerPerf$.next(data);
this.showLoader.next(false);
},
error => {
this.SchoolsPerPerf$.next([{}]);
console.log("Error Getting Schools");
});
}
calccolor(size, limit)
{
calccolor(size, limit) {
if (size < limit)
return true;
else
return false;
if (size < limit)
return true;
else
return false;
}
setActiveRegion(ind) {
console.log(ind, this.regionActive,"ind");
if (ind === this.regionActive){
ind = -1;
this.regionActive = ind;
}
else
{
this.regionActive = ind;
this.showLoader.next(true);
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
this.showLoader.next(false);
},
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
if (ind === this.regionActive) {
ind = -1;
this.regionActive = ind;
}
else {
this.regionActive = ind;
this.showLoader.next(true);
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
this.showLoader.next(false);
},
() => console.log("Getting Courses Per Perf"));
}
this.regionActive = ind;
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
this.showLoader.next(false);
});
}
this.regionActive = ind;
}
......
......@@ -55,7 +55,7 @@ import {
private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription;
public perfecture ;
public perfecture;
private regionActive = <number>-1;
private School$: BehaviorSubject<any>;
private SchoolSub: Subscription;
......@@ -63,9 +63,9 @@ import {
constructor(private fb: FormBuilder,
private router: Router,
private _hds: HelperDataService,
) {
private router: Router,
private _hds: HelperDataService,
) {
this.SchoolsPerPerf$ = new BehaviorSubject([{}]);
this.LimitPerCateg$ = new BehaviorSubject([{}]);
this.CoursesPerPerf$ = new BehaviorSubject([{}]);
......@@ -77,59 +77,50 @@ import {
}
ngOnDestroy() {
}
}
ngOnInit() {
this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => {
this.SchoolsPerPerf$.next(data);
},
error => {
this.SchoolsPerPerf$.next([{}]);
console.log("Error Getting Schools");
},
() => console.log("Getting Schools"));
this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => {
this.SchoolsPerPerf$.next(data);
},
error => {
this.SchoolsPerPerf$.next([{}]);
console.log("Error Getting Schools");
});
}
setActiveRegion(ind) {
setActiveRegion(ind) {
if (ind === this.regionActive)
ind = -1;
if (ind === this.regionActive)
ind = -1;
this.regionActive = ind;
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.regionActive = ind;
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
},
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
},
() => console.log("Getting Courses Per Perf"));
});
}
navigateToApplication()
{
navigateToApplication() {
var id: string= String(this.regionActive);
this.router.navigate(['', {ids:id}]);
var id: string = String(this.regionActive);
this.router.navigate(['', { ids: id }]);
}
calccolor(size, limit)
{
calccolor(size, limit) {
if (size < limit)
return true;
else
return false;
if (size < limit)
return true;
else
return false;
}
}
......@@ -71,9 +71,9 @@ import { API_ENDPOINT } from '../../app.settings';
private settings$: BehaviorSubject<any>;
loginInfoSub: Subscription;
private settingsSub: Subscription;
private numSuccessMails:number;
private numFailMails:number;
private successSending:number;
private numSuccessMails: number;
private numFailMails: number;
private successSending: number;
private apiEndPoint = API_ENDPOINT;
private minedu_userName: string;
private minedu_userPassword: string;
......@@ -85,133 +85,118 @@ import { API_ENDPOINT } from '../../app.settings';
private activatedRoute: ActivatedRoute,
private router: Router) {
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
this.settings$ = new BehaviorSubject([{}]);
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
this.settings$ = new BehaviorSubject([{}]);
}
ngOnInit() {
(<any>$('#emaiSentNotice')).appendTo("body");
(<any>$('#emaiSentNotice')).appendTo("body");
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.minedu_userName = loginInfoToken.minedu_username;
this.minedu_userPassword = loginInfoToken.minedu_userpassword;
return loginInfoToken;
}, {});
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.minedu_userName = loginInfoToken.minedu_username;
this.minedu_userPassword = loginInfoToken.minedu_userpassword;
return loginInfoToken;
}, {});
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.numSuccessMails = 0;
this.numFailMails = 0;
this.successSending = -1;
this.numSuccessMails = 0;
this.numFailMails = 0;
this.successSending = -1;
this.retrieveSettings();
this.retrieveSettings();
}
ngOnDestroy() {
(<any>$('#emaiSentNotice')).remove();
(<any>$('#emaiSentNotice')).remove();
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.settingsSub)
this.settingsSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.settings$)
this.settings$.unsubscribe();
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.settingsSub)
this.settingsSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.settings$)
this.settings$.unsubscribe();
}
public showModal():void {
console.log("about to show modal");
public showModal(): void {
(<any>$('#emaiSentNotice')).modal('show');
}
public hideModal():void {
public hideModal(): void {
(<any>$('#emaiSentNotice')).modal('hide');
}
public onHidden():void {
public onHidden(): void {
//this.isModalShown.next(false);
}
informUnlocatedStudents(unallocated) {
this.successSending = -2;
this.numSuccessMails = 0;
this.numFailMails = 0;
this._hds.informUnlocatedStudents(this.minedu_userName, this.minedu_userPassword, unallocated).subscribe(data => {
this.numSuccessMails = data.num_success_mail;
this.numFailMails = data.num_fail_mail;