Profile now is saved to store on updates. Various fixes. application.submit...

Profile now is saved to store on updates. Various fixes. application.submit restructured. Browser refresh handling
parent 3e2c4ae9
......@@ -84,7 +84,7 @@ class ApplicationSubmit extends ControllerBase {
//'lastam' => $applicationForm[0][lastam],
'currentclass' => $applicationForm[0][currentclass],
'guardian_name' => $applicationForm[0][cu_name],
'guardian_surnname' => $applicationForm[0][cu_surname],
'guardian_surname' => $applicationForm[0][cu_surname],
'guardian_fathername' => $applicationForm[0][cu_fathername],
'guardian_mothername' => $applicationForm[0][cu_mothername],
'agreement' => $applicationForm[0][disclaimer_checked],
......
import { LOGININFO_SAVE, LOGININFO_RECEIVED } from '../constants';
import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED } from '../constants';
import { LOGININFO_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
......@@ -32,6 +32,15 @@ export class LoginInfoActions {
});
};
saveProfile = (profile) => {
return this._ngRedux.dispatch({
type: PROFILE_SAVE,
payload: {
profile
}
});
};
initLoginInfo = () => {
return this._ngRedux.dispatch({
......
......@@ -33,6 +33,8 @@ import {AuthService} from './services/auth.service';
import SchoolAuthGuard from './guards/school.auth.guard';
import StudentAuthGuard from './guards/student.auth.guard';
import RegionEduAuthGuard from './guards/regionedu.auth.guard';
import EduAdminAuthGuard from './guards/eduadmin.auth.guard';
import MinistryAuthGuard from './guards/ministry.auth.guard';
import { ACTION_PROVIDERS } from './actions';
import Home from './components/home';
......@@ -83,7 +85,9 @@ class MyLocalization extends NgLocalization {
AuthService,
SchoolAuthGuard,
StudentAuthGuard,
RegionEduAuthGuard
RegionEduAuthGuard,
EduAdminAuthGuard,
MinistryAuthGuard
]
})
......
<div class = "loading" *ngIf="(showLoader$ | async) === true"></div>
<div id="headerNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header {{modalHeader | async}}" >
<h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i>&nbsp;&nbsp;{{ modalTitle | async }}</h3>
<button type="button" class="close pull-right" aria-label="Close" (click)="hideModal()">
<span aria-hidden="true"><i class="fa fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<p>{{ modalText | async }}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Κλείσιμο</button>
</div>
</div>
</div>
</div>
<div class="header-wrapper">
<header id="navbar" role="banner" class="navbar navbar-default">
......
......@@ -28,6 +28,9 @@ export default class HeaderComponent implements OnInit, OnDestroy {
private loginInfo$: BehaviorSubject<ILoginInfo>;
public cuser :any;
private showLoader$: BehaviorSubject<boolean>;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
private modalHeader: BehaviorSubject<string>;
constructor( private _ata: LoginInfoActions,
private _hds: HelperDataService,
......@@ -46,10 +49,14 @@ export default class HeaderComponent implements OnInit, OnDestroy {
this.cuName = '';
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.showLoader$ = new BehaviorSubject(false);
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.modalHeader = new BehaviorSubject("");
};
ngOnInit() {
(<any>$('#headerNotice')).appendTo("body");
this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
......@@ -66,6 +73,7 @@ export default class HeaderComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
(<any>$('#headerNotice')).remove();
this.loginInfo$.unsubscribe();
}
......@@ -104,4 +112,12 @@ export default class HeaderComponent implements OnInit, OnDestroy {
});
}
public showModal():void {
(<any>$('#headerNotice')).modal('show');
}
public hideModal():void {
(<any>$('#headerNotice')).modal('hide');
}
}
......@@ -32,6 +32,7 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings';
</button>
</div>
</div>
</form>
</div>
`
......
......@@ -32,16 +32,16 @@
<div *ngFor="let loginInfoRow$ of loginInfo$ | async; let i=index;" style = "margin-bottom: 20px;" >
<div class="row evenin" style="margin: 0px 5px 0px 5px;">
<div class="col-md-12" style="font-size: 1em; font-weight: bold; text-align: center;">Στοιχεία αιτούμενου κηδεμόνα</div>
<div class="row evenin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-12" style="font-size: 1em; font-weight: bold; text-align: center;">Στοιχεία αιτούμενου</div>
</div>
<div class="row oddin" style="margin: 0px 5px 0px 5px;">
<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-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_name }}</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">{{ loginInfoRow$.cu_surname }}</div>
</div>
<div class="row oddin" style="margin: 0px 5px 0px 5px;">
<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-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_fathername }}</div>
<div class="col-md-3" style="font-size: 0.8em;">Όνομα μητέρας</div>
......
......@@ -117,8 +117,9 @@ import {
this.studentDataGroup.controls['regiontk'].setValue(studentDataField.regiontk);
this.studentDataGroup.controls['regionarea'].setValue(studentDataField.regionarea);
this.studentDataGroup.controls['certificatetype'].setValue(studentDataField.certificatetype);
this.studentDataGroup.controls['relationtostudent'].setValue(studentDataField.relationtostudent);
this.studentDataGroup.controls['telnum'].setValue(studentDataField.telnum);
this.studentDataGroup.setValue({studentbirthdate: this.populateDate(studentDataField.studentbirthdate)});
this.studentDataGroup.controls['studentbirthdate'].setValue(this.populateDate(studentDataField.studentbirthdate));
return studentDataField;
}, {});
}
......@@ -192,13 +193,19 @@ import {
}
populateDate(d) {
return {
date: {
year: d ? parseInt(d.substr(0,4)) : 0,
month: d ? parseInt(d.substr(6,8)) : 0,
day: d ? parseInt(d.substr(8,10)) : 0
}
};
if (d && d.length > 0) {
return {
date: {
year: d ? parseInt(d.substr(0,4)) : 0,
month: d ? parseInt(d.substr(6,8)) : 0,
day: d ? parseInt(d.substr(8,10)) : 0
}
};
} else {
return {
date: null
};
}
}
setDate() {
......
......@@ -55,8 +55,92 @@ import { HelperDataService } from '../../services/helper-data-service';
<breadcrumbs></breadcrumbs>
</div>
<application-preview-select></application-preview-select>
<button type="button button-lg pull-right" *ngIf="(studentDataFields$ | async).size > 0 && (criteria$ | async).size > 0 && (regions$ | async).size > 0 && (epalclasses$ | async).size > 0 && (loginInfo$ | async).size > 0" class="btn-primary btn-lg pull-right" (click)="submitNow()">Υποβολή</button>
<!-- <application-preview-select></application-preview-select> -->
<div *ngFor="let loginInfoRow$ of loginInfo$ | async; let i=index;" style = "margin-bottom: 20px;" >
<div class="row evenin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
<div class="col-md-12" style="font-size: 1em; font-weight: bold; text-align: center;">Στοιχεία αιτούμενου</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-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_name }}</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">{{ loginInfoRow$.cu_surname }}</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-3" style="font-size: 0.8em; font-weight: bold">{{ loginInfoRow$.cu_fathername }}</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">{{ loginInfoRow$.cu_mothername }}</div>
</div>
</div>
<div *ngFor="let studentDataField$ of studentDataFields$ | async;">
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Στοιχεία μαθητή
</li>
</ul>
<div><label for="name">Όνομα μαθητή</label> <p class="form-control" id="name" style="border:1px solid #eceeef;"> {{studentDataField$.name}} </p> </div>
<div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" id = "studentsurname" style="border:1px solid #eceeef;"> {{studentDataField$.studentsurname}} </p></div>
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{studentDataField$.fatherfirstname}} </p></div>
<div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{studentDataField$.fathersurname}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{studentDataField$.motherfirstname}} </p></div>
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{studentDataField$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{studentDataField$.studentbirthdate}} </p></div>
<table>
<tr>
<td>
<div class="form-group">
<label for="regionaddress">Διεύθυνση κατοικίας</label><p class="form-control" id = "regionaddress" style="border:1px solid #eceeef;"> {{studentDataField$.regionaddress}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regiontk">TK </label><p class="form-control" id = "regiontk" style="border:1px solid #eceeef;"> {{studentDataField$.regiontk}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regionarea">Πόλη/Περιοχή</label><p class="form-control" id = "regionarea" style="border:1px solid #eceeef;"> {{studentDataField$.regionarea}} </p>
</div>
</td>
</tr>
</table>
<div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{studentDataField$.certificatetype}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{studentDataField$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{studentDataField$.relationtostudent}} </p></div>
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
<div *ngIf="currentUrl === '/application-submit'">
Κοινωνικά/Εισοδηματικά Κριτήρια
</div>
</li>
</ul>
</div>
<div *ngFor="let criteriaField$ of criteriaFields$ | async;">
<div *ngIf="criteriaField$.selected === true">
{{criteriaField$.name}}
</div>
</div>
<div class="row" style="margin-top: 20px; margin-bottom: 20px;" *ngIf="(criteria$ | async).size > 0">
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-left" (click)="navigateBack()">
<i class="fa fa-backward"></i>
</button>
</div>
<div class="col-md-6">
<button type="button" *ngIf="(studentDataFields$ | async).size > 0 && (criteria$ | async).size > 0 && (regions$ | async).size > 0 && (epalclasses$ | async).size > 0 && (loginInfo$ | async).size > 0" class="btn-primary btn-lg pull-right isclickable" style="width: 9em;" (click)="submitNow()">
<span style="font-size: 0.9em; font-weight: bold;">Υποβολή&nbsp;&nbsp;&nbsp;</span><i class="fa fa-forward"></i>
</button>
</div>
</div>
`
})
......@@ -342,4 +426,8 @@ import { HelperDataService } from '../../services/helper-data-service';
this.router.navigate(['/post-submit']);
}
navigateBack() {
this.router.navigate(['/student-application-form-main']);
}
}
......@@ -3,6 +3,7 @@ import { Router } from '@angular/router';
import { BehaviorSubject, Subscription, Observable } from 'rxjs/Rx';
import { VALID_EMAIL_PATTERN, VALID_NAMES_PATTERN } from '../../constants';
import { HelperDataService } from '../../services/helper-data-service';
import { LoginInfoActions } from '../../actions/logininfo.actions'
import {
FormBuilder,
......@@ -37,6 +38,7 @@ import {AppSettings} from '../../app.settings';
constructor(private fb: FormBuilder,
private router: Router,
private hds: HelperDataService,
private _prfa: LoginInfoActions,
private rd: Renderer) {
this.verificationCodeSent = new BehaviorSubject(false);
this.verificationCodeVerified = new BehaviorSubject(false);
......@@ -152,6 +154,7 @@ import {AppSettings} from '../../app.settings';
this.showLoader.next(true);
this.hds.saveProfile(this.formGroup.value)
.then(res => {
this._prfa.saveProfile(this.formGroup.value);
this.showLoader.next(false);
this.router.navigate(['/epal-class-select']);})
.catch(err => {
......
......@@ -21,6 +21,7 @@ export const EPALCLASSES_SAVE = 'EPALCLASSES_SAVE';
export const EPALCLASSES_INIT = 'EPALCLASSES_INIT';
export const LOGININFO_SAVE = 'LOGININFO_SAVE';
export const PROFILE_SAVE = 'PROFILE_SAVE';
export const LOGININFO_RECEIVED = 'LOGININFO_RECEIVED';
......
......@@ -35,13 +35,17 @@ import InformStudents from '../components/minister/minister-informstudents';
import SchoolAuthGuard from '../guards/school.auth.guard';
import StudentAuthGuard from '../guards/student.auth.guard';
import RegionEduAuthGuard from '../guards/regionedu.auth.guard';
import MinistryAuthGuard from '../guards/ministry.auth.guard';
import Breadcrumbs from '../components/main/breadcrumbs';
export const MainRoutes: Routes = [
{ path: '', component: Home },
{ path: 'logout', component: Home },
{ path: 'school', component: SchoolHome },
{ path: 'school/logout', component: SchoolHome },
{ path: 'ministry', component: MinistryHome },
{ path: 'breadcrumbs', component: Breadcrumbs },
{ path: 'ministry/logout', component: MinistryHome },
// { path: 'breadcrumbs', component: Breadcrumbs },
{ path: 'parent-form', component: ParentForm, canActivate: [StudentAuthGuard] },
{ path: 'student-application-form-main', component: StudentApplicationMain, canActivate: [StudentAuthGuard] },
// { path: 'students-list', component: StudentsList },
......@@ -57,14 +61,14 @@ export const MainRoutes: Routes = [
{ path: 'submited-person', component: SubmitedPerson, canActivate: [StudentAuthGuard] },
{ path: 'post-submit', component: AfterSubmit, canActivate: [StudentAuthGuard] },
{ path: 'school/director-view', component: DirectorView, canActivate: [SchoolAuthGuard] },
{ path: 'school/director-buttons', component: DirectorButtons },
{ path: 'school/director-buttons', component: DirectorButtons, canActivate: [SchoolAuthGuard] },
{ path: 'school/director-classcapacity', component: DirectorClassCapacity, canActivate: [SchoolAuthGuard] },
{ path: 'ministry/minister-view', component: MinisterView },
{ path: 'ministry/minister-reports', component: MinisterReports },
{ path: 'ministry/report-all-stat/:reportId', component: ReportAllStat },
{ path: 'ministry/report-general/:reportId', component: ReportGeneral },
{ path: 'ministry/report-no-capacity/:reportId', component: ReportNoCapacity },
{ path: 'ministry/minister-informstudents', component: InformStudents },
{ path: 'ministry/minister-view', component: MinisterView, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/minister-reports', component: MinisterReports, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/report-all-stat/:reportId', component: ReportAllStat, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/report-general/:reportId', component: ReportGeneral, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/report-no-capacity/:reportId', component: ReportNoCapacity, canActivate: [MinistryAuthGuard] },
{ path: 'ministry/minister-informstudents', component: InformStudents, canActivate: [MinistryAuthGuard] },
{ path: 'school/perfecture-view', component: PerfectureView, canActivate: [RegionEduAuthGuard] },
];
......
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { DIDE_ROLE } from '../constants';
import { Router } from '@angular/router';
@Injectable()
export default class EduAdminAuthGuard implements CanActivate {
constructor(private authService: AuthService, private router: Router) {}
canActivate() {
return this.authService.isLoggedIn(DIDE_ROLE).then(loggedIn => {
if (!loggedIn) {
this.router.navigate(['/school/logout']);
}
return loggedIn;
}).catch(err => {
return false;
});
}
}
import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { MINISTRY_ROLE } from '../constants';
import { Router } from '@angular/router';
@Injectable()
export default class MinistryAuthGuard implements CanActivate {
constructor(private authService: AuthService, private router: Router) {}
canActivate() {
return this.authService.isLoggedIn(MINISTRY_ROLE).then(loggedIn => {
if (!loggedIn) {
this.router.navigate(['/ministry/logout']);
}
return loggedIn;
}).catch(err => {
return false;
});
}
}
......@@ -2,13 +2,21 @@ import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { PDE_ROLE } from '../constants';
import { Router } from '@angular/router';
@Injectable()
export default class RegionEduAuthGuard implements CanActivate {
constructor(private authService: AuthService) {}
constructor(private authService: AuthService, private router: Router) {}
canActivate() {
return this.authService.isLoggedIn(PDE_ROLE).then(loggedIn => {return loggedIn;}).catch(err => {return false;});
return this.authService.isLoggedIn(PDE_ROLE).then(loggedIn => {
if (!loggedIn) {
this.router.navigate(['/school/logout']);
}
return loggedIn;
}).catch(err => {
return false;
});
}
}
......@@ -2,13 +2,21 @@ import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { SCHOOL_ROLE } from '../constants';
import { Router } from '@angular/router';
@Injectable()
export default class SchoolAuthGuard implements CanActivate {
constructor(private authService: AuthService) {}
constructor(private authService: AuthService, private router: Router) {}
canActivate() {
return this.authService.isLoggedIn(SCHOOL_ROLE).then(loggedIn => {return loggedIn;}).catch(err => {return false;});
return this.authService.isLoggedIn(SCHOOL_ROLE).then(loggedIn => {
if (!loggedIn) {
this.router.navigate(['/school/logout']);
}
return loggedIn;
}).catch(err => {
return false;
});
}
}
......@@ -2,13 +2,22 @@ import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { AuthService } from '../services/auth.service';
import { STUDENT_ROLE } from '../constants';
import { Router } from '@angular/router';
@Injectable()
export default class StudentAuthGuard implements CanActivate {
constructor(private authService: AuthService) {}
constructor(private authService: AuthService, private router: Router) {}
canActivate() {
return this.authService.isLoggedIn(STUDENT_ROLE).then(loggedIn => {return loggedIn;}).catch(err => {return false;});
return this.authService.isLoggedIn(STUDENT_ROLE).then(loggedIn => {
if (!loggedIn) {
this.router.navigate(['/logout']);
}
return loggedIn;
}).catch(err => {
console.log("exception");
return false;
});
}
}
......@@ -6,6 +6,7 @@ import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../store/store';
import { ILoginInfo, ILoginInfoToken } from '../store/logininfo/logininfo.types';
import { LOGININFO_INITIAL_STATE } from '../store/logininfo/logininfo.initial-state';
import { MINISTRY_ROLE } from '../constants';
@Injectable()
export class AuthService {
......@@ -22,8 +23,9 @@ export class AuthService {
}).subscribe(loginInfo => {
if (loginInfo.size > 0) {
loginInfo.reduce(({}, loginInfoToken) => {
console.log(loginInfoToken.auth_role,"aaaaaaa");
if (loginInfoToken.auth_token && loginInfoToken.auth_token.length > 0 && loginInfoToken.auth_role === role) {
if ((loginInfoToken.auth_token && loginInfoToken.auth_token.length > 0 && loginInfoToken.auth_role === role) ||
(loginInfoToken.minedu_username && loginInfoToken.minedu_username.length > 0 && loginInfoToken.auth_role === MINISTRY_ROLE && role === MINISTRY_ROLE)
) {
resolve(true);
}
else {
......
......@@ -214,12 +214,6 @@ export class HelperDataService implements OnInit, OnDestroy {
return new Promise((resolve, reject) => {
let getConnectionString = null;
console.log("Class:");
console.log(classActive);
console.log("Course:");
console.log(courseActive);
if (classActive === 1)
getConnectionString = `${AppSettings.API_ENDPOINT}/regions/list`;
else if (classActive === 2)
......@@ -229,9 +223,6 @@ export class HelperDataService implements OnInit, OnDestroy {
else if (classActive === 4)
getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool_night/list?course_id=${courseActive}`;
console.log("Path:");
console.log(getConnectionString);
this.http.get(getConnectionString, options)
.map(response => response.json())
.subscribe(data => {
......@@ -353,6 +344,11 @@ export class HelperDataService implements OnInit, OnDestroy {
this.http.get(`${AppSettings.API_ENDPOINT}/epal/curuser`, options)
.map(response => response.json())
.subscribe(data => {
window.onbeforeunload = function (e) {
var confirmationMessage = "\o/";
e.returnValue = confirmationMessage;
return confirmationMessage;
};
resolve(this.transformUserSchema(data, oauthtoken, oauthrole));
}, // put the data returned from the server in our variable
error => {
......@@ -421,6 +417,7 @@ export class HelperDataService implements OnInit, OnDestroy {
.map(response => response)
.subscribe(data => {
this._cookieService.removeAll();
window.onbeforeunload = function () {console.log("unloading")};
resolve(data);
}, // put the data returned from the server in our variable
error => {
......@@ -724,8 +721,6 @@ getAdminAreas(username, userpassword, regionid) {
this.createMinistryAuthorizationHeader(headers, username, userpassword );
let options = new RequestOptions({ headers: headers });
console.log("Test");
console.log(`${AppSettings.API_ENDPOINT}/adminfields/list/?region=` + regionid);
return this.http.get(`${AppSettings.API_ENDPOINT}/adminfields/list/?region=` + regionid , options)
.map(response => response.json());
}
......@@ -766,8 +761,7 @@ getUserRegistryNo(username, userpassword) {
this.createMinistryAuthorizationHeader(headers, username, userpassword );
let options = new RequestOptions({ headers: headers });
//console.log("Test");
return this.http.get(`${AppSettings.API_ENDPOINT}/ministry/retrieve-registry-id` , options)
return this.http.get(`${AppSettings.API_ENDPOINT}/ministry/retrieve-registry-id` , options)
.map(response => response.json());
}
......@@ -819,8 +813,6 @@ getCourses(username, userpassword, sectorid) {
getCapacityPerSchool(taxi, tomeas, specialit) {
console.log(tomeas,specialit,"news")
this.loginInfo$.getValue().forEach(loginInfoToken => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
......
......@@ -4,7 +4,8 @@ import { Seq } from 'immutable';
import {
LOGININFO_SAVE,
LOGININFO_INIT
LOGININFO_INIT,
PROFILE_SAVE
} from '../../constants';
export function loginInfoReducer(state: ILoginInfo = LOGININFO_INITIAL_STATE, action): ILoginInfo {
......@@ -32,6 +33,18 @@ export function loginInfoReducer(state: ILoginInfo = LOGININFO_INITIAL_STATE, ac
});
return Seq(loginInfoTokens).map(n => n).toList();
case PROFILE_SAVE:
state.forEach(loginInfoToken => {
loginInfoToken.cu_name = action.payload.profile.userName;
loginInfoToken.cu_surname = action.payload.profile.userSurname;
loginInfoToken.cu_fathername = action.payload.profile.userFathername;
loginInfoToken.cu_mothername = action.payload.profile.userMothername;
return state.withMutations(function (list) {
list.set(0, loginInfoToken);
});
});
return state;
case LOGININFO_INIT:
return LOGININFO_INITIAL_STATE;
default:
......
......@@ -10,9 +10,12 @@ export function studentDataFieldsReducer(state: IStudentDataFields = STUDENT_DAT
let ind=0;
action.payload.studentDataFields.forEach(studentDataField => {
let transformedDate = studentDataField.studentbirthdate.date.year + "-";
transformedDate += studentDataField.studentbirthdate.date.month < 10 ? "0" + studentDataField.studentbirthdate.date.month + "-" : studentDataField.studentbirthdate.date.month + "-";
transformedDate += studentDataField.studentbirthdate.date.day < 10 ? "0" + studentDataField.studentbirthdate.date.day : studentDataField.studentbirthdate.date.day;
let transformedDate = "";
if (studentDataField.studentbirthdate.date) {
transformedDate = studentDataField.studentbirthdate.date.year + "-";
transformedDate += studentDataField.studentbirthdate.date.month < 10 ? "0" + studentDataField.studentbirthdate.date.month + "-" : studentDataField.studentbirthdate.date.month + "-";
transformedDate += studentDataField.studentbirthdate.date.day < 10 ? "0" + studentDataField.studentbirthdate.date.day : studentDataField.studentbirthdate.date.day;
}
// transformedDate = studentDataField.studentbirthdate.jsDate;
studentDataField.studentbirthdate = transformedDate;
......
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