Merge branch 'front_end_review' into 'develop'

bug fixes, added modal to application.submit

See merge request !87
parents 83569662 dfd635fe
...@@ -70,12 +70,6 @@ epal.application_submit: ...@@ -70,12 +70,6 @@ epal.application_submit:
_controller: '\Drupal\epal\Controller\ApplicationSubmit::appSubmit' _controller: '\Drupal\epal\Controller\ApplicationSubmit::appSubmit'
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
epal.demo_data:
path: '/epal/demodata'
defaults:
_controller: '\Drupal\epal\Controller\CreateDemoData::createData'
requirements:
_access: 'TRUE'
epal.allocation: epal.allocation:
path: '/epal/distribution' path: '/epal/distribution'
options: options:
......
...@@ -87,5 +87,5 @@ class MyLocalization extends NgLocalization { ...@@ -87,5 +87,5 @@ class MyLocalization extends NgLocalization {
}) })
class AppModule {} class AppModule {}
// enableProdMode(); enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule); platformBrowserDynamic().bootstrapModule(AppModule);
This diff is collapsed.
import {Router, ActivatedRoute, Params} from '@angular/router'; import {Router} from '@angular/router';
import {OnInit, Component} from '@angular/core'; import {OnInit, Component, Injectable} from '@angular/core';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { NgRedux, select } from 'ng2-redux';
import { Observable } from 'rxjs/Rx';
import { IAppState } from '../../store/store';
import { HelperDataService } from '../../services/helper-data-service';
import { CookieService } from 'ngx-cookie';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray
} from '@angular/forms';
import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../../app.settings';
@Component({ @Component({
selector: 'director-buttons', selector: 'director-buttons',
template: ` template: `
<div> <div class="row" style="margin-top: 130px; margin-bottom: 200px;">
<form> <div class="col-md-3 offset-md-3">
<div class="col-md-8 offset-md-4"> <button type="submit" class="btn-primary btn-lg btn-block isclickable" style="margin: 0px; font-size: 1em; padding: 5px;" (click)="navigatedirector()">
<button type="submit" class="btn-primary btn-lg" (click)="navigatedirector()"> Αιτηθέντες<br />Μαθητές
Επιλεχθέντες Μαθητές<span class="glyphicon glyphicon-menu-right"></span>
</button> </button>
<br> </div>
<br> <div class="col-md-6">
<button type="submit" class="btn-primary btn-lg" (click)="navigatecapacity()"> <button type="submit" class="btn-primary btn-lg btn-block isclickable" style="margin: 0px; font-size: 1em; padding: 5px;" (click)="navigatecapacity()">
Δυναμική Τμημάτων<span class="glyphicon glyphicon-menu-right"></span> Δυναμική<br />Τμημάτων
</button> </button>
</div> </div>
<br> </div>
<br>
<br>
<br>
<br>
</form>
</div>
` `
}) })
export default class DirectorButtom implements OnInit { @Injectable() export default class DirectorButtons implements OnInit {
constructor( constructor(
private router: Router, private router: Router,
...@@ -54,7 +31,6 @@ export default class DirectorButtom implements OnInit { ...@@ -54,7 +31,6 @@ export default class DirectorButtom implements OnInit {
} }
navigatedirector(){ navigatedirector(){
this.router.navigate(['/school/director-view']); this.router.navigate(['/school/director-view']);
...@@ -64,6 +40,4 @@ export default class DirectorButtom implements OnInit { ...@@ -64,6 +40,4 @@ export default class DirectorButtom implements OnInit {
this.router.navigate(['/school/director-classcapacity']); this.router.navigate(['/school/director-classcapacity']);
} }
} }
import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core"; import { Component, OnInit, OnDestroy, ElementRef, ViewChild, Injectable} from "@angular/core";
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings'; import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service'; import { HelperDataService } from '../../services/helper-data-service';
import {Observable} from "rxjs/Observable"; import {Observable} from "rxjs/Observable";
...@@ -20,28 +19,28 @@ import { ...@@ -20,28 +19,28 @@ import {
@Component({ @Component({
selector: 'perfecture-view', selector: 'perfecture-view',
template: ` template: `
<h3> Αριθμός Μαθητών ανα τμήμα σχολείου </h3> <h3> Αριθμός Μαθητών ανα τμήμα σχολείου </h3>
<ul class="list-group main-view"> <ul class="list-group main-view">
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" > <div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)" [class.changelistcolor]= "SchoolNames$.status === true" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" > <li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)" [class.changelistcolor]= "SchoolNames$.status === true" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<h5> {{SchoolNames$.name}}</h5> <h5> {{SchoolNames$.name}}</h5>
</li> </li>
<div *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)" [hidden]="SchoolNames$.id !== regionActive" > <div *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)" [hidden]="SchoolNames$.id !== regionActive" >
<div> {{CoursesNames$.name}}</div> <div class= "aastyle"><strong>Αριθμός Μαθητών:</strong>{{CoursesNames$.size}} </div> <div> {{CoursesNames$.name}}</div> <div class= "aastyle"><strong>Αριθμός Μαθητών:</strong>{{CoursesNames$.size}} </div>
</div> </div>
</div> </div>
</ul> </ul>
<div class="col-md-6"> <div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" > <button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" >
<i class="fa fa-forward"></i> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
` `
}) })
...@@ -58,7 +57,7 @@ import { ...@@ -58,7 +57,7 @@ import {
private StudentsSizeSub: Subscription; private StudentsSizeSub: Subscription;
public perfecture = 1; public perfecture = 1;
private regionActive = <number>-1; private regionActive = <number>-1;
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
private router: Router, private router: Router,
...@@ -94,10 +93,10 @@ import { ...@@ -94,10 +93,10 @@ import {
setActiveRegion(ind) { setActiveRegion(ind) {
if (ind === this.regionActive) if (ind === this.regionActive)
ind = -1; ind = -1;
this.regionActive = ind; this.regionActive = ind;
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => { this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data); this.CoursesPerPerf$.next(data);
...@@ -115,9 +114,9 @@ import { ...@@ -115,9 +114,9 @@ import {
navigateToApplication() navigateToApplication()
{ {
var id: string= String(this.regionActive); var id: string= String(this.regionActive);
this.router.navigate(['', {ids:id}]); this.router.navigate(['', {ids:id}]);
} }
......
import {Router, ActivatedRoute, Params} from '@angular/router'; import {Router, ActivatedRoute, Params} from '@angular/router';
import {OnInit, Component} from '@angular/core'; import {OnInit, OnDestroy, Component} from '@angular/core';
import { LoginInfoActions } from '../actions/logininfo.actions'; import { LoginInfoActions } from '../actions/logininfo.actions';
import { ILoginInfo } from '../store/logininfo/logininfo.types'; import { ILoginInfo } from '../store/logininfo/logininfo.types';
import { LOGININFO_INITIAL_STATE } from '../store/logininfo/logininfo.initial-state';
import { NgRedux, select } from 'ng2-redux'; import { NgRedux, select } from 'ng2-redux';
import { Observable } from 'rxjs/Rx'; import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import { IAppState } from '../store/store'; import { IAppState } from '../store/store';
import { HelperDataService } from '../services/helper-data-service'; import { HelperDataService } from '../services/helper-data-service';
import { CookieService } from 'ngx-cookie'; import { CookieService } from 'ngx-cookie';
...@@ -36,13 +37,14 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings'; ...@@ -36,13 +37,14 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings';
` `
}) })
export default class SchoolHome implements OnInit { export default class SchoolHome implements OnInit, OnDestroy {
public formGroup: FormGroup; public formGroup: FormGroup;
private authToken: string; private authToken: string;
private authRole: string; private authRole: string;
private name: any; private name: any;
private xcsrftoken: any; private xcsrftoken: any;
private loginInfo$: Observable<ILoginInfo>; private loginInfo$: BehaviorSubject<ILoginInfo>;
private loginInfoSub: Subscription;
private apiEndPoint = API_ENDPOINT; private apiEndPoint = API_ENDPOINT;
private apiEndPointParams = API_ENDPOINT_PARAMS; private apiEndPointParams = API_ENDPOINT_PARAMS;
...@@ -57,10 +59,17 @@ export default class SchoolHome implements OnInit { ...@@ -57,10 +59,17 @@ export default class SchoolHome implements OnInit {
this.authToken = ''; this.authToken = '';
this.authRole = ''; this.authRole = '';
this.name = ''; this.name = '';
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
}); });
}; };
ngOnDestroy() {
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
this.loginInfo$.unsubscribe();
};
ngOnInit() { ngOnInit() {
/* this.authToken = this.getCookie('auth_token'); /* this.authToken = this.getCookie('auth_token');
this.authRole = this.getCookie('auth_role'); this.authRole = this.getCookie('auth_role');
...@@ -70,23 +79,24 @@ export default class SchoolHome implements OnInit { ...@@ -70,23 +79,24 @@ export default class SchoolHome implements OnInit {
this.removeCookie('auth_role'); this.removeCookie('auth_role');
} */ } */
this.loginInfo$ = this._ngRedux.select(state => { this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) { if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => { state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token; this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role; this.authRole = loginInfoToken.auth_role;
if (this.authToken && this.authToken.length > 0) if (this.authToken && this.authToken.length > 0) {
if (this.authRole = 'director') if (this.authRole === 'director') {
console.log("ok");
this.router.navigate(['/school/director-buttons']); this.router.navigate(['/school/director-buttons']);
if (this.authRole = 'pde') }
this.router.navigate(['/school/perfecture-view']); else if (this.authRole === 'pde')
this.router.navigate(['/school/perfecture-view']);
}
return loginInfoToken; return loginInfoToken;
}, {}); }, {});
} }
return state.loginInfo; return state.loginInfo;
}); }).subscribe(this.loginInfo$);
// subscribe to router event // subscribe to router event
......
...@@ -25,10 +25,29 @@ import {AppSettings} from '../../app.settings'; ...@@ -25,10 +25,29 @@ import {AppSettings} from '../../app.settings';
@Component({ @Component({
selector: 'application-submit', selector: 'application-submit',
template: ` template: `
<div class = "loading" *ngIf="(studentDataFields$ | async).size === 0 || (criteria$ | async).size === 0 || (regions$ | async).size === 0 || (epalclasses$ | async).size === 0 || (loginInfo$ | async).size === 0 || (showLoader | async) === true"></div>
<div id="studentFormSentNotice" (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 modal-header-success">
<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="row"> <div class="row">
<breadcrumbs></breadcrumbs> <breadcrumbs></breadcrumbs>
</div> </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> <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-center" (click)="submitNow()">Υποβολή</button> <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-center" (click)="submitNow()">Υποβολή</button>
` `
...@@ -59,6 +78,10 @@ import {AppSettings} from '../../app.settings'; ...@@ -59,6 +78,10 @@ import {AppSettings} from '../../app.settings';
private sectorFieldsSub: Subscription; private sectorFieldsSub: Subscription;
private epalclassesSub: Subscription; private epalclassesSub: Subscription;
private loginInfoSub: Subscription; private loginInfoSub: Subscription;
private modalTitle: BehaviorSubject<string>;
private modalText: BehaviorSubject<string>;
public isModalShown: BehaviorSubject<boolean>;
private showLoader: BehaviorSubject<boolean>;
constructor(private _ngRedux: NgRedux<IAppState>, constructor(private _ngRedux: NgRedux<IAppState>,
private router: Router, private router: Router,
...@@ -72,9 +95,15 @@ import {AppSettings} from '../../app.settings'; ...@@ -72,9 +95,15 @@ import {AppSettings} from '../../app.settings';
this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE); this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE);
this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE); this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE);
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
this.modalTitle = new BehaviorSubject("");
this.modalText = new BehaviorSubject("");
this.isModalShown = new BehaviorSubject(false);
this.showLoader = new BehaviorSubject(false);
}; };
ngOnInit() { ngOnInit() {
(<any>$('#studentFormSentNotice')).appendTo("body");
this.loginInfoSub = this._ngRedux.select(state => { this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) { if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => { state.loginInfo.reduce(({}, loginInfoToken) => {
...@@ -161,6 +190,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -161,6 +190,7 @@ import {AppSettings} from '../../app.settings';
}; };
ngOnDestroy() { ngOnDestroy() {
(<any>$('#studentFormSentNotice')).remove();
if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe(); if (this.studentDataFieldsSub) this.studentDataFieldsSub.unsubscribe();
if (this.criteriaSub) this.criteriaSub.unsubscribe(); if (this.criteriaSub) this.criteriaSub.unsubscribe();
if (this.regionsSub) this.regionsSub.unsubscribe(); if (this.regionsSub) this.regionsSub.unsubscribe();
...@@ -197,8 +227,6 @@ import {AppSettings} from '../../app.settings'; ...@@ -197,8 +227,6 @@ import {AppSettings} from '../../app.settings';
criteriaObj[i] =new StudentCriteriaChosen(null, null, this.studentCriteria[i]); criteriaObj[i] =new StudentCriteriaChosen(null, null, this.studentCriteria[i]);
aitisiObj['2'] = criteriaObj; aitisiObj['2'] = criteriaObj;
console.log("Debugging..");
console.log(aitisiObj[0]['currentclass']);
//if (aitisiObj[0]['currentclass'] === "Β' Λυκείου" ) //if (aitisiObj[0]['currentclass'] === "Β' Λυκείου" )
if (aitisiObj[0]['currentclass'] === "2" ) if (aitisiObj[0]['currentclass'] === "2" )
aitisiObj['3'] = new StudentSectorChosen(null, this.sectorSelected); aitisiObj['3'] = new StudentSectorChosen(null, this.sectorSelected);
...@@ -207,36 +235,12 @@ import {AppSettings} from '../../app.settings'; ...@@ -207,36 +235,12 @@ import {AppSettings} from '../../app.settings';
aitisiObj['3'] = new StudentCourseChosen(null, this.courseSelected); aitisiObj['3'] = new StudentCourseChosen(null, this.courseSelected);
} }
//console.log(aitisiObj);
this.submitRecord(aitisiObj); this.submitRecord(aitisiObj);
} }
submitRecord_ver1(entityName, record) {
let headers = new Headers({
"Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
"Accept": "*/*",
"Access-Control-Allow-Credentials": "true",
"Content-Type": "application/json",
// "Content-Type": "text/plain", // try to skip preflight
"X-CSRF-Token": "Me9oRh6jrAOAJ2rsnu_3lOLxqA_WMoJLeJ7dhe4HTBA"
});
let options = new RequestOptions({ headers: headers, withCredentials: true });
let connectionString = `${AppSettings.API_ENDPOINT}/entity/` + entityName;
//this.http.post(`${AppSettings.API_ENDPOINT}/entity/epal_student`, this.student, options)
this.http.post(connectionString, record, options)
// Call map on the response observable to get the parsed people object
.map((res: Response) => res.json())
.subscribe(success => {alert("Επιτυχής αποστολή στοιχείων στο entity: " + entityName); console.log("success post")}, // put the data returned from the server in our variable
error => {alert("Αποτυχία αποστολής στοιχείων στο entity: " + entityName); console.log("Error HTTP POST Service")}, // in case of failure show this message
() => console.log("write this message anyway"));//run this code in all cases);
}
submitRecord(record) { submitRecord(record) {
let auth_str = this.authToken + ":" + this.authToken; let auth_str = this.authToken + ":" + this.authToken;
//let authTokenPost = "nkatsaounos" + ":" + "...";
let authTokenPost = this.authToken + ":" + this.authToken; let authTokenPost = this.authToken + ":" + this.authToken;
let headers = new Headers({ let headers = new Headers({
...@@ -244,43 +248,43 @@ import {AppSettings} from '../../app.settings'; ...@@ -244,43 +248,43 @@ import {AppSettings} from '../../app.settings';
"Accept": "*/*", "Accept": "*/*",
"Access-Control-Allow-Credentials": "true", "Access-Control-Allow-Credentials": "true",
"Content-Type": "application/json", "Content-Type": "application/json",
// "X-CSRF-Token": "Pz3psGTGpc-EGNLm3tgzCpqEMg3HW0fCKf8xOnQLAsc"
}); });
//let headers = new Headers({
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
// "Accept": "*/*",
// "Access-Control-Allow-Credentials": "true",
// "Content-Type": "application/json",
// "X-CSRF-Token": "Pz3psGTGpc-EGNLm3tgzCpqEMg3HW0fCKf8xOnQLAsc"
//});
let options = new RequestOptions({ headers: headers, method: "post", withCredentials: true }); let options = new RequestOptions({ headers: headers, method: "post", withCredentials: true });
let connectionString = `${AppSettings.API_ENDPOINT}/epal/appsubmit`; let connectionString = `${AppSettings.API_ENDPOINT}/epal/appsubmit`;
this.showLoader.next(true);
this.http.post(connectionString, record, options) this.http.post(connectionString, record, options)
// Call map on the response observable to get the parsed people object
.map((res: Response) => res.json()) .map((res: Response) => res.json())
.subscribe( .subscribe(
success => {alert("Επιτυχές post στο route υποβολής " ); console.log("success post"); }, // put the data returned from the server in our variable success => {
error => {alert("Αποτυχές post στο route υποβολής " ); console.log("Error HTTP POST Service")}, // in case of failure show this message this.modalTitle.next("Υποβολή Αίτησης Εγγραφής");
() => console.log("write this message anyway"), this.modalText.next("Η υποβολή της αίτησής σας πραγματοποιήθηκε. Μπορείτε να την εκτυπώσετε από την επιλογή 'Εξαγωγή σε PDF'. Θα ειδοποιηθείτε στο e-mail που δηλώσατε για την εξέλιξη της αίτησής σας");
this.showModal();
);//run this code in all cases); console.log("success post"); },
error => {
this.modalTitle.next("Υποβολή Αίτησης Εγγραφής");
this.modalText.next("Η υποβολή της αίτησής σας απέτυχε. Παρακαλούμε προσπαθήστε πάλι και αν το πρόβλημα συνεχίσει να υφίσταται, επικοινωνήστε με την ομάδα υποστήριξης");
this.showModal();
console.log("Error HTTP POST Service")},
() => {
console.log("write this message anyway");
this.showLoader.next(false);
},
);
//}); }
public showModal():void {
(<any>$('#studentFormSentNotice')).modal('show');
} }
} public hideModal():void {
(<any>$('#studentFormSentNotice')).modal('hide');
}
public onHidden():void {
this.isModalShown.next(false);
}
//Get Data - sync methods }
/*
const { studentDataFields } = this._ngRedux.getState();
const { epalclasses } = this._ngRedux.getState();
const { regions } = this._ngRedux.getState();
const { amkafills } = this._ngRedux.getState();
const { sectors } = this._ngRedux.getState();
*/
<div class = "loading" *ngIf="(epalUserData$ | async).userEmail === '' || (showLoader | async) === true"></div> <div class = "loading" *ngIf="(epalUserData$ | async).userEmail === '' || (showLoader | async) === true"></div>
<div id="emaiSentNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"> <div id="emailSentNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header modal-header-success"> <div class="modal-header modal-header-success">
......
...@@ -58,11 +58,11 @@ import {AppSettings} from '../../app.settings'; ...@@ -58,11 +58,11 @@ import {AppSettings} from '../../app.settings';
public showModal():void { public showModal():void {
console.log("about to show modal"); console.log("about to show modal");
(<any>$('#emaiSentNotice')).modal('show'); (<any>$('#emailSentNotice')).modal('show');
} }
public hideModal():void { public hideModal():void {
(<any>$('#emaiSentNotice')).modal('hide'); (<any>$('#emailSentNotice')).modal('hide');
} }
public onHidden():void { public onHidden():void {
...@@ -70,7 +70,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -70,7 +70,7 @@ import {AppSettings} from '../../app.settings';
} }
ngOnInit() { ngOnInit() {
(<any>$('#emaiSentNotice')).appendTo("body"); (<any>$('#emailSentNotice')).appendTo("body");
this.epalUserDataSub = this.hds.getEpalUserData().subscribe(x => { this.epalUserDataSub = this.hds.getEpalUserData().subscribe(x => {
this.epalUserData$.next(x); this.epalUserData$.next(x);
...@@ -106,7 +106,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -106,7 +106,7 @@ import {AppSettings} from '../../app.settings';
} }
ngOnDestroy() { ngOnDestroy() {
(<any>$('#emaiSentNotice')).remove(); (<any>$('#emailSentNotice')).remove();
if (this.epalUserDataSub) this.epalUserDataSub.unsubscribe(); if (this.epalUserDataSub) this.epalUserDataSub.unsubscribe();
if (this.userEmailSub) this.epalUserDataSub.unsubscribe(); if (this.userEmailSub) this.epalUserDataSub.unsubscribe();
this.epalUserData$.unsubscribe(); this.epalUserData$.unsubscribe();
......
...@@ -53,7 +53,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -53,7 +53,7 @@ import {AppSettings} from '../../app.settings';
<div class="col-md-2 col-md-offset-1"> <div class="col-md-2 col-md-offset-1">
<input #cb type="checkbox" formControlName="{{ epal$.globalIndex }}" <input #cb type="checkbox" formControlName="{{ epal$.globalIndex }}"
(change)="saveSelected(cb.checked,i,j)" (change)="saveSelected(cb.checked,i,j)"
[hidden] = "numSelected === 3 && cb.checked === false" [hidden] = "(numSelected | async) === 3 && cb.checked === false"
> >
</div> </div>
<div class="col-md-8 col-md-offset-1 isclickable"> <div class="col-md-8 col-md-offset-1 isclickable">
...@@ -73,7 +73,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -73,7 +73,7 @@ import {AppSettings} from '../../app.settings';
</button> </button>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" [disabled] = "selectionLimitOptional === false && numSelected < selectionLimit " > <button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" [disabled] = "(selectionLimitOptional | async) === false && (numSelected | async) < (selectionLimit | async)" >
<i class="fa fa-forward"></i> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
...@@ -97,10 +97,12 @@ import {AppSettings} from '../../app.settings'; ...@@ -97,10 +97,12 @@ import {AppSettings} from '../../app.settings';
private regionActive = <number>-1; private regionActive = <number>-1;
private regionActiveId = <number>-1; private regionActiveId = <number>-1;
private courseActive = <number>-1; private courseActive = <number>-1;
private numSelected = <number>0; private numSelected: BehaviorSubject<number>;
private selectionLimit = <number>3; private selectionLimit: BehaviorSubject<number>;
private selectionLimitOptional: BehaviorSubject<boolean>;
// private selectionLimit = <number>3;
private regionSizeLimit = <number>3; private regionSizeLimit = <number>3;
private selectionLimitOptional = <boolean>false; // private selectionLimitOptional = <boolean>false;
//private schoolArray: Array<boolean> = new Array(); //private schoolArray: Array<boolean> = new Array();
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
...@@ -119,6 +121,10 @@ import {AppSettings} from '../../app.settings'; ...@@ -119,6 +121,10 @@ import {AppSettings} from '../../app.settings';