diff --git a/source/components/minister/minister-reports.ts b/source/components/minister/minister-reports.ts index 73ebf55eb7f028263a0e6833288fbfdd90585cfb..9b8b8d08394e96cc1c23206a415fcc0b46ee58e2 100644 --- a/source/components/minister/minister-reports.ts +++ b/source/components/minister/minister-reports.ts @@ -10,6 +10,7 @@ import { Router, ActivatedRoute, Params} from '@angular/router'; import { BehaviorSubject, Subscription } from 'rxjs/Rx'; import { ILoginInfo } from '../../store/logininfo/logininfo.types'; import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state'; +import { PDE_ROLE, DIDE_ROLE } from '../../constants'; import { FormBuilder, @@ -38,7 +39,7 @@ import { API_ENDPOINT } from '../../app.settings'; <br><br> <button type="button" class="btn btn-alert" (click)="nav_to_reportpath(2)" [hidden]="minedu_userName == ''" > <i class="fa fa-file-text"></i> - Ξ£Ο Ξ½ΞΏΞ»ΞΉΞΊΞ� ΠληΟΟΟΞ·ΟΞ± ΟΟολικΟΞ½ μονάδΟΞ½ ΞΞ ΞΞ Ξ±Ξ½Ξ¬ Οάξη + Ξ£Ο Ξ½ΞΏΞ»ΞΉΞΊΞ� ΠληΟΟΟΞ·ΟΞ± ΟΟολικΟΞ½ μονάδΟΞ½ ΞΞ ΞΞ Ξ±Ξ½Ξ¬ Οάξη </button> <br><br> <button type="button" class="btn btn-alert" (click)="nav_to_reportpath(3)" [hidden]="minedu_userName == ''" > @@ -87,7 +88,14 @@ import { API_ENDPOINT } from '../../app.settings'; state.loginInfo.reduce(({}, loginInfoToken) => { this.minedu_userName = loginInfoToken.minedu_username; this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; + console.log("Role:"); + console.log(loginInfoToken.auth_role); + if (loginInfoToken.auth_role == PDE_ROLE || loginInfoToken.auth_role == DIDE_ROLE) { + console.log("inside.."); + this.minedu_userName = loginInfoToken.auth_token; + this.minedu_userPassword = loginInfoToken.auth_token; + } + return loginInfoToken; }, {}); } return state.loginInfo; diff --git a/source/components/minister/report-all-stat.ts b/source/components/minister/report-all-stat.ts index 76eb06003eea713cf8796ca9d4b470ac1e34811c..2f2bba909de535b1f222e451eb8c40a1b85ffacd 100644 --- a/source/components/minister/report-all-stat.ts +++ b/source/components/minister/report-all-stat.ts @@ -12,6 +12,7 @@ import { ILoginInfo } from '../../store/logininfo/logininfo.types'; import { Ng2SmartTableModule, LocalDataSource } from 'ng2-smart-table'; import {reportsSchema, TableColumn} from './reports-schema'; import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state'; +import { PDE_ROLE, DIDE_ROLE } from '../../constants'; import {csvCreator} from './csv-creator'; import { @@ -31,11 +32,10 @@ import { API_ENDPOINT } from '../../app.settings'; <div> - <!-- + <div class = "loading" *ngIf="validCreator == 0" > </div> - --> <form [formGroup]="formGroup" #form> @@ -45,8 +45,8 @@ import { API_ENDPOINT } from '../../app.settings'; > ΦίλΟΟΞΏ ΞΟιλογΞ�Ο Ξ Ξ΅ΟΞΉΟ/ΞΊΞ�Ο Ξ/Ξ½ΟΞ·Ο - Ξ/Ξ½ΟΞ·Ο ΞΞΊΟ/ΟΞ·Ο - Ξ£ΟΞΏΞ»Ξ΅Ξ―ΞΏΟ </button> <div class="col-md-11 offset-md-1"> - <label *ngIf = "enableRegionFilter"> Ξ Ξ΅ΟΞΉΟΞ΅ΟΡιακΞ� ΞΞΉΞ΅ΟΞΈΟ Ξ½ΟΞ· </label> - <select #regsel class="form-control" (change)="checkregion(regsel)" *ngIf = "enableRegionFilter" formControlName="region"> + <label *ngIf = "enableRegionFilter && userLoggedIn == 'supervisor'"> Ξ Ξ΅ΟΞΉΟΞ΅ΟΡιακΞ� ΞΞΉΞ΅ΟΞΈΟ Ξ½ΟΞ· </label> + <select #regsel class="form-control" (change)="checkregion(regsel)" *ngIf = "enableRegionFilter" [value] = "regionSelected" [hidden] = "userLoggedIn != 'supervisor'" formControlName="region"> <option value="0"></option> <option *ngFor="let RegionSelection$ of RegionSelections$ | async; let i=index" [value] = "RegionSelection$.id"> {{RegionSelection$.name}} </option> </select> @@ -158,6 +158,7 @@ import { API_ENDPOINT } from '../../app.settings'; private courseSelected: number; private enableRegionFilter: boolean; private enableCourseFilter: boolean; + private userLoggedIn: string; columnMap: Map<string,TableColumn> = new Map<string,TableColumn>(); @Input() settings: any; @@ -214,7 +215,28 @@ import { API_ENDPOINT } from '../../app.settings'; state.loginInfo.reduce(({}, loginInfoToken) => { this.minedu_userName = loginInfoToken.minedu_username; this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; + + this.userLoggedIn = loginInfoToken.auth_role; + if (loginInfoToken.auth_role == PDE_ROLE || loginInfoToken.auth_role == DIDE_ROLE) { + console.log("inside.."); + this.minedu_userName = loginInfoToken.auth_token; + this.minedu_userPassword = loginInfoToken.auth_token; + /* + if (loginInfoToken.auth_role == PDE_ROLE) + this.userLoggedIn = "pde"; + else if (loginInfoToken.auth_role == DIDE_ROLE) + this.userLoggedIn = "dide"; + console.log(this.userLoggedIn); + */ + + if (loginInfoToken.auth_role == PDE_ROLE) { + //CALL CONTROLLER THAT RETURNS ID OF PDE + this. regionSelected = 1; + this.showAdminList.next(true); + this.checkregion(this. regionSelected); + } + } + return loginInfoToken; }, {}); } return state.loginInfo; @@ -346,13 +368,14 @@ toggleCourseFilter() { checkregion(regionId) { - this.regionSelected = regionId.value; + if (typeof regionId.value != "undefined") + this.regionSelected = regionId.value; this.adminAreaSelected = 0; this.schSelected = 0; //if (regionId.value != 0) { - this.AdminAreaSelectionsSub = this._hds.getAdminAreas(this.minedu_userName, this.minedu_userPassword, regionId.value).subscribe(data => { + this.AdminAreaSelectionsSub = this._hds.getAdminAreas(this.minedu_userName, this.minedu_userPassword, this.regionSelected).subscribe(data => { this.AdminAreaSelections$.next(data); }, error => { @@ -365,7 +388,7 @@ checkregion(regionId) { } ); - this.SchoolSelectionsSub = this._hds.getSchoolsPerRegion(this.minedu_userName, this.minedu_userPassword, regionId.value).subscribe(data => { + this.SchoolSelectionsSub = this._hds.getSchoolsPerRegion(this.minedu_userName, this.minedu_userPassword, this.regionSelected).subscribe(data => { this.SchoolSelections$.next(data); }, error => { diff --git a/source/components/navbar/navbar.component.html b/source/components/navbar/navbar.component.html index c2a3f18b23d79a85176589ebc1e137bbf6c6d41b..17d43c3ecb6cbff68b5f72c4233b4e1234d15f35 100644 --- a/source/components/navbar/navbar.component.html +++ b/source/components/navbar/navbar.component.html @@ -44,13 +44,12 @@ </li> </div> - <!-- <div *ngIf="(loginInfo$ | async).size > 0" class="nav-item" > <li *ngIf="authRole=='pde'" class="nav-item" > - <a class="nav-link" [routerLink]="['/school/perfecture-view']" [routerLinkActive]="['active']"><b>ΞΞ½Ξ±ΟΞΏΟΞΟ</b></a> + <a class="nav-link" [routerLink]="['/ministry/minister-reports']" [routerLinkActive]="['active']"><b>ΞΞ½Ξ±ΟΞΏΟΞΟ</b></a> </li> </div> - --> + </div> </ul> diff --git a/source/components/student-application-form/application.submit.ts b/source/components/student-application-form/application.submit.ts index 5ba35e72fe1c9abcea3949cd2420917b0df7c2a6..81a0fa41a7c478ea4f53a8b2908cb9110ddc5c71 100644 --- a/source/components/student-application-form/application.submit.ts +++ b/source/components/student-application-form/application.submit.ts @@ -197,10 +197,15 @@ import {AppSettings} from '../../app.settings'; criteriaObj[i] =new StudentCriteriaChosen(null, null, this.studentCriteria[i]); aitisiObj['2'] = criteriaObj; - if (aitisiObj[0]['currentclass'] === "Ξ' ΞΟ ΞΊΞ΅Ξ―ΞΏΟ " ) + console.log("Debugging.."); + console.log(aitisiObj[0]['currentclass']); + //if (aitisiObj[0]['currentclass'] === "Ξ' ΞΟ ΞΊΞ΅Ξ―ΞΏΟ " ) + if (aitisiObj[0]['currentclass'] === "2" ) aitisiObj['3'] = new StudentSectorChosen(null, this.sectorSelected); - else if (aitisiObj[0]['currentclass'] === "Ξ' ΞΟ ΞΊΞ΅Ξ―ΞΏΟ " ) + //else if (aitisiObj[0]['currentclass'] === "Ξ' ΞΟ ΞΊΞ΅Ξ―ΞΏΟ " ) + else if (aitisiObj[0]['currentclass'] === "3" ) { aitisiObj['3'] = new StudentCourseChosen(null, this.courseSelected); + } //console.log(aitisiObj); diff --git a/source/services/helper-data-service.ts b/source/services/helper-data-service.ts index 8d744dfa2cf406286dc78666e299af223cf19d68..da8757b513468982206b1db78653b9032458d6e0 100644 --- a/source/services/helper-data-service.ts +++ b/source/services/helper-data-service.ts @@ -44,6 +44,9 @@ export class HelperDataService implements OnInit, OnDestroy { this.authRole = loginInfoToken.auth_role; //this.minedu_userName = loginInfoToken.minedu_username; //this.minedu_userPassword = loginInfoToken.minedu_userpassword; + console.log("Auth details.."); + console.log(this.authToken); + console.log(this.authRole); return loginInfoToken; }, {}); } @@ -888,7 +891,7 @@ getCourses(username, userpassword, sectorid) { getCapacityPerSchool(taxi, tomeas, specialit, schoolid) { - + this.loginInfo$.getValue().forEach(loginInfoToken => { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role;