Merge branch 'application_form' into 'develop'

front-end sweepping. Deleted unneeded code. Various fixes

See merge request !171
parents f3fcbb25 47d7ec3a
......@@ -97,7 +97,7 @@ 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>;
......@@ -123,18 +123,16 @@ import {
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 {
}
......@@ -146,9 +144,6 @@ import {
ngOnInit() {
(<any>$('#checksaved1')).appendTo("body");
this.CapacityPerCourseSub = this._hds.FindCapacityPerSchool().subscribe(x => {
this.CapacityPerCourse$.next(x);
......@@ -156,33 +151,20 @@ import {
error => {
this.CapacityPerCourse$.next([{}]);
console.log("Error Getting Capacity perSchool");
},
() => console.log("Getting School "));
});
}
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)
{
saveCapacity(spec, sect, taxi, oldvalue, ind) {
if (this.newvalue != null) {
if (this.newvalue <= 0 || this.newvalue > 10) {
this.showModal("#checksaved1");
}
else
{
else {
this.showLoader.next(true);
......@@ -191,24 +173,18 @@ import {
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);
this.showLoader.next(false);
console.log("Error Saving Capacity");
},
() =>{
console.log("Saved Capacity");
});
}
}
else
{
else {
if (oldvalue === null)
this.showModal("#checksaved1");
}
......@@ -216,17 +192,14 @@ import {
setActive(ind) {
this.courseActive = ind;
console.log(this.courseActive, ind, "ind");
}
modifycapc(ind, e:Event)
{
this.isEdit=true;
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");
});
}
}
......@@ -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;
......@@ -97,19 +97,13 @@ import {
error => {
this.SchoolsPerPerf$.next([{}]);
console.log("Error Getting Schools");
},
() => console.log("Getting Schools"));
});
}
calccolor(size, limit)
{
calccolor(size, limit) {
if (size < limit)
return true;
......@@ -121,14 +115,12 @@ import {
setActiveRegion(ind) {
console.log(ind, this.regionActive,"ind");
if (ind === this.regionActive){
if (ind === this.regionActive) {
ind = -1;
this.regionActive = ind;
}
else
{
else {
this.regionActive = ind;
this.showLoader.next(true);
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
......@@ -139,8 +131,7 @@ import {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
this.showLoader.next(false);
},
() => console.log("Getting Courses Per Perf"));
});
}
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;
......@@ -87,14 +87,10 @@ import {
error => {
this.SchoolsPerPerf$.next([{}]);
console.log("Error Getting Schools");
},
() => console.log("Getting Schools"));
});
}
setActiveRegion(ind) {
if (ind === this.regionActive)
......@@ -107,24 +103,19 @@ import {
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;
......
......@@ -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;
......@@ -134,16 +134,15 @@ import { API_ENDPOINT } from '../../app.settings';
}
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);
}
......@@ -156,20 +155,6 @@ import { API_ENDPOINT } from '../../app.settings';
this._hds.informUnlocatedStudents(this.minedu_userName, this.minedu_userPassword, unallocated).subscribe(data => {
this.numSuccessMails = data.num_success_mail;
this.numFailMails = data.num_fail_mail;
//console.log("HERE!");
//console.log(this.numSuccessMails);
},
error => {
console.log("Error");
this.successSending = 0;
this.modalTitle.next("Κατανομή Μαθητών");
this.modalText.next("Αποτυχία αποστολής e-mails!");
this.modalHeader.next("modal-header-warning");
this.showModal();
},
() => {
console.log("Επιτυχής αποστολή e-mails!");
this.successSending = 1;
this.modalHeader.next("modal-header-success");
......@@ -181,37 +166,37 @@ import { API_ENDPOINT } from '../../app.settings';
}
this.modalText.next(txtModal);
this.showModal();
}
)
},
error => {
console.log("Error");
this.successSending = 0;
}
this.modalTitle.next("Κατανομή Μαθητών");
this.modalText.next("Αποτυχία αποστολής e-mails!");
this.modalHeader.next("modal-header-warning");
this.showModal();
});
}
retrieveSettings() {
this.settingsSub = this._hds.retrieveAdminSettings(this.minedu_userName, this.minedu_userPassword).subscribe(data => {
this.settings$.next(data);
},
error => {
this.settings$.next([{}]);
console.log("Error Getting MinisterRetrieveSettings");
},
() => {
console.log("Success Getting MinisterRetrieveSettings");
this.applicantsResultsDisabled = Boolean(Number(this.settings$.value['applicantsResultsDisabled']));
if (this.applicantsResultsDisabled == false) {
this.modalTitle.next("Κατανομή Μαθητών");
this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να αποστείλετε e-mail ενημέρωσης, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΕΝΕΡΓΟΠΟΙΗΣΤΕ ") +
("τη δυνατότητα της προβολής αποτελεσμάτων κατανομής από τους μαθητές.") );
("τη δυνατότητα της προβολής αποτελεσμάτων κατανομής από τους μαθητές."));
this.modalHeader.next("modal-header-warning");
this.showModal();
}
},
error => {
this.settings$.next([{}]);
console.log("Error Getting MinisterRetrieveSettings");
});
}
)
}
}
......@@ -147,10 +147,7 @@ import { API_ENDPOINT } from '../../app.settings';
state.loginInfo.reduce(({}, loginInfoToken) => {
this.minedu_userName = loginInfoToken.minedu_username;
this.minedu_userPassword = loginInfoToken.minedu_userpassword;
console.log("Role:");
console.log(loginInfoToken.auth_role);
if (loginInfoToken.auth_role == PDE_ROLE || loginInfoToken.auth_role == DIDE_ROLE) {
console.log("inside..");
this.userRole = loginInfoToken.auth_role;
this.minedu_userName = loginInfoToken.auth_token;
this.minedu_userPassword = loginInfoToken.auth_token;
......@@ -185,6 +182,4 @@ import { API_ENDPOINT } from '../../app.settings';
}
}
......@@ -160,16 +160,15 @@ import {
}
public showModal():void {
console.log("about to show modal");
public showModal(): void {
(<any>$('#configNotice')).modal('show');
}
public hideModal():void {
public hideModal(): void {
(<any>$('#configNotice')).modal('hide');
}
public onHidden():void {
public onHidden(): void {
//this.isModalShown.next(false);
}
......@@ -213,16 +212,6 @@ import {
this.settingsSub = this._hds.retrieveAdminSettings(this.minedu_userName, this.minedu_userPassword).subscribe(data => {
this.settings$.next(data);
//this.data = data;
},
error => {
this.settings$.next([{}]);
this.dataRetrieved = 0;
console.log("Error Getting MinisterRetrieveSettings");
},
() => {
console.log("Success Getting MinisterRetrieveSettings");
this.capacityDisabled = Boolean(Number(this.settings$.value['capacityDisabled']));
this.directorViewDisabled = Boolean(Number(this.settings$.value['directorViewDisabled']));
this.applicantsLoginDisabled = Boolean(Number(this.settings$.value['applicantsLoginDisabled']));
......@@ -230,9 +219,12 @@ import {
this.secondPeriodEnabled = Boolean(Number(this.settings$.value['secondPeriodEnabled']));
this.dataRetrieved = 1;
}
)
},
error => {
this.settings$.next([{}]);
this.dataRetrieved = 0;
console.log("Error Getting MinisterRetrieveSettings");
});
}
storeSettings() {
......@@ -240,10 +232,15 @@ import {
this.dataRetrieved = -1;
this.settingsSub = this._hds.storeAdminSettings(this.minedu_userName, this.minedu_userPassword,
this.capacityDisabled, this.directorViewDisabled, this.applicantsLoginDisabled, this.applicantsResultsDisabled, this.secondPeriodEnabled )
this.capacityDisabled, this.directorViewDisabled, this.applicantsLoginDisabled, this.applicantsResultsDisabled, this.secondPeriodEnabled)
.subscribe(data => {
this.settings$.next(data);
//this.data = data;
this.dataRetrieved = 1;
this.modalTitle.next("Ρύθμιση Παραμέτρων");
this.modalText.next("Έγινε εφαρμογή των νέων σας ρυθμίσεων.");
this.modalHeader.next("modal-header-success");
this.showModal();
},
error => {
this.settings$.next([{}]);
......@@ -254,22 +251,7 @@ import {
this.modalText.next("ΑΠΟΤΥΧΙΑ εφαρμογής των νέων σας ρυθμίσεων.");
this.modalHeader.next("modal-header-danger");
this.showModal();
},
() => {
console.log("Success Getting MinisterStoreSettings");
this.dataRetrieved = 1;
this.modalTitle.next("Ρύθμιση Παραμέτρων");
this.modalText.next("Έγινε εφαρμογή των νέων σας ρυθμίσεων.");
this.modalHeader.next("modal-header-success");
this.showModal();
//redundunt and has risk..Appear a modal!
//this.retrieveSettings();
}
)
});
}
toggleCapacityFilter() {
......
......@@ -103,7 +103,7 @@ import { API_ENDPOINT } from '../../app.settings';
private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>;
private settings$: BehaviorSubject<any>;
loginInfoSub: Subscription;
private loginInfoSub: Subscription;
private settingsSub: Subscription;
private apiEndPoint = API_ENDPOINT;
......@@ -115,35 +115,23 @@ import { API_ENDPOINT } from '../../app.settings';
private applicantsResultsDisabled: boolean;
private secondPeriodEnabled: boolean;
constructor(/*private fb: FormBuilder,*/
// private _ata: LoginInfoActions,
constructor(
private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService,
private activatedRoute: ActivatedRoute,
private router: Router) {
//this.formGroup = this.fb.group({
//});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
this.settings$ = new BehaviorSubject([{}]);
}
public showModal(popupMsgId):void {
console.log("about to show modal");
//(<any>$('#distributionWaitingNotice')).modal('show');
(<any>$(popupMsgId)).modal('show');
}
public hideModal(popupMsgId):void {
//(<any>$('#distributionWaitingNotice')).modal('hide');
(<any>$(popupMsgId)).modal('hide');
}
......@@ -151,29 +139,9 @@ import { API_ENDPOINT } from '../../app.settings';
}
/*
public showModal():void {
console.log("about to show modal");
(<any>$('#distributionSentNotice')).modal('show');
}
public hideModal():void {
(<any>$('#distributionSentNotice')).modal('hide');
}
public onHidden():void {
//this.isModalShown.next(false);
}
*/
ngOnDestroy() {
(<any>$('#distributionWaitingNotice')).remove();
(<any>$('#distributionNotice')).remove();
//(<any>$('#distributionFailureNotice')).remove();
//(<any>$('#distributionSentNotice')).remove();
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
if (this.settingsSub)
......@@ -185,13 +153,8 @@ import { API_ENDPOINT } from '../../app.settings';
}
ngOnInit() {
(<any>$('#distributionWaitingNotice')).appendTo("body");
(<any>$('#distributionNotice')).appendTo("body");
//(<any>$('#distributionFailureNotice')).appendTo("body");
//(<any>$('#distributionSentNotice')).appendTo("body");
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
......@@ -210,9 +173,7 @@ import { API_ENDPOINT } from '../../app.settings';
runDistribution() {
this.distStatus = "STARTED";
this.showModal("#distributionWaitingNotice");
this._hds.makeDistribution(this.minedu_userName, this.minedu_userPassword)
.then(msg => {
this.modalTitle.next("Κατανομή Μαθητών");
......@@ -223,7 +184,8 @@ import { API_ENDPOINT } from '../../app.settings';
if (this.distStatus !== "ERROR")
this.distStatus = "FINISHED";
})
.catch(err => {console.log(err);
.catch(err => {
console.log(err);
this.distStatus = "ERROR";
this.modalTitle.next("Κατανομή Μαθητών");
......@@ -249,7 +211,8 @@ import { API_ENDPOINT } from '../../app.settings';
if (this.distStatus !== "ERROR")
this.distStatus = "FINISHED";
})
.catch(err => {console.log(err);