Merge branch 'front_end_review' into 'develop'

Moved user info to header, added loaded spinner on actions, styling, conflict resolution etc

See merge request !83
parents 4d0e3dd0 ac93b76c
<div class = "loading" *ngIf="(showLoader$ | async) === true"></div>
<div class="header-wrapper">
<header id="navbar" role="banner" class="navbar navbar-default">
<div *ngIf="(loginInfo$ | async).size > 0">
<ul class="navbar-nav">
<div *ngIf="(loginInfo$ | async).cu_name !== ''">
<div class="row">
<div class="offset-md-8 col-md-4 pull-right">
<span class="username">{{ cuName }}&nbsp;&nbsp;&nbsp;&nbsp;</span>
<span class="signout isclickable" (click)="signOut()" style="color:#CC3300;">Αποσύνδεση&nbsp;&nbsp;</span>
<i class="fa fa-sign-out isclickable" (click)="signOut()"></i>
</div>
</div>
</div>
</ul>
</div>
</header>
</div>
import {Component} from '@angular/core';
import {Component, OnInit, OnDestroy} from '@angular/core';
import {Router} from '@angular/router';
import { Injectable } from "@angular/core";
import { BehaviorSubject } from 'rxjs/Rx';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { ILoginInfo, ILoginInfoToken } from '../../store/logininfo/logininfo.types';
import { HelperDataService } from '../../services/helper-data-service';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import { SCHOOL_ROLE, STUDENT_ROLE, PDE_ROLE, DIDE_ROLE, MINISTRY_ROLE } from '../../constants';
import { EpalClassesActions } from '../../actions/epalclass.actions';
import { SectorFieldsActions } from '../../actions/sectorfields.actions';
import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { SectorCoursesActions } from '../../actions/sectorcourses.actions';
import { CriteriaActions } from '../../actions/criteria.actions';
import { StudentDataFieldsActions } from '../../actions/studentdatafields.actions';
@Component({
selector: 'reg-header',
templateUrl: 'header.component.html'
})
export default class HeaderComponent { }
export default class HeaderComponent implements OnInit, OnDestroy {
private authToken: string;
private authRole: string;
private cuName: string;
private loginInfo$: BehaviorSubject<ILoginInfo>;
public cuser :any;
private showLoader$: BehaviorSubject<boolean>;
constructor( private _ata: LoginInfoActions,
private _hds: HelperDataService,
private _csa: SectorCoursesActions,
private _sfa: SectorFieldsActions,
private _rsa: RegionSchoolsActions,
private _eca: EpalClassesActions,
private _sdfa: StudentDataFieldsActions,
private _cria: CriteriaActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router
) {
this.authToken = '';
this.authRole = '';
this.cuName = '';
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.showLoader$ = new BehaviorSubject(false);
};
ngOnInit() {
this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
this.cuName = loginInfoToken.cu_name;
return loginInfoToken;
}, {})
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
}
ngOnDestroy() {
this.loginInfo$.unsubscribe();
}
signOut() {
this.showLoader$.next(true);
this._hds.signOut().then(data => {
this._ata.initLoginInfo();
if (this.authRole === SCHOOL_ROLE) {
this.router.navigate(['/school']);
}
else if (this.authRole === PDE_ROLE) {
this.router.navigate(['/school']);
}
else if (this.authRole === DIDE_ROLE) {
this.router.navigate(['/school']);
}
else if (this.authRole === STUDENT_ROLE) {
this._eca.initEpalClasses();
this._sfa.initSectorFields();
this._rsa.initRegionSchools();
this._csa.initSectorCourses();
this._sdfa.initStudentDataFields();
this._cria.initCriteria();
this.router.navigate(['']);
}
else if (this.authRole === MINISTRY_ROLE) {
this.router.navigate(['/ministry']);
}
this.authToken = '';
this.authRole = '';
this.showLoader$.next(false);
}).catch(err => {
this.showLoader$.next(false);
console.log(err)
});
}
}
......@@ -5,7 +5,7 @@ import { Router } from '@angular/router';
@Component({
selector: 'breadcrubs',
selector: 'breadcrumbs',
template: `
<div [hidden]="currentUrl !== '/epal-class-select'" class="col-sm-12"><p class="crumb" >Νέα Αίτηση -> Επιλογή Τάξης </p></div>
<div [hidden]="currentUrl !== '/sector-fields-select'" class="col-sm-12"><p class="crumb" >Νέα Αίτηση -> Επιλογή Τoμέα</p></div>
......@@ -21,7 +21,7 @@ import { Router } from '@angular/router';
`
})
@Injectable() export default class Breadcrubs implements OnInit {
@Injectable() export default class Breadcrumbs implements OnInit {
public currentUrl: string;
constructor(private _router:Router) {}
......
......@@ -26,7 +26,7 @@ import { API_ENDPOINT } from '../../app.settings';
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<div
......
......@@ -10,17 +10,6 @@
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNav">
<div *ngIf="(loginInfo$ | async).size > 0">
<ul class="navbar-nav">
<div *ngIf="(loginInfo$ | async).cu_name !== ''">
<b>Όνομα Χρήστη:</b> {{ cuName }}
&nbsp;&nbsp;
<button type="button" class="btn-primary btn-sm pull-right" (click)="signOut()">
<i class="fa fa-sign-out"></i>
</button>
</div>
</ul>
<ul class="navbar-nav">
<div class="row">
<div *ngIf="(loginInfo$ | async).size > 0" class="nav-item" [ngClass]="{active: path=='submited-preview'}">
......
......@@ -6,16 +6,8 @@ import { BehaviorSubject } from 'rxjs/Rx';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { ILoginInfo, ILoginInfoToken } from '../../store/logininfo/logininfo.types';
import { HelperDataService } from '../../services/helper-data-service';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import { SCHOOL_ROLE, STUDENT_ROLE, PDE_ROLE, DIDE_ROLE, MINISTRY_ROLE } from '../../constants';
import { EpalClassesActions } from '../../actions/epalclass.actions';
import { SectorFieldsActions } from '../../actions/sectorfields.actions';
import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { SectorCoursesActions } from '../../actions/sectorcourses.actions';
import { CriteriaActions } from '../../actions/criteria.actions';
import { StudentDataFieldsActions } from '../../actions/studentdatafields.actions';
@Component({
selector: 'reg-navbar',
......@@ -29,16 +21,7 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action
private loginInfo$: BehaviorSubject<ILoginInfo>;
public cuser :any;
constructor( private _ata: LoginInfoActions,
private _hds: HelperDataService,
private _csa: SectorCoursesActions,
private _sfa: SectorFieldsActions,
private _rsa: RegionSchoolsActions,
private _eca: EpalClassesActions,
private _sdfa: StudentDataFieldsActions,
private _cria: CriteriaActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router
constructor( private _ngRedux: NgRedux<IAppState>
) {
this.authToken = '';
......@@ -69,33 +52,4 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action
}
signOut() {
this._hds.signOut().then(data => {
this._ata.initLoginInfo();
if (this.authRole === SCHOOL_ROLE) {
this.router.navigate(['/school']);
}
else if (this.authRole === PDE_ROLE) {
this.router.navigate(['/school']);
}
else if (this.authRole === DIDE_ROLE) {
this.router.navigate(['/school']);
}
else if (this.authRole === STUDENT_ROLE) {
this._eca.initEpalClasses();
this._sfa.initSectorFields();
this._rsa.initRegionSchools();
this._csa.initSectorCourses();
this._sdfa.initStudentDataFields();
this._cria.initCriteria();
this.router.navigate(['']);
}
else if (this.authRole === MINISTRY_ROLE) {
this.router.navigate(['/ministry']);
}
this.authToken = '';
this.authRole = '';
});
}
}
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="(criteria$ | async).size === 0"></div>
<h4> Προσωπικά Στοιχεία Μαθητή </h4>
......
......@@ -26,7 +26,7 @@ import {AppSettings} from '../../app.settings';
selector: 'application-submit',
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="(studentDataFields$ | async).size === 0 || (criteria$ | async).size === 0 || (regions$ | async).size === 0 || (epalclasses$ | async).size === 0 || (loginInfo$ | async).size === 0"></div>
<application-preview-select></application-preview-select>
......
......@@ -19,7 +19,7 @@ import {AppSettings} from '../../app.settings';
selector: 'course-fields-select',
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<form [formGroup]="formGroup">
<div formArrayName="formArray">
......
......@@ -21,7 +21,7 @@ import {AppSettings} from '../../app.settings';
selector: 'epal-class-select',
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<h4> Επιλογή Τάξης </h4>
<form [formGroup]="formGroup">
......
......@@ -148,10 +148,15 @@ import {AppSettings} from '../../app.settings';
}
saveProfileAndContinue() {
this.showLoader.next(true);
this.hds.saveProfile(this.formGroup.value)
.then(res => {
this.showLoader.next(false);
this.router.navigate(['/epal-class-select']);})
.catch(err => {console.log(err)});
.catch(err => {
this.showLoader.next(false);
console.log(err)
});
}
enableUserEmail() {
......
......@@ -29,7 +29,7 @@ import {AppSettings} from '../../app.settings';
selector: 'region-schools-select',
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="(regions$ | async).size === 0">
......@@ -39,7 +39,7 @@ import {AppSettings} from '../../app.settings';
<h4> Επιλογή Σχολείου</h4>
<form [formGroup]="formGroup">
<div formArrayName="formArray">
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ επιλέξτε <strong>τρία </strong> ΕΠΑΛ στα οποία θα ήθελε να φοιτήσει ο μαθητής. Επιλέξτε πρώτα την Περιφερειακή Διεύθυνση που ανήκει το κάθε σχολείο της επιλογής σας, επιλέξτε τα σχολεία και στη συνέχεια επιλέξτε <i>Συνέχεια</i>.
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ επιλέξτε <strong>τρία </strong> ΕΠΑΛ στα οποία θα ήθελε να φοιτήσει ο μαθητής. Επιλέξτε πρώτα την Περιφερειακή Διεύθυνση που ανήκει το κάθε σχολείο της επιλογής σας, επιλέξτε τα σχολεία και στη συνέχεια επιλέξτε <i>Συνέχεια</i>.
Μπορείτε να επιλέξετε σχολεία που ανήκουν σε περισσότερες απο μια Περιφερειακές Διευθύνσεις. <strong> Προσοχή!</strong> Σε ειδικές περιπτώσεις σχολείων μπορείτε να επιλέξετε και λιγότερα απο τρία σχολεία</p>
<ul class="list-group main-view">
<div *ngFor="let region$ of regions$ | async; let i=index; let isOdd=odd; let isEven=even" >
......
......@@ -13,7 +13,7 @@ import {AppSettings} from '../../app.settings';
selector: 'schools-order-select',
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="(selectedSchools$ | async).length === 0 || (regions$ | async).size === 0">
</div>
......
......@@ -23,7 +23,7 @@ import {AppSettings} from '../../app.settings';
selector: 'sectorcourses-fields-select',
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<div class = "loading" *ngIf="(sectors$ | async).size === 0">
</div>
......
......@@ -14,7 +14,7 @@ import {
FormBuilder,
FormGroup,
FormControl,
FormArray
FormArray
} from '@angular/forms';
import {AppSettings} from '../../app.settings';
......@@ -22,7 +22,7 @@ import {AppSettings} from '../../app.settings';
selector: 'sector-fields-select',
template: `
<div class="row">
<breadcrubs></breadcrubs>
<breadcrumbs></breadcrumbs>
</div>
<h4> Επιλογή Τομέα </h4>
<div class = "loading" *ngIf="(sectorFields$ | async).size === 0">
......
......@@ -16,17 +16,19 @@ import * as html2canvas from "html2canvas"
@Component({
@Component({
selector: 'submited-preview',
template: `
<div class="row">
<breadcrubs></breadcrubs>
template: `
<div class="row">
<breadcrumbs></breadcrumbs>
</div>
Έχει υποβληθεί αίτηση για εγγραφή στην Επαγγελματική Εκπαίδευση των παρακάτω ατόμων:
<ul class="list-group main-view">
<div *ngFor="let UserData$ of SubmitedApplic$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" [class.oddout]="isOdd" [class.evenout]="isEven" (click)="setActiveUser(UserData$.id)" [class.selectedout]="userActive === UserData$.id" >
<li class="list-group-item isclickable" [class.oddout]="isOdd"
[class.evenout]="isEven" (click)="setActiveUser(UserData$.id)" [class.selectedout]="userActive === UserData$.id" >
<h5> {{UserData$.name}}&nbsp;{{UserData$.studentsurname}} </h5>
</li>
<div id = "target">
......@@ -35,12 +37,12 @@ import * as html2canvas from "html2canvas"
<table>
<tr><td>
<div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
<label for="guardianfirstname">Όνομα κηδεμόνα</label><p class="form-control" id="guardianfirstname" style="border:1px solid #eceeef;">{{StudentDetails$.guardianfirstname}} </p>
<label for="guardianfirstname">Όνομα κηδεμόνα</label><p class="form-control" id="guardianfirstname" style="border:1px solid #eceeef;">{{StudentDetails$.guardianfirstname}} </p>
</div>
</td>
<td>
<div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
<label for="guardiansurname">Επώνυμο κηδεμόνα</label><p class="form-control" id="guardiansurname" style="border:1px solid #eceeef;">{{StudentDetails$.guardiansurname}} </p>
<label for="guardiansurname">Επώνυμο κηδεμόνα</label><p class="form-control" id="guardiansurname" style="border:1px solid #eceeef;">{{StudentDetails$.guardiansurname}} </p>
</div>
</td></tr>
</table>
......@@ -49,8 +51,8 @@ import * as html2canvas from "html2canvas"
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.fatherfirstname}} </p></div>
<div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.fathersurname}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.motherfirstname}} </p></div>
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{StudentDetails$.birthdate}} </p></div>
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{StudentDetails$.birthdate}} </p></div>
<table>
......@@ -72,9 +74,9 @@ import * as html2canvas from "html2canvas"
</td>
</tr>
</table>
<div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{StudentDetails$.certificatetype}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{StudentDetails$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{StudentDetails$.relationtostudent}} </p></div>
<div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{StudentDetails$.certificatetype}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{StudentDetails$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{StudentDetails$.relationtostudent}} </p></div>
<h5>Κοινωνικά Κριτίρια </h5>
<div *ngFor="let critiriaChoices$ of CritirioChosen$ | async" [hidden]="UserData$.id !== userActive">
......@@ -111,13 +113,13 @@ import * as html2canvas from "html2canvas"
private EpalChosen$: BehaviorSubject<any>;
private EpalChosenSub: Subscription;
private incomeChosen$: BehaviorSubject<any>;
private incomeChosenSub: Subscription;
private CritirioChosen$: BehaviorSubject<any>;
private CritirioChosenSub: Subscription;
public StudentId;
private userActive = <number>-1;
......@@ -151,7 +153,7 @@ import * as html2canvas from "html2canvas"
this.SubmitedApplic$.unsubscribe();
}
ngOnInit() {
......@@ -163,12 +165,13 @@ import * as html2canvas from "html2canvas"
},
() => console.log("Getting Schools"));
console.log(this.SubmitedApplic$);
}
setActiveUser(ind,i)
setActiveUser(ind,i)
{
ind = +ind;
console.log(this.userActive,"RA",ind);
......@@ -215,7 +218,7 @@ import * as html2canvas from "html2canvas"
{
var img = canvas.toDataURL();
var doc = new jsPDF();
doc.onload = function(){
console.log(img, doc, "lalalalalala");
doc.addImage(img, 'PNG',0, 0, 210, 297);
......@@ -242,8 +245,5 @@ createPdf()
// Save the PDF
doc.save('Test.pdf');
}
}
......@@ -305,3 +305,9 @@ overflow-x: scroll;
.btn.sharp {
border-radius:0;
}
.username {
font-size: 0.8em;
}
.signout {
font-size: 0.8em;
}
......@@ -33,13 +33,13 @@ 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 Breadcrubs from '../components/main/breadcrubs';
import Breadcrumbs from '../components/main/breadcrumbs';
export const MainRoutes: Routes = [
{ path: '', component: Home },
{ path: 'school', component: SchoolHome },
{ path: 'ministry', component: MinistryHome },
{ path: 'breadcrubs', component: Breadcrubs },
{ 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 },
......@@ -91,6 +91,6 @@ export const MainDeclarations = [
ReportGeneral,
InformStudents,
PerfectureView,
Breadcrubs,
Breadcrumbs,
DirectorButtons
];
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