diff --git a/source/actions/coursefields.actions.ts b/source/actions/coursefields.actions.ts deleted file mode 100644 index 6dfd2e54c498677cb0aba66a73e0c30a29608504..0000000000000000000000000000000000000000 --- a/source/actions/coursefields.actions.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { COURSEFIELDS_RECEIVED, COURSEFIELDS_SELECTED_SAVE } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; -import { HelperDataService } from '../services/helper-data-service'; - -@Injectable() -export class CourseFieldsActions { - constructor( - private _ngRedux: NgRedux, - private _hds: HelperDataService) {} - - getCourseFields = () => { - const { courseFields } = this._ngRedux.getState(); - if (courseFields.size === 0) { - return this._hds.getCourseFields().then(courseFields => { - return this._ngRedux.dispatch({ - type: COURSEFIELDS_RECEIVED, - payload: { - courseFields - } - }); - }); - } - }; - - saveCourseFieldsSelected = (courseFieldsSelected) => { - return this._ngRedux.dispatch({ - type: COURSEFIELDS_SELECTED_SAVE, - payload: { - courseFieldsSelected - } - }); - }; - -} diff --git a/source/actions/criteria.actions.ts b/source/actions/criteria.actions.ts deleted file mode 100644 index 06250b806fd9b32ba9e1d3c0779597bfb6d2e434..0000000000000000000000000000000000000000 --- a/source/actions/criteria.actions.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { CRITERIA_RECEIVED, CRITERIA_SAVE, CRITERIA_INIT } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; -import { HelperDataService } from '../services/helper-data-service'; - -@Injectable() -export class CriteriaActions { - constructor( - private _ngRedux: NgRedux, - private _hds: HelperDataService) {} - - getCriteria = (reload) => { - const { criter } = this._ngRedux.getState(); - //if (sectorFields.size === 0) { - if (reload === true || (reload === false && criter.size === 0)) { - return this._hds.getCriteria().then(criteria => { - return this._ngRedux.dispatch({ - type: CRITERIA_RECEIVED, - payload: { - criteria - } - }); - }); - } - }; - - saveCriteria = (criter) => { - return this._ngRedux.dispatch({ - type: CRITERIA_SAVE, - payload: { - criter - } - }); - }; - - initCriteria = () => { - return this._ngRedux.dispatch({ - type: CRITERIA_INIT, - payload: { - } - }); - }; - -} diff --git a/source/actions/epalclass.actions.ts b/source/actions/epalclass.actions.ts index 7f462347874fefaaa11c89ba9ad5e42d7dee952c..2e504cbae20eba911858d9ecf8f1d8e0680c13ed 100644 --- a/source/actions/epalclass.actions.ts +++ b/source/actions/epalclass.actions.ts @@ -1,31 +1,31 @@ -import { EPALCLASSES_SAVE } from '../constants'; -import { EPALCLASSES_INIT } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; +import { EPALCLASSES_SAVE } from "../constants"; +import { EPALCLASSES_INIT } from "../constants"; +import { Injectable } from "@angular/core"; +import { NgRedux } from "@angular-redux/store"; +import { IAppState } from "../store"; @Injectable() export class EpalClassesActions { - constructor( - private _ngRedux: NgRedux) {} + constructor( + private _ngRedux: NgRedux) { } - saveEpalClassesSelected = (epalClasses) => { - return this._ngRedux.dispatch({ - type: EPALCLASSES_SAVE, - payload: { - epalClasses - } - }); - }; + saveEpalClassesSelected = (epalClasses) => { + return this._ngRedux.dispatch({ + type: EPALCLASSES_SAVE, + payload: { + epalClasses + } + }); + }; - initEpalClasses = () => { - return this._ngRedux.dispatch({ - type: EPALCLASSES_INIT, - payload: { - } - }); - }; + initEpalClasses = () => { + return this._ngRedux.dispatch({ + type: EPALCLASSES_INIT, + payload: { + } + }); + }; } diff --git a/source/actions/index.ts b/source/actions/index.ts index f68b54e2d11a64332f0fb7f6208aecd4c64cd9d7..e19f359715bffa67f77519a877792d17704d3de8 100644 --- a/source/actions/index.ts +++ b/source/actions/index.ts @@ -1,24 +1,19 @@ -import { CourseFieldsActions } from './coursefields.actions'; -import { SectorFieldsActions } from './sectorfields.actions'; -import { RegionSchoolsActions } from './regionschools.actions'; -import { SectorCoursesActions } from './sectorcourses.actions'; -import { StudentDataFieldsActions } from './studentdatafields.actions'; -import { EpalClassesActions } from './epalclass.actions'; -import { LoginInfoActions} from './logininfo.actions'; -import { CriteriaActions} from './criteria.actions'; +import { SectorFieldsActions } from "./sectorfields.actions"; +import { RegionSchoolsActions } from "./regionschools.actions"; +import { SectorCoursesActions } from "./sectorcourses.actions"; +import { StudentDataFieldsActions } from "./studentdatafields.actions"; +import { EpalClassesActions } from "./epalclass.actions"; +import { LoginInfoActions} from "./logininfo.actions"; -const ACTION_PROVIDERS = [ CourseFieldsActions, SectorFieldsActions, RegionSchoolsActions, SectorCoursesActions, StudentDataFieldsActions, - EpalClassesActions, LoginInfoActions, CriteriaActions]; +const ACTION_PROVIDERS = [SectorFieldsActions, RegionSchoolsActions, SectorCoursesActions, StudentDataFieldsActions, + EpalClassesActions, LoginInfoActions]; export { - CourseFieldsActions, - SectorFieldsActions, - RegionSchoolsActions, - SectorCoursesActions, - StudentDataFieldsActions, - EpalClassesActions, - LoginInfoActions, - CriteriaActions, - - ACTION_PROVIDERS, +SectorFieldsActions, +RegionSchoolsActions, +SectorCoursesActions, +StudentDataFieldsActions, +EpalClassesActions, +LoginInfoActions, +ACTION_PROVIDERS, }; diff --git a/source/actions/logininfo.actions.ts b/source/actions/logininfo.actions.ts index 321a4ad725ae4373566ab760ef5398547214feae..dc6b397e88ac5580245f93d0f1f97119c2287f60 100644 --- a/source/actions/logininfo.actions.ts +++ b/source/actions/logininfo.actions.ts @@ -1,63 +1,63 @@ -import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED, STATEMENTAGREE_SAVE } from '../constants'; -import { LOGININFO_INIT } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; -import { HelperDataService } from '../services/helper-data-service'; +import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED, STATEMENTAGREE_SAVE } from "../constants"; +import { LOGININFO_INIT } from "../constants"; +import { Injectable } from "@angular/core"; +import { NgRedux } from "@angular-redux/store"; +import { IAppState } from "../store"; +import { HelperDataService } from "../services/helper-data-service"; @Injectable() export class LoginInfoActions { - constructor( - private _ngRedux: NgRedux, - private _hds: HelperDataService) {} - - - getloginInfo = (loginInfo) => { - return this._hds.getCurrentUser(loginInfo.auth_token, loginInfo.auth_role).then (loginInfos => { - return this._ngRedux.dispatch({ - type: LOGININFO_SAVE, - payload: { - loginInfos - } - }); - }); -} - - saveMinEduloginInfo = (loginInfos) => { - return this._ngRedux.dispatch({ - type: LOGININFO_SAVE, - payload: { - loginInfos + constructor( + private _ngRedux: NgRedux, + private _hds: HelperDataService) { } + + + getloginInfo = (loginInfo) => { + return this._hds.getCurrentUser(loginInfo.auth_token, loginInfo.auth_role).then(loginInfos => { + return this._ngRedux.dispatch({ + type: LOGININFO_SAVE, + payload: { + loginInfos + } + }); + }); } - }); -}; - -saveProfile = (profile) => { - return this._ngRedux.dispatch({ - type: PROFILE_SAVE, - payload: { - profile - } - }); -}; - -saveStatementAgree = (disclaimer_checked) => { - return this._ngRedux.dispatch({ - type: STATEMENTAGREE_SAVE, - payload: { - disclaimer_checked - } - }); -}; - - - initLoginInfo = () => { - return this._ngRedux.dispatch({ - type: LOGININFO_INIT, - payload: { - } - }); - }; + + saveMinEduloginInfo = (loginInfos) => { + return this._ngRedux.dispatch({ + type: LOGININFO_SAVE, + payload: { + loginInfos + } + }); + }; + + saveProfile = (profile) => { + return this._ngRedux.dispatch({ + type: PROFILE_SAVE, + payload: { + profile + } + }); + }; + + saveStatementAgree = (disclaimer_checked) => { + return this._ngRedux.dispatch({ + type: STATEMENTAGREE_SAVE, + payload: { + disclaimer_checked + } + }); + }; + + + initLoginInfo = () => { + return this._ngRedux.dispatch({ + type: LOGININFO_INIT, + payload: { + } + }); + }; } diff --git a/source/actions/regionschools.actions.ts b/source/actions/regionschools.actions.ts index 42ef13126099ea137e1eb22038a5e1b4a84dc928..f9a832255356ecac4bd72a1c619108c6ae82a044 100644 --- a/source/actions/regionschools.actions.ts +++ b/source/actions/regionschools.actions.ts @@ -1,71 +1,55 @@ -import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE, REGIONSCHOOLS_INIT } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; -import { HelperDataService } from '../services/helper-data-service'; +import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE, REGIONSCHOOLS_INIT } from "../constants"; +import { Injectable } from "@angular/core"; +import { NgRedux } from "@angular-redux/store"; +import { IAppState } from "../store"; +import { HelperDataService } from "../services/helper-data-service"; @Injectable() export class RegionSchoolsActions { - constructor( - private _ngRedux: NgRedux, - private _hds: HelperDataService) {} + constructor( + private _ngRedux: NgRedux, + private _hds: HelperDataService) { } - getRegionSchools = (classActive,courseActive, reload) => { - const { regions } = this._ngRedux.getState(); - if (reload === true || (reload === false && regions.size === 0)) { - return this._hds.getRegionsWithSchools(classActive,courseActive).then(regions => { - return this._ngRedux.dispatch({ - type: REGIONSCHOOLS_RECEIVED, - payload: { - regions - } + getRegionSchools = (classActive, courseActive, reload) => { + const { regions } = this._ngRedux.getState(); + if (reload === true || (reload === false && regions.size === 0)) { + return this._hds.getRegionsWithSchools(classActive, courseActive).then(regions => { + return this._ngRedux.dispatch({ + type: REGIONSCHOOLS_RECEIVED, + payload: { + regions + } + }); }); - }); - } - }; - - initRegionSchools = () => { - return this._ngRedux.dispatch({ - type: REGIONSCHOOLS_INIT, - payload: { - } - }); - }; + } + }; - /* - getRegionSchools_Reload = (courseActive) => { - const { regions } = this._ngRedux.getState(); - //if (regions.size === 0) { - return this._hds.getRegionsWithSchools(courseActive).then(regions => { - return this._ngRedux.dispatch({ - type: REGIONSCHOOLS_RECEIVED, - payload: { - regions - } - }); + initRegionSchools = () => { + return this._ngRedux.dispatch({ + type: REGIONSCHOOLS_INIT, + payload: { + } }); - //} - }; - */ + }; - saveRegionSchoolsSelected = (checked, i, j) => { - return this._ngRedux.dispatch({ - type: REGIONSCHOOLS_SELECTED_SAVE, - payload: { - checked: checked, - rIndex: i, - sIndex: j - } - }); - }; + saveRegionSchoolsSelected = (checked, i, j) => { + return this._ngRedux.dispatch({ + type: REGIONSCHOOLS_SELECTED_SAVE, + payload: { + checked: checked, + rIndex: i, + sIndex: j + } + }); + }; - saveRegionSchoolsOrder = (selectedSchools) => { - return this._ngRedux.dispatch({ - type: REGIONSCHOOLS_ORDER_SAVE, - payload: { - selectedSchools - } - }); - }; + saveRegionSchoolsOrder = (selectedSchools) => { + return this._ngRedux.dispatch({ + type: REGIONSCHOOLS_ORDER_SAVE, + payload: { + selectedSchools + } + }); + }; } diff --git a/source/actions/sectorcourses.actions.ts b/source/actions/sectorcourses.actions.ts index 5cf041e1a0d2e90333780682d4ae96dfb069a504..8f84a363d7dd202f4bdc4a479924340c9a6b34cb 100644 --- a/source/actions/sectorcourses.actions.ts +++ b/source/actions/sectorcourses.actions.ts @@ -1,62 +1,46 @@ -import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; -import { HelperDataService } from '../services/helper-data-service'; +import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from "../constants"; +import { Injectable } from "@angular/core"; +import { NgRedux } from "@angular-redux/store"; +import { IAppState } from "../store"; +import { HelperDataService } from "../services/helper-data-service"; @Injectable() export class SectorCoursesActions { - constructor( - private _ngRedux: NgRedux, - private _hds: HelperDataService) {} + constructor( + private _ngRedux: NgRedux, + private _hds: HelperDataService) { } - getSectorCourses = (reload) => { - const { sectors } = this._ngRedux.getState(); - //if (sectors.size === 0) { - if (reload === true || (reload === false && sectors.size === 0)) { - return this._hds.getSectorsWithCourses().then(sectors => { - return this._ngRedux.dispatch({ - type: SECTORCOURSES_RECEIVED, - payload: { - sectors - } + getSectorCourses = (reload) => { + const { sectors } = this._ngRedux.getState(); + // if (sectors.size === 0) { + if (reload === true || (reload === false && sectors.size === 0)) { + return this._hds.getSectorsWithCourses().then(sectors => { + return this._ngRedux.dispatch({ + type: SECTORCOURSES_RECEIVED, + payload: { + sectors + } + }); }); - }); - } - }; - - initSectorCourses = () => { - return this._ngRedux.dispatch({ - type: SECTORCOURSES_INIT, - payload: { - } - }); - }; + } + }; - /* - getSectorCourses_Reload = () => { - const { sectors } = this._ngRedux.getState(); - //if (sectors.size === 0) { - return this._hds.getSectorsWithCourses().then(sectors => { - return this._ngRedux.dispatch({ - type: SECTORCOURSES_RECEIVED, - payload: { - sectors - } - }); + initSectorCourses = () => { + return this._ngRedux.dispatch({ + type: SECTORCOURSES_INIT, + payload: { + } }); - //} - }; - */ + }; - saveSectorCoursesSelected = (sectorCoursesSelected,sectorSelected) => { - return this._ngRedux.dispatch({ - type: SECTORCOURSES_SELECTED_SAVE, - payload: { - sectorCoursesSelected, - sectorSelected - } - }); - }; + saveSectorCoursesSelected = (sectorCoursesSelected, sectorSelected) => { + return this._ngRedux.dispatch({ + type: SECTORCOURSES_SELECTED_SAVE, + payload: { + sectorCoursesSelected, + sectorSelected + } + }); + }; } diff --git a/source/actions/sectorfields.actions.ts b/source/actions/sectorfields.actions.ts index e4c0ed0548c28b014cad4effcebe2bc51660356a..d9d3cd350042ed4c35d4da55fd8cffe12858b501 100644 --- a/source/actions/sectorfields.actions.ts +++ b/source/actions/sectorfields.actions.ts @@ -1,8 +1,8 @@ -import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE, SECTORFIELDS_INIT } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; -import { HelperDataService } from '../services/helper-data-service'; +import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE, SECTORFIELDS_INIT } from "../constants"; +import { Injectable } from "@angular/core"; +import { NgRedux } from "@angular-redux/store"; +import { IAppState } from "../store"; +import { HelperDataService } from "../services/helper-data-service"; @Injectable() export class SectorFieldsActions { @@ -12,7 +12,7 @@ export class SectorFieldsActions { getSectorFields = (reload) => { const { sectorFields } = this._ngRedux.getState(); - //if (sectorFields.size === 0) { + // if (sectorFields.size === 0) { if (reload === true || (reload === false && sectorFields.size === 0)) { return this._hds.getSectorFields().then(sectorFields => { return this._ngRedux.dispatch({ diff --git a/source/actions/studentdatafields.actions.ts b/source/actions/studentdatafields.actions.ts index fb705e023eb909e64e3021a996f78e8e1ef93490..a650b5c513108f9080ec903e2a96bc15c8d103a5 100644 --- a/source/actions/studentdatafields.actions.ts +++ b/source/actions/studentdatafields.actions.ts @@ -1,28 +1,26 @@ -import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_INIT } from '../constants'; -import { Injectable } from '@angular/core'; -import { NgRedux } from '@angular-redux/store'; -import { IAppState } from '../store'; -//import { UserDataService } from '../services/user-data-service'; - +import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_INIT } from "../constants"; +import { Injectable } from "@angular/core"; +import { NgRedux } from "@angular-redux/store"; +import { IAppState } from "../store"; @Injectable() export class StudentDataFieldsActions { - constructor( - private _ngRedux: NgRedux) {} + constructor( + private _ngRedux: NgRedux) { } - saveStudentDataFields = (studentDataFields) => { + saveStudentDataFields = (studentDataFields) => { - return this._ngRedux.dispatch({ - type: STUDENTDATAFIELDS_SAVE, - payload: { - studentDataFields - } + return this._ngRedux.dispatch({ + type: STUDENTDATAFIELDS_SAVE, + payload: { + studentDataFields + } - }); + }); - }; + }; - initStudentDataFields = () => { + initStudentDataFields = () => { return this._ngRedux.dispatch({ type: STUDENTDATAFIELDS_INIT, payload: { diff --git a/source/app.routes.ts b/source/app.routes.ts index 62e1b1dffa775209d368dfcca36009eeafd86ffa..c106c17ab7c2a4870d28a863ef3e019e5314e4de 100644 --- a/source/app.routes.ts +++ b/source/app.routes.ts @@ -1,14 +1,14 @@ -import { RouterModule } from '@angular/router'; +import { RouterModule } from "@angular/router"; import { MainRoutes, MainDeclarations } - from './containers/main.routes'; +from "./containers/main.routes"; export const routes = [ - ...MainRoutes + ...MainRoutes ]; export const APP_DECLARATIONS = [ - ...MainDeclarations + ...MainDeclarations ]; export const APP_ROUTER_PROVIDERS = RouterModule.forRoot(routes); diff --git a/source/app.settings.deployment.ts b/source/app.settings.deployment.ts index 8c95a3e6e5186e84d7d6ba1289d97039204ea789..067f79253f9ff58f2746e58a82b1eb436f0194cd 100644 --- a/source/app.settings.deployment.ts +++ b/source/app.settings.deployment.ts @@ -1,11 +1,11 @@ -export const API_ENDPOINT = ''; -export const API_ENDPOINT_PARAMS = ''; +export const API_ENDPOINT = ""; +export const API_ENDPOINT_PARAMS = ""; export class AppSettings { - public static get API_ENDPOINT(): string { - return ''; - } - public static get API_ENDPOINT_PARAMS(): string { - return ''; - } + public static get API_ENDPOINT(): string { + return ""; + } + public static get API_ENDPOINT_PARAMS(): string { + return ""; + } } diff --git a/source/app.ts b/source/app.ts index 9e17f3293637ae3779fed1c03f8a9a067b2a9b8d..e8e22d6581282c6c7dbee894e7fddcf8603f82f4 100644 --- a/source/app.ts +++ b/source/app.ts @@ -9,24 +9,23 @@ import { CookieModule } from "ngx-cookie"; import { MyDatePickerModule } from "mydatepicker"; import { NguiAutoCompleteModule } from "@ngui/auto-complete"; import { - FormsModule, - ReactiveFormsModule, + FormsModule, + ReactiveFormsModule, } from "@angular/forms"; import {RouterModule} from "@angular/router"; import { HttpModule } from "@angular/http"; import { - APP_BASE_HREF, - HashLocationStrategy, - LocationStrategy, - NgLocalization, + APP_BASE_HREF, + HashLocationStrategy, + LocationStrategy, + NgLocalization, } from "@angular/common"; import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; import Main from "./containers/main"; import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from "./app.routes"; -/* Here we import services */ import {HelperDataService} from "./services/helper-data-service"; import {LoaderService} from "./services/Spinner.service"; import {AuthService} from "./services/auth.service"; @@ -53,54 +52,54 @@ import FooterComponent from "./components/footer/footer.component"; import {enableProdMode} from "@angular/core"; class MyLocalization extends NgLocalization { - getPluralCategory(value: any) { - if (value < 5) { - return "few"; - } - } + getPluralCategory(value: any) { + if (value < 5) { + return "few"; + } + } } @NgModule({ - imports: [ - BrowserModule, - MyDatePickerModule, - FormsModule, - NguiAutoCompleteModule, - RouterModule, - ReactiveFormsModule, - APP_ROUTER_PROVIDERS, - HttpModule, - Ng2SmartTableModule, - NgReduxModule, - CookieModule.forRoot() - ], - declarations: [ - Main, FooterComponent, HeaderComponent, NavbarComponent, MainComponent, - APP_DECLARATIONS, - ], - bootstrap: [ Main ], - providers: [ - { provide: APP_BASE_HREF, useValue: "/" }, - { provide: LocationStrategy, useClass: HashLocationStrategy }, - { provide: NgLocalization, useClass: MyLocalization }, - DevToolsExtension, - ACTION_PROVIDERS, - // Service1, again services here - HelperDataService, - LoaderService, - AuthService, - SchoolAuthGuard, - SchoolStudentsLockedGuard, - SchoolCapacityLockedGuard, - StudentAuthGuard, - StudentLockGuard, - RegionEduAuthGuard, - EduAdminAuthGuard, - MinistryAuthGuard, - ReportsAuthGuard - ] + imports: [ + BrowserModule, + MyDatePickerModule, + FormsModule, + NguiAutoCompleteModule, + RouterModule, + ReactiveFormsModule, + APP_ROUTER_PROVIDERS, + HttpModule, + Ng2SmartTableModule, + NgReduxModule, + CookieModule.forRoot() + ], + declarations: [ + Main, FooterComponent, HeaderComponent, NavbarComponent, MainComponent, + APP_DECLARATIONS, + ], + bootstrap: [Main], + providers: [ + { provide: APP_BASE_HREF, useValue: "/" }, + { provide: LocationStrategy, useClass: HashLocationStrategy }, + { provide: NgLocalization, useClass: MyLocalization }, + DevToolsExtension, + ACTION_PROVIDERS, + // Service1, again services here + HelperDataService, + LoaderService, + AuthService, + SchoolAuthGuard, + SchoolStudentsLockedGuard, + SchoolCapacityLockedGuard, + StudentAuthGuard, + StudentLockGuard, + RegionEduAuthGuard, + EduAdminAuthGuard, + MinistryAuthGuard, + ReportsAuthGuard + ] }) -class AppModule {} +class AppModule { } // enableProdMode(); platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/source/components/director/director-classcapacity.ts b/source/components/director/director-classcapacity.ts index ae7450e01d851b20844003036ce95ae4e496ac85..ead720463cc8367faa0e372433c1afc5c3406c64 100644 --- a/source/components/director/director-classcapacity.ts +++ b/source/components/director/director-classcapacity.ts @@ -1,17 +1,17 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { HelperDataService } from '../../services/helper-data-service'; +import { AppSettings } from "../../app.settings"; +import { HelperDataService } from "../../services/helper-data-service"; import {Observable} from "rxjs/Observable"; -import {Http, Headers, RequestOptions} from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -import {Router, ActivatedRoute, Params} from '@angular/router'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -import { ILoginInfo } from '../../store/logininfo/logininfo.types'; -import { VALID_CAPACITY_PATTERN} from '../../constants'; -import {maxValue} from '../../constants'; -import {minValue} from '../../constants'; +import {Http, Headers, RequestOptions} from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +import {Router, ActivatedRoute, Params} from "@angular/router"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +import { ILoginInfo } from "../../store/logininfo/logininfo.types"; +import { VALID_CAPACITY_PATTERN} from "../../constants"; +import {maxValue} from "../../constants"; +import {minValue} from "../../constants"; import { @@ -20,9 +20,9 @@ import { FormControl, FormArray, Validators, -} from '@angular/forms'; +} from "@angular/forms"; @Component({ - selector: 'director-classcapacity', + selector: "director-classcapacity", template: `
@@ -92,7 +92,7 @@ import { @Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy { - public formGroup: FormGroup; + private formGroup: FormGroup; private CapacityPerCourse$: BehaviorSubject; private CapacityPerCourseSub: Subscription; @@ -124,12 +124,11 @@ import { public showModal(popupMsgId): void { - ($(popupMsgId)).modal('show'); + ($(popupMsgId)).modal("show"); } public hideModal(popupMsgId): void { - //($('#distributionWaitingNotice')).modal('hide'); - ($(popupMsgId)).modal('hide'); + ($(popupMsgId)).modal("hide"); } public onHidden(popupMsgId): void { @@ -142,7 +141,7 @@ import { } ngOnInit() { - ($('#checksaved1')).appendTo("body"); + ($("#checksaved1")).appendTo("body"); this.CapacityPerCourseSub = this._hds.FindCapacityPerSchool().subscribe(x => { this.CapacityPerCourse$.next(x); @@ -156,7 +155,7 @@ import { handleChange(e: Event) { - this.newvalue = e.target['value']; + this.newvalue = e.target["value"]; } saveCapacity(spec, sect, taxi, oldvalue, ind) { diff --git a/source/components/director/director-view.ts b/source/components/director/director-view.ts index 1a4f706567c2383baeb985e74d29ccca28e1921c..fe69a2629969906c7c83ad8b8e9100600c1ff340 100644 --- a/source/components/director/director-view.ts +++ b/source/components/director/director-view.ts @@ -1,17 +1,17 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { HelperDataService } from '../../services/helper-data-service'; +import { AppSettings } from "../../app.settings"; +import { HelperDataService } from "../../services/helper-data-service"; import {Observable} from "rxjs/Observable"; -import {Http, Headers, RequestOptions} from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -import {Router, ActivatedRoute, Params} from '@angular/router'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -import { ILoginInfo } from '../../store/logininfo/logininfo.types'; -import { VALID_CAPACITY_PATTERN} from '../../constants'; -import {maxValue} from '../../constants'; -import {minValue} from '../../constants'; +import {Http, Headers, RequestOptions} from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +import {Router, ActivatedRoute, Params} from "@angular/router"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +import { ILoginInfo } from "../../store/logininfo/logininfo.types"; +import { VALID_CAPACITY_PATTERN} from "../../constants"; +import {maxValue} from "../../constants"; +import {minValue} from "../../constants"; import { @@ -20,9 +20,9 @@ import { FormControl, FormArray, Validators, -} from '@angular/forms'; +} from "@angular/forms"; @Component({ - selector: 'director-classcapacity', + selector: "director-classcapacity", template: ` @@ -284,7 +284,7 @@ import { @Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy { - public formGroup: FormGroup; + private formGroup: FormGroup; private CoursesPerSchool$: BehaviorSubject; private CoursesPerSchoolSub: Subscription; @@ -323,28 +323,28 @@ import { public showConfirmModal(): void { - ($('#applicationDeleteConfirm')).modal('show'); + ($("#applicationDeleteConfirm")).modal("show"); } public showErrorModal(): void { - ($('#applicationDeleteError')).modal('show'); + ($("#applicationDeleteError")).modal("show"); } public hideConfirmModal(): void { - ($('#applicationDeleteConfirm')).modal('hide'); + ($("#applicationDeleteConfirm")).modal("hide"); } public hideErrorModal(): void { - ($('#applicationDeleteError')).modal('hide'); + ($("#applicationDeleteError")).modal("hide"); } public showModal(popupMsgId): void { - ($(popupMsgId)).modal('show'); + ($(popupMsgId)).modal("show"); } public hideModal(popupMsgId): void { - ($(popupMsgId)).modal('hide'); + ($(popupMsgId)).modal("hide"); } public onHidden(popupMsgId): void { @@ -353,16 +353,16 @@ import { ngOnDestroy() { - ($('#applicationDeleteConfirm')).remove(); - ($('#applicationDeleteError')).remove(); + ($("#applicationDeleteConfirm")).remove(); + ($("#applicationDeleteError")).remove(); } ngOnInit() { - ($('#checksaved')).appendTo("body"); - ($('#dangermodal')).appendTo("body"); - ($('#emptyselection')).appendTo("body"); - ($('#applicationDeleteConfirm')).appendTo("body"); - ($('#applicationDeleteError')).appendTo("body"); + ($("#checksaved")).appendTo("body"); + ($("#dangermodal")).appendTo("body"); + ($("#emptyselection")).appendTo("body"); + ($("#applicationDeleteConfirm")).appendTo("body"); + ($("#applicationDeleteError")).appendTo("body"); this.showLoader.next(true); this.CoursesPerSchoolSub = this._hds.FindCoursesPerSchool().subscribe(x => { this.CoursesPerSchool$.next(x); @@ -399,7 +399,7 @@ import { setActive(ind) { this.StudentActive = -1; - if (this.courseActive == ind) { + if (this.courseActive === ind) { ind = -1; } this.courseActive = ind; @@ -407,7 +407,7 @@ import { setActiveStudent(ind) { this.opened = true; - if (this.StudentActive == ind) { + if (this.StudentActive === ind) { ind = -1; } this.StudentActive = ind; @@ -415,7 +415,7 @@ import { setActiveStudentnew(ind) { this.opened = false; - if (this.StudentActive == ind) { + if (this.StudentActive === ind) { ind = -1; } this.StudentActive = ind; @@ -424,14 +424,14 @@ import { confirmStudent(student, cb, ind) { - var rtype; - if (cb.value == 1) - rtype = '1'; - if (cb.value == 2) - rtype = '0'; - if (cb.value == 3) + let rtype; + if (cb.value === 1) + rtype = "1"; + if (cb.value === 2) + rtype = "0"; + if (cb.value === 3) rtype = null; - var type = cb.value; + let type = cb.value; this.showLoader.next(true); let std = this.StudentInfo$.getValue(); @@ -474,7 +474,6 @@ import { this.CoursesPerSchoolSub.unsubscribe(); this.showLoader.next(false); this.StudentActive = -1; - //this.courseActive = -1; this.CoursesPerSchoolSub = this._hds.FindCoursesPerSchool().subscribe(x => { this.CoursesPerSchool$.next(x); diff --git a/source/components/director/director.buttons.ts b/source/components/director/director.buttons.ts index 2b9d7ee6b3ac36b3959d79557fece3125a088b8d..9f25872ac8142eb8268b1b1ee59fbc4d600769a9 100644 --- a/source/components/director/director.buttons.ts +++ b/source/components/director/director.buttons.ts @@ -1,8 +1,8 @@ -import {Router} from '@angular/router'; -import {OnInit, Component, Injectable} from '@angular/core'; +import {Router} from "@angular/router"; +import {OnInit, Component, Injectable} from "@angular/core"; @Component({ - selector: 'director-buttons', + selector: "director-buttons", template: `
@@ -23,21 +23,20 @@ import {OnInit, Component, Injectable} from '@angular/core'; constructor( private router: Router, - ) - { + ) { }; ngOnInit() { } - navigatedirector(){ - this.router.navigate(['/school/director-view']); + navigatedirector() { + this.router.navigate(["/school/director-view"]); } - navigatecapacity(){ - this.router.navigate(['/school/director-classcapacity']); + navigatecapacity() { + this.router.navigate(["/school/director-classcapacity"]); } } diff --git a/source/components/footer/footer.component.html b/source/components/footer/footer.component.html index 18128b2e061b351b105028d64d38c8c642fd0baf..84fd5c4b5d21c3c5b096ef6adc29715aad7e6c78 100644 --- a/source/components/footer/footer.component.html +++ b/source/components/footer/footer.component.html @@ -1,20 +1,17 @@
diff --git a/source/components/footer/footer.component.ts b/source/components/footer/footer.component.ts index 12247e8021f23cc624ab9e546eccbf70eacf9efd..b7f9c25c74f78db2ce940070fce6b7ac5be4f32f 100644 --- a/source/components/footer/footer.component.ts +++ b/source/components/footer/footer.component.ts @@ -1,7 +1,7 @@ -import {Component} from '@angular/core'; +import {Component} from "@angular/core"; @Component({ - selector: 'reg-footer', - templateUrl: 'footer.component.html' + selector: "reg-footer", + templateUrl: "footer.component.html" }) export default class FooterComponent { } diff --git a/source/components/header/header.component.html b/source/components/header/header.component.html index ee89cdd39e801248dfcc58c5ea2e33cb484777cb..2362601cef868b2539564afda751f815ddd05b96 100644 --- a/source/components/header/header.component.html +++ b/source/components/header/header.component.html @@ -29,15 +29,15 @@   Αρχική
- Επικοινωνία + Επικοινωνία
-
- +
+
Σύνολο Δηλώσεων: {{TotalStudent$.numStudents}}
-
+
diff --git a/source/components/header/header.component.ts b/source/components/header/header.component.ts index b1448628ed724a96f216e88614aa27eeb578148b..a8d7c807c2261611ed00a62680a927e6f4182b69 100644 --- a/source/components/header/header.component.ts +++ b/source/components/header/header.component.ts @@ -2,7 +2,7 @@ import {Component, OnInit, OnDestroy} from "@angular/core"; import {Router} from "@angular/router"; import { Injectable } from "@angular/core"; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; import { NgRedux, select } from "@angular-redux/store"; import { IAppState } from "../../store/store"; import { ILoginInfo, ILoginInfoToken } from "../../store/logininfo/logininfo.types"; @@ -14,10 +14,8 @@ 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" @@ -28,7 +26,7 @@ export default class HeaderComponent implements OnInit, OnDestroy { private authRole: string; private cuName: string; private loginInfo$: BehaviorSubject; - public cuser: any; + private cuser: any; private showLoader$: BehaviorSubject; private modalTitle: BehaviorSubject; private modalText: BehaviorSubject; @@ -47,7 +45,6 @@ export default class HeaderComponent implements OnInit, OnDestroy { private _rsa: RegionSchoolsActions, private _eca: EpalClassesActions, private _sdfa: StudentDataFieldsActions, - private _cria: CriteriaActions, private _ngRedux: NgRedux, private router: Router ) { @@ -68,7 +65,7 @@ export default class HeaderComponent implements OnInit, OnDestroy { ngOnInit() { ($("#headerNotice")).appendTo("body"); - this.loginInfoSub = this._ngRedux.select('loginInfo') + this.loginInfoSub = this._ngRedux.select("loginInfo") .map(loginInfo => loginInfo) .subscribe(loginInfo => { if (loginInfo.size > 0) { @@ -79,21 +76,20 @@ export default class HeaderComponent implements OnInit, OnDestroy { return loginInfoToken; }, {}); - if (this.hasvalue == false) - { - this.showLoader.next(true); - this.TotalStudentsSub = this._hds.findTotalStudents().subscribe(x => { - this.TotalStudents$.next(x); - this.showLoader.next(false); - this.hasvalue = true; - }, - error => { - this.TotalStudents$.next([{}]); - console.log("Error Getting courses perSchool"); - this.showLoader.next(false); - }); - - } + if (this.hasvalue === false) { + this.showLoader.next(true); + this.TotalStudentsSub = this._hds.findTotalStudents().subscribe(x => { + this.TotalStudents$.next(x); + this.showLoader.next(false); + this.hasvalue = true; + }, + error => { + this.TotalStudents$.next([{}]); + console.log("Error Getting courses perSchool"); + this.showLoader.next(false); + }); + + } } @@ -110,7 +106,6 @@ export default class HeaderComponent implements OnInit, OnDestroy { if (this.loginInfoSub) { this.loginInfoSub.unsubscribe(); } -// this.loginInfo$.unsubscribe(); } @@ -119,19 +114,16 @@ export default class HeaderComponent implements OnInit, OnDestroy { this._hds.signOut().then(data => { this._ata.initLoginInfo(); if (this.authRole === SCHOOL_ROLE) { - // this.router.navigate(['/school']); this.authToken = ""; this.authRole = ""; window.location.assign((data).next); } else if (this.authRole === PDE_ROLE) { - // this.router.navigate(["/school"]); this.authToken = ""; this.authRole = ""; window.location.assign((data).next); } else if (this.authRole === DIDE_ROLE) { - // this.router.navigate(["/school"]); this.authToken = ""; this.authRole = ""; window.location.assign((data).next); @@ -142,7 +134,6 @@ export default class HeaderComponent implements OnInit, OnDestroy { this._rsa.initRegionSchools(); this._csa.initSectorCourses(); this._sdfa.initStudentDataFields(); - this._cria.initCriteria(); this.router.navigate([""]); } else if (this.authRole === MINISTRY_ROLE) { @@ -159,7 +150,7 @@ export default class HeaderComponent implements OnInit, OnDestroy { goHome() { if (this.authRole === SCHOOL_ROLE) { - this.router.navigate(['/school']); + this.router.navigate(["/school"]); } else if (this.authRole === PDE_ROLE) { this.router.navigate(["/school"]); @@ -175,9 +166,8 @@ export default class HeaderComponent implements OnInit, OnDestroy { } } - gohelpDesk() - { - this.router.navigate(['/help-desk']); + gohelpDesk() { + this.router.navigate(["/help-desk"]); } public showModal(): void { diff --git a/source/components/home.ts b/source/components/home.ts index 3439f4bc26f8a0616d9402e258cde412115cd4a6..0c2c0c85d2e35207a8ee6c7777b525defc999f01 100644 --- a/source/components/home.ts +++ b/source/components/home.ts @@ -1,24 +1,24 @@ -import {Router, ActivatedRoute, Params} from '@angular/router'; -import {OnInit, OnDestroy, Component} from '@angular/core'; -import { LoginInfoActions } from '../actions/logininfo.actions'; -import { ILoginInfo } from '../store/logininfo/logininfo.types'; -import { NgRedux, select } from '@angular-redux/store'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -import { IAppState } from '../store/store'; -import { HelperDataService } from '../services/helper-data-service'; -import { CookieService } from 'ngx-cookie'; -import { STUDENT_ROLE } from '../constants'; +import {Router, ActivatedRoute, Params} from "@angular/router"; +import {OnInit, OnDestroy, Component} from "@angular/core"; +import { LoginInfoActions } from "../actions/logininfo.actions"; +import { ILoginInfo } from "../store/logininfo/logininfo.types"; +import { NgRedux, select } from "@angular-redux/store"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +import { IAppState } from "../store/store"; +import { HelperDataService } from "../services/helper-data-service"; +import { CookieService } from "ngx-cookie"; +import { STUDENT_ROLE } from "../constants"; import { LOGININFO_INITIAL_STATE } from "../store/logininfo/logininfo.initial-state"; import { FormBuilder, FormGroup, FormControl, FormArray -} from '@angular/forms'; +} from "@angular/forms"; -import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings'; +import { API_ENDPOINT, API_ENDPOINT_PARAMS } from "../app.settings"; @Component({ - selector: 'home', + selector: "home", template: `
@@ -39,9 +39,6 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings';

- - -
@@ -58,7 +55,7 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings'; }) export default class Home implements OnInit, OnDestroy { - public formGroup: FormGroup; + private formGroup: FormGroup; private authToken: string; private authRole: string; private name: any; @@ -74,11 +71,11 @@ export default class Home implements OnInit, OnDestroy { private activatedRoute: ActivatedRoute, private _hds: HelperDataService, private router: Router, - private _cookieService:CookieService + private _cookieService: CookieService ) { - this.authToken = ''; - this.authRole = ''; - this.name = ''; + this.authToken = ""; + this.authRole = ""; + this.name = ""; this.formGroup = this.fb.group({ }); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); @@ -86,17 +83,17 @@ export default class Home implements OnInit, OnDestroy { ngOnInit() { - this.loginInfoSub = this._ngRedux.select('loginInfo').subscribe(loginInfo => { - let linfo=loginInfo; + this.loginInfoSub = this._ngRedux.select("loginInfo").subscribe(loginInfo => { + let linfo = loginInfo; if (linfo.size > 0) { linfo.reduce(({}, loginInfoToken) => { this.authToken = loginInfoToken.auth_token; this.authRole = loginInfoToken.auth_role; if (this.authToken && this.authToken.length > 0 && this.authRole && this.authRole === STUDENT_ROLE) { if (loginInfoToken.lock_application === 1) - this.router.navigate(['/info']); + this.router.navigate(["/info"]); else { - this.router.navigate(['/parent-form']); + this.router.navigate(["/parent-form"]); } } return loginInfoToken; @@ -104,13 +101,13 @@ export default class Home implements OnInit, OnDestroy { } this.loginInfo$.next(linfo); - }, error => {console.log("error selecting loginInfo");}); + }, error => { console.log("error selecting loginInfo"); }); // subscribe to router event this.activatedRoute.queryParams.subscribe((params: Params) => { if (params) { - this.authToken = params['auth_token']; - this.authRole = params['auth_role']; + this.authToken = params["auth_token"]; + this.authRole = params["auth_role"]; } if (this.authToken && this.authRole) @@ -119,15 +116,15 @@ export default class Home implements OnInit, OnDestroy { }); } - ngOnDestroy () { + ngOnDestroy() { if (this.loginInfoSub) this.loginInfoSub.unsubscribe(); } - getCookie(key: string){ + getCookie(key: string) { return this._cookieService.get(key); } - removeCookie(key: string){ + removeCookie(key: string) { return this._cookieService.remove(key); } diff --git a/source/components/infoviews/eduadmin-view.ts b/source/components/infoviews/eduadmin-view.ts index d93122725c2ae34a2624c3888ba620dc5310c350..12aab83ad04d18ab34656b623027ee8706673fd6 100644 --- a/source/components/infoviews/eduadmin-view.ts +++ b/source/components/infoviews/eduadmin-view.ts @@ -50,10 +50,10 @@ import {
Τμήματα
Επιλεχθέντες
Χωρητικότητα
-
+
{{CoursesNames$.name}}
@@ -70,7 +70,7 @@ import { @Injectable() export default class EduadminView implements OnInit, OnDestroy { - public formGroup: FormGroup; + private formGroup: FormGroup; private SchoolsPerPerf$: BehaviorSubject; private SchoolPerPerfSub: Subscription; private LimitPerCateg$: BehaviorSubject; @@ -80,7 +80,6 @@ import { private StudentsSize$: BehaviorSubject; private StudentsSizeSub: Subscription; private showLoader: BehaviorSubject; - public perfecture; private regionActive = -1; private School$: BehaviorSubject; private SchoolSub: Subscription; diff --git a/source/components/infoviews/perfecture-view.ts b/source/components/infoviews/perfecture-view.ts index ef649d0aed9f50948d19b936e6dd4a2ecdd2a270..4e40afdc80638012f39d4d4ff7e9d30d7a61d5be 100644 --- a/source/components/infoviews/perfecture-view.ts +++ b/source/components/infoviews/perfecture-view.ts @@ -69,7 +69,7 @@ import { @Injectable() export default class EduadminView implements OnInit, OnDestroy { - public formGroup: FormGroup; + private formGroup: FormGroup; private SchoolsPerPerf$: BehaviorSubject; private SchoolPerPerfSub: Subscription; private LimitPerCateg$: BehaviorSubject; @@ -79,7 +79,6 @@ import { private StudentsSize$: BehaviorSubject; private StudentsSizeSub: Subscription; private showLoader: BehaviorSubject; - public perfecture; private regionActive = -1; private School$: BehaviorSubject; private SchoolSub: Subscription; diff --git a/source/components/main/breadcrumbs.ts b/source/components/main/breadcrumbs.ts index f33ad397a29f57bedc9cf13282f064303dc5a7c5..285e0326c9a95792306e65b463e513d8cd1b7df4 100644 --- a/source/components/main/breadcrumbs.ts +++ b/source/components/main/breadcrumbs.ts @@ -1,20 +1,20 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; +import { Component, OnInit, OnDestroy } from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { Router } from '@angular/router'; +import { AppSettings } from "../../app.settings"; +import { Router } from "@angular/router"; @Component({ - selector: 'breadcrumbs', + selector: "breadcrumbs", template: `

Νέα Δήλωση Προτίμησης -> Επιλογή Τάξης

-

Νέα Δήλωση Προτίμησης -> Επιλογή Τoμέα

-

Νέα Δήλωση Προτίμησης -> Επιλογή Σχολείου ανα Περιφερειακή Διεύθυνση

-

Νέα Δήλωση Προτίμησης -> Επιλογή Ειδικότητας ανα τoμέα

-

Νέα Δήλωση Προτίμησης -> Σειρά Προτίμησης Επιλεχθέντων Σχολείων

-

Νέα Δήλωση Προτίμησης -> Προσωπικά Στοιχεία

-

Νέα Δήλωση Προτίμησης -> Προεπισκόπηση Δήλωσης Προτίμησης

-

Υποβληθείσες Δηλώσεις Προτίμησης

+

Νέα Δήλωση Προτίμησης -> Επιλογή Τoμέα

+

Νέα Δήλωση Προτίμησης -> Επιλογή Σχολείου ανα Περιφερειακή Διεύθυνση

+

Νέα Δήλωση Προτίμησης -> Επιλογή Ειδικότητας ανα τoμέα

+

Νέα Δήλωση Προτίμησης -> Σειρά Προτίμησης Επιλεχθέντων Σχολείων

+

Νέα Δήλωση Προτίμησης -> Προσωπικά Στοιχεία

+

Νέα Δήλωση Προτίμησης -> Προεπισκόπηση Δήλωσης Προτίμησης

+

Υποβληθείσες Δηλώσεις Προτίμησης

Διαχειριστής Υπουργείου Παιδείας -> Σύνδεση

@@ -22,13 +22,11 @@ import { Router } from '@angular/router'; }) @Injectable() export default class Breadcrumbs implements OnInit { -public currentUrl: string; + private currentUrl: string; -constructor(private _router:Router) {} - ngOnInit() { - - this.currentUrl = this._router.url; - - } + constructor(private _router: Router) { } + ngOnInit() { + this.currentUrl = this._router.url; + } } diff --git a/source/components/main/main.component.html b/source/components/main/main.component.html index 05416ed3da7687a132465cd54e00509005055147..aefff7fd3a7ddca0328cd91e8e6a7e3d3ee5fac5 100644 --- a/source/components/main/main.component.html +++ b/source/components/main/main.component.html @@ -1,53 +1,53 @@ -
+
-
-     -
+
+     +
-
-
- +
+
- + -
- -
+
+ +
-
-
-
-
+
+
+
+
-
-
- +
+
+ +
+
+
-
-
-
- + diff --git a/source/components/main/main.component.ts b/source/components/main/main.component.ts index cfc093a0685aaa7e9caf305cac045f78f0656623..617dc2c174fd7c8f9e0b703919954e8bc271ce55 100644 --- a/source/components/main/main.component.ts +++ b/source/components/main/main.component.ts @@ -1,18 +1,18 @@ -import {Component} from '@angular/core'; +import {Component} from "@angular/core"; import { Router } from "@angular/router"; @Component({ - selector: 'reg-main', - templateUrl: 'main.component.html' + selector: "reg-main", + templateUrl: "main.component.html" }) -export default class MainComponent { +export default class MainComponent { - constructor( + constructor( private router: Router - ) {} + ) { } -navigatelegal() { - this.router.navigate(['/legal-info']); + navigatelegal() { + this.router.navigate(["/legal-info"]); } } diff --git a/source/components/minister/chart-creator.ts b/source/components/minister/chart-creator.ts index 57de74debf56e6e0ea149fae44c7747104d0094c..4c94c923b387769e4fa57482c3b3375f886eb641 100644 --- a/source/components/minister/chart-creator.ts +++ b/source/components/minister/chart-creator.ts @@ -1,100 +1,98 @@ -import * as d3 from 'd3'; +import * as d3 from "d3"; import { ElementRef, ViewChild } from "@angular/core"; -export class chartCreator { - - //d3 test - @ViewChild('chart') public chartContainer: ElementRef; - //@Input() private d3data: Array; - public d3data: Array; - private margin: any = { top: 20, bottom: 20, left: 20, right: 20}; - private chart: any; - private width: number; - private height: number; - private xScale: any; - private yScale: any; - private colors: any; - private xAxis: any; - private yAxis: any; - - createChart() { - let element = this.chartContainer.nativeElement; - this.width = element.offsetWidth - this.margin.left - this.margin.right; - this.height = element.offsetHeight - this.margin.top - this.margin.bottom; - let svg = d3.select(element).append('svg') - .attr('width', element.offsetWidth) - .attr('height', element.offsetHeight); - - // chart plot area - - this.chart = svg.append('g') - .attr('class', 'bars') - .attr('transform', `translate(${this.margin.left}, ${this.margin.top})`); - - - // define X & Y domains - let xDomain = this.d3data.map(d => d[0]); - let yDomain = [0, d3.max(this.d3data, d => d[1])]; - //let yDomain = [0, 1000]; - - // create scales - this.xScale = d3.scaleBand().padding(0.1).domain(xDomain).rangeRound([0, this.width]); - this.yScale = d3.scaleLinear().domain(yDomain).range([this.height, 0]); - //this.yScale = d3.scaleLinear().domain(yDomain).range([1000, 0]); - - // bar colors - this.colors = d3.scaleLinear().domain([0, this.d3data.length]).range(['red', 'blue']); - - - // x & y axis - this.xAxis = svg.append('g') - .attr('class', 'axis axis-x') - .attr('transform', `translate(${this.margin.left}, ${this.margin.top + this.height})`) - .call(d3.axisBottom(this.xScale)); - - this.yAxis = svg.append('g') - .attr('class', 'axis axis-y') - .attr('transform', `translate(${this.margin.left}, ${this.margin.top})`) - .call(d3.axisLeft(this.yScale)); +export class ChartCreator { + + @ViewChild("chart") public chartContainer: ElementRef; + public d3data: Array; + private margin: any = { top: 20, bottom: 20, left: 20, right: 20 }; + private chart: any; + private width: number; + private height: number; + private xScale: any; + private yScale: any; + private colors: any; + private xAxis: any; + private yAxis: any; + + createChart() { + let element = this.chartContainer.nativeElement; + this.width = element.offsetWidth - this.margin.left - this.margin.right; + this.height = element.offsetHeight - this.margin.top - this.margin.bottom; + let svg = d3.select(element).append("svg") + .attr("width", element.offsetWidth) + .attr("height", element.offsetHeight); + + // chart plot area + + this.chart = svg.append("g") + .attr("class", "bars") + .attr("transform", `translate(${this.margin.left}, ${this.margin.top})`); + + + // define X & Y domains + let xDomain = this.d3data.map(d => d[0]); + let yDomain = [0, d3.max(this.d3data, d => d[1])]; + // let yDomain = [0, 1000]; + + // create scales + this.xScale = d3.scaleBand().padding(0.1).domain(xDomain).rangeRound([0, this.width]); + this.yScale = d3.scaleLinear().domain(yDomain).range([this.height, 0]); + // this.yScale = d3.scaleLinear().domain(yDomain).range([1000, 0]); + + // bar colors + this.colors = d3.scaleLinear().domain([0, this.d3data.length]).range(["red", "blue"]); + + + // x & y axis + this.xAxis = svg.append("g") + .attr("class", "axis axis-x") + .attr("transform", `translate(${this.margin.left}, ${this.margin.top + this.height})`) + .call(d3.axisBottom(this.xScale)); + + this.yAxis = svg.append("g") + .attr("class", "axis axis-y") + .attr("transform", `translate(${this.margin.left}, ${this.margin.top})`) + .call(d3.axisLeft(this.yScale)); } updateChart() { - // update scales & axis - this.xScale.domain(this.d3data.map(d => d[0])); - this.yScale.domain([0, d3.max(this.d3data, d => d[1])]); - this.colors.domain([0, this.d3data.length]); - this.xAxis.transition().call(d3.axisBottom(this.xScale)); - this.yAxis.transition().call(d3.axisLeft(this.yScale)); - - let update = this.chart.selectAll('.bar') - .data(this.d3data); - - // remove exiting bars - update.exit().remove(); - - // update existing bars - this.chart.selectAll('.bar').transition() - .attr('x', d => this.xScale(d[0])) - .attr('y', d => this.yScale(d[1])) - .attr('width', d => this.xScale.bandwidth()) - .attr('height', d => this.height - this.yScale(d[1])) - .style('fill', (d, i) => this.colors(i)); - - // add new bars - update - .enter() - .append('rect') - .attr('class', 'bar') - .attr('x', d => this.xScale(d[0])) - .attr('y', d => this.yScale(0)) - .attr('width', this.xScale.bandwidth()) - .attr('height', 0) - .style('fill', (d, i) => this.colors(i)) - .transition() - .delay((d, i) => i * 10) - .attr('y', d => this.yScale(d[1])) - .attr('height', d => this.height - this.yScale(d[1])); - } + // update scales & axis + this.xScale.domain(this.d3data.map(d => d[0])); + this.yScale.domain([0, d3.max(this.d3data, d => d[1])]); + this.colors.domain([0, this.d3data.length]); + this.xAxis.transition().call(d3.axisBottom(this.xScale)); + this.yAxis.transition().call(d3.axisLeft(this.yScale)); + + let update = this.chart.selectAll(".bar") + .data(this.d3data); + + // remove exiting bars + update.exit().remove(); + + // update existing bars + this.chart.selectAll(".bar").transition() + .attr("x", d => this.xScale(d[0])) + .attr("y", d => this.yScale(d[1])) + .attr("width", d => this.xScale.bandwidth()) + .attr("height", d => this.height - this.yScale(d[1])) + .style("fill", (d, i) => this.colors(i)); + + // add new bars + update + .enter() + .append("rect") + .attr("class", "bar") + .attr("x", d => this.xScale(d[0])) + .attr("y", d => this.yScale(0)) + .attr("width", this.xScale.bandwidth()) + .attr("height", 0) + .style("fill", (d, i) => this.colors(i)) + .transition() + .delay((d, i) => i * 10) + .attr("y", d => this.yScale(d[1])) + .attr("height", d => this.height - this.yScale(d[1])); + } } diff --git a/source/components/minister/csv-creator.ts b/source/components/minister/csv-creator.ts index 5e766f8fe4054c05d7a9a05089535a02083c9e22..8eda81dba3371edfa2b5db9dcf0e9d6bed4ae4b1 100644 --- a/source/components/minister/csv-creator.ts +++ b/source/components/minister/csv-creator.ts @@ -1,111 +1,111 @@ -import {reportsSchema, TableColumn} from './reports-schema'; -import { LocalDataSource } from 'ng2-smart-table'; +import {ReportsSchema, TableColumn} from "./reports-schema"; +import { LocalDataSource } from "ng2-smart-table"; import { Input } from "@angular/core"; -export class csvCreator { +export class CsvCreator { - public source: LocalDataSource; - columnMap: Map = new Map(); - @Input() settings: any; - private reportSchema = new reportsSchema(); + public source: LocalDataSource; + columnMap: Map = new Map(); + @Input() settings: any; + private reportSchema = new ReportsSchema(); - onSearch(query: string = '') { + onSearch(query: string = "") { - this.source.setFilter([ - // fields we want to include in the search - { - field: 'name', - search: query - } - ], false); + this.source.setFilter([ + // fields we want to include in the search + { + field: "name", + search: query + } + ], false); - // second parameter specifying whether to perform 'AND' or 'OR' search - // (meaning all columns should contain search query or at least one) - // 'AND' by default, so changing to 'OR' by setting false here -} - - -export2Csv(): void { - - const columns: TableColumn[] = Array.from(this.columnMap.values()); - - let encodedStr = columns.reduce((acct, current: TableColumn) => { - - if (current.isExport != false) { - return acct += '"' + current.title + '",'; - } - else { - return acct; + // second parameter specifying whether to perform "AND" or "OR" search + // (meaning all columns should contain search query or at least one) + // "AND" by default, so changing to "OR" by setting false here } - }, ''); - encodedStr = encodedStr.slice(0, -1); - encodedStr += '\r\n'; - let fields: string[] = columns.reduce((acct, column: TableColumn) => { - if (column.isExport != false) { - acct.push(column.field); + export2Csv(): void { + + const columns: TableColumn[] = Array.from(this.columnMap.values()); + + let encodedStr = columns.reduce((acct, current: TableColumn) => { + + if (current.isExport !== false) { + return acct += "'" + current.title + "',"; + } + else { + return acct; + } + }, ""); + encodedStr = encodedStr.slice(0, -1); + encodedStr += "\r\n"; + + let fields: string[] = columns.reduce((acct, column: TableColumn) => { + + if (column.isExport !== false) { + acct.push(column.field); + } + return acct; + }, []); + + this.source.getAll().then((rows) => { + + rows.forEach((row) => { + fields.forEach((field) => { + if (row.hasOwnProperty(field)) { + let value = row[field]; + + if (!value) { + value = ""; + } + let valuePrepare = this.columnMap.get(field).valuePrepareFunction; + if (valuePrepare) { + value = valuePrepare.call(null, value, row); + } + encodedStr += "'" + value + "',"; + } + }); + encodedStr = encodedStr.slice(0, -1); + encodedStr += "\r\n"; + }); + + let a = document.createElement("a"); + a.setAttribute("style", "display:none;"); + document.body.appendChild(a); + + // Set utf-8 header to let excel recognize its encoding + let blob = new Blob(["\ufeff", encodedStr], { type: "text/csv" }); + a.href = window.URL.createObjectURL(blob); + a.download = (this.settings.fileName || "epalSystemReport") + "all_stat" + ".csv"; + a.click(); + }); } - return acct; - }, []); - - this.source.getAll().then((rows) => { - - rows.forEach((row) => { - fields.forEach((field) => { - if (row.hasOwnProperty(field)) { - let value = row[field]; - - if (!value) { - value = ""; - } - let valuePrepare = this.columnMap.get(field).valuePrepareFunction; - if (valuePrepare) { - value = valuePrepare.call(null, value, row); - } - encodedStr += '"' + value + '",' - } - }); - encodedStr = encodedStr.slice(0, -1); - encodedStr += '\r\n'; - }); - - let a = document.createElement("a"); - a.setAttribute('style', 'display:none;'); - document.body.appendChild(a); - - //Set utf-8 header to let excel recognize its encoding - let blob = new Blob(["\ufeff", encodedStr], {type: 'text/csv'}); - a.href = window.URL.createObjectURL(blob); - a.download = (this.settings.fileName || 'epalSystemReport') + "all_stat" + '.csv'; - a.click(); - }); -} -prepareColumnMap(): void { + prepareColumnMap(): void { - for (const key in this.settings.columns) { + for (const key in this.settings.columns) { - if (!this.settings.columns.hasOwnProperty(key)) { - continue; - } + if (!this.settings.columns.hasOwnProperty(key)) { + continue; + } - const title: string = this.settings.columns[key]['title']; - let column: TableColumn = new TableColumn(); - column.type = this.settings.columns[key]['type']; - column.title = this.settings.columns[key]['title']; - column.field = key; - column.isDisplay = this.settings.columns[key]['isDisplay']; - column.isExport = this.settings.columns[key]['isExport']; - column.valuePrepareFunction = this.settings.columns[key]['valuePrepareFunction']; - this.columnMap.set(column.field, column); - - if (this.settings.columns[key].isDisplay == false) { - delete this.settings.columns[key]; + const title: string = this.settings.columns[key]["title"]; + let column: TableColumn = new TableColumn(); + column.type = this.settings.columns[key]["type"]; + column.title = this.settings.columns[key]["title"]; + column.field = key; + column.isDisplay = this.settings.columns[key]["isDisplay"]; + column.isExport = this.settings.columns[key]["isExport"]; + column.valuePrepareFunction = this.settings.columns[key]["valuePrepareFunction"]; + this.columnMap.set(column.field, column); + + if (this.settings.columns[key].isDisplay === false) { + delete this.settings.columns[key]; + } + } } - } -} } diff --git a/source/components/minister/minister-informstudents.ts b/source/components/minister/minister-informstudents.ts index e22bca69bdb145a5d9297c14d6229b3954ff000b..c16dd3183188d271491b1a7e5bf384e7d3311b8a 100644 --- a/source/components/minister/minister-informstudents.ts +++ b/source/components/minister/minister-informstudents.ts @@ -1,19 +1,19 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild } from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { HelperDataService } from '../../services/helper-data-service'; +import { AppSettings } from "../../app.settings"; +import { HelperDataService } from "../../services/helper-data-service"; import { Observable } from "rxjs/Observable"; -import { Http, Headers, RequestOptions } from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -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 { API_ENDPOINT } from '../../app.settings'; +import { Http, Headers, RequestOptions } from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +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 { API_ENDPOINT } from "../../app.settings"; @Component({ - selector: 'minister-informstudents', + selector: "minister-informstudents", template: `
$('#emaiSentNotice')).appendTo("body"); - - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({ }, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); + ($("#emaiSentNotice")).appendTo("body"); + + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({ }, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); this.numSuccessMails = 0; this.numFailMails = 0; @@ -163,32 +165,25 @@ import { API_ENDPOINT } from '../../app.settings'; ngOnDestroy() { - ($('#emaiSentNotice')).remove(); + ($("#emaiSentNotice")).remove(); if (this.loginInfoSub) this.loginInfoSub.unsubscribe(); - if (this.loginInfo$) - this.loginInfo$.unsubscribe(); if (this.settingsSub) this.settingsSub.unsubscribe(); - if (this.loginInfo$) - this.loginInfo$.unsubscribe(); - if (this.settings$) - this.settings$.unsubscribe(); - } public showModal(): void { - ($('#emaiSentNotice')).modal('show'); + ($("#emaiSentNotice")).modal("show"); } public hideModal(): void { - ($('#emaiSentNotice')).modal('hide'); + ($("#emaiSentNotice")).modal("hide"); } public onHidden(): void { - //this.isModalShown.next(false); + // this.isModalShown.next(false); } informUnlocatedStudents(unallocated, period) { @@ -206,7 +201,7 @@ import { API_ENDPOINT } from '../../app.settings'; this.modalHeader.next("modal-header-success"); this.modalTitle.next("Κατανομή Μαθητών"); let txtModal = "Έγινε αποστολή " + this.numSuccessMails + " e-mails! "; - if (this.numFailMails != 0) { + if (this.numFailMails !== 0) { this.modalHeader.next("modal-header-warning"); txtModal += "Κάποια e-mail δεν έχουν σταλεί. Δεν ήταν δυνατή η αποστολή " + this.numFailMails + " e-mails!"; } @@ -229,9 +224,9 @@ import { API_ENDPOINT } from '../../app.settings'; this.settingsSub = this._hds.retrieveAdminSettings(this.minedu_userName, this.minedu_userPassword) .subscribe(data => { this.settings$.next(data); - this.applicantsResultsDisabled = Boolean(Number(this.settings$.value['applicantsResultsDisabled'])); + this.applicantsResultsDisabled = Boolean(Number(this.settings$.value["applicantsResultsDisabled"])); - if (this.applicantsResultsDisabled == false) { + if (this.applicantsResultsDisabled === false) { this.modalTitle.next("Κατανομή Μαθητών"); this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να αποστείλετε e-mail ενημέρωσης, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΕΝΕΡΓΟΠΟΙΗΣΤΕ ") + ("τη δυνατότητα της προβολής αποτελεσμάτων κατανομής από τους μαθητές.")); diff --git a/source/components/minister/minister-reports.ts b/source/components/minister/minister-reports.ts index 664948b7d7acc937392732aa642dda57e8e389bb..f5e6f929d7770cd0c5927833d1355a8e5e6558fe 100644 --- a/source/components/minister/minister-reports.ts +++ b/source/components/minister/minister-reports.ts @@ -87,9 +87,9 @@ import { API_ENDPOINT } from "../../app.settings"; @Injectable() export default class MinisterReports implements OnInit, OnDestroy { - public formGroup: FormGroup; - loginInfo$: BehaviorSubject; - loginInfoSub: Subscription; + private formGroup: FormGroup; + private loginInfo$: BehaviorSubject; + private loginInfoSub: Subscription; private apiEndPoint = API_ENDPOINT; private minedu_userName: string; private minedu_userPassword: string; @@ -116,21 +116,23 @@ import { API_ENDPOINT } from "../../app.settings"; ngOnInit() { - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({}, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - if (loginInfoToken.auth_role === PDE_ROLE || loginInfoToken.auth_role === DIDE_ROLE) { - this.userRole = loginInfoToken.auth_role; - this.minedu_userName = loginInfoToken.auth_token; - this.minedu_userPassword = loginInfoToken.auth_token; - } - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({}, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + if (loginInfoToken.auth_role === PDE_ROLE || loginInfoToken.auth_role === DIDE_ROLE) { + this.userRole = loginInfoToken.auth_role; + this.minedu_userName = loginInfoToken.auth_token; + this.minedu_userPassword = loginInfoToken.auth_token; + } + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); } @@ -138,9 +140,6 @@ import { API_ENDPOINT } from "../../app.settings"; if (this.loginInfoSub) { this.loginInfoSub.unsubscribe(); } - if (this.loginInfo$) { - this.loginInfo$.unsubscribe(); - } } nav_to_reportpath(repId) { diff --git a/source/components/minister/minister-settings.ts b/source/components/minister/minister-settings.ts index 61a273943fe85057b8595d6e5da7a54763b2c211..c4439262b08c7a4ae8929ef94870c9ef6c416465 100644 --- a/source/components/minister/minister-settings.ts +++ b/source/components/minister/minister-settings.ts @@ -1,15 +1,15 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { HelperDataService } from '../../services/helper-data-service'; +import { AppSettings } from "../../app.settings"; +import { HelperDataService } from "../../services/helper-data-service"; import { Observable} from "rxjs/Observable"; -import { Http, Headers, RequestOptions} from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -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 { Http, Headers, RequestOptions} from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +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 { @@ -18,11 +18,11 @@ import { FormControl, FormArray, Validators, -} from '@angular/forms'; +} from "@angular/forms"; @Component({ - selector: 'minister-settings', + selector: "minister-settings", template: `
; + private formGroup: FormGroup; + private loginInfo$: BehaviorSubject; private modalTitle: BehaviorSubject; private modalText: BehaviorSubject; private modalHeader: BehaviorSubject; private settings$: BehaviorSubject; - loginInfoSub: Subscription; + private loginInfoSub: Subscription; private settingsSub: Subscription; private capacityDisabled: boolean; @@ -145,11 +145,11 @@ import { private router: Router) { this.formGroup = this.fb.group({ - capacityDisabled: ['', []], - directorViewDisabled: ['', []], - applicantsLoginDisabled: ['', []], - applicantsResultsDisabled: ['', []], - secondPeriodEnabled: ['', []], + capacityDisabled: ["", []], + directorViewDisabled: ["", []], + applicantsLoginDisabled: ["", []], + applicantsResultsDisabled: ["", []], + secondPeriodEnabled: ["", []], }); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); @@ -161,46 +161,44 @@ import { } public showModal(): void { - ($('#configNotice')).modal('show'); + ($("#configNotice")).modal("show"); } public hideModal(): void { - ($('#configNotice')).modal('hide'); + ($("#configNotice")).modal("hide"); } public onHidden(): void { - //this.isModalShown.next(false); + // this.isModalShown.next(false); } ngOnDestroy() { - ($('#configNotice')).remove(); + ($("#configNotice")).remove(); if (this.loginInfoSub) this.loginInfoSub.unsubscribe(); if (this.settingsSub) this.settingsSub.unsubscribe(); - if (this.loginInfo$) - this.loginInfo$.unsubscribe(); - if (this.settings$) - this.settings$.unsubscribe(); } ngOnInit() { - ($('#configNotice')).appendTo("body"); - - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({}, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); + ($("#configNotice")).appendTo("body"); + + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({}, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); this.retrieveSettings(); @@ -212,11 +210,11 @@ import { this.settingsSub = this._hds.retrieveAdminSettings(this.minedu_userName, this.minedu_userPassword).subscribe(data => { this.settings$.next(data); - this.capacityDisabled = Boolean(Number(this.settings$.value['capacityDisabled'])); - this.directorViewDisabled = Boolean(Number(this.settings$.value['directorViewDisabled'])); - this.applicantsLoginDisabled = Boolean(Number(this.settings$.value['applicantsLoginDisabled'])); - this.applicantsResultsDisabled = Boolean(Number(this.settings$.value['applicantsResultsDisabled'])); - this.secondPeriodEnabled = Boolean(Number(this.settings$.value['secondPeriodEnabled'])); + this.capacityDisabled = Boolean(Number(this.settings$.value["capacityDisabled"])); + this.directorViewDisabled = Boolean(Number(this.settings$.value["directorViewDisabled"])); + this.applicantsLoginDisabled = Boolean(Number(this.settings$.value["applicantsLoginDisabled"])); + this.applicantsResultsDisabled = Boolean(Number(this.settings$.value["applicantsResultsDisabled"])); + this.secondPeriodEnabled = Boolean(Number(this.settings$.value["secondPeriodEnabled"])); this.dataRetrieved = 1; }, diff --git a/source/components/minister/minister-view.ts b/source/components/minister/minister-view.ts index dfa17ff0354e294f42b8668d33e6c4c685a45c58..17d6fb34a2f8dc7c6477a489bc2a4a556525ecf4 100644 --- a/source/components/minister/minister-view.ts +++ b/source/components/minister/minister-view.ts @@ -1,29 +1,24 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { HelperDataService } from '../../services/helper-data-service'; +import { AppSettings } from "../../app.settings"; +import { HelperDataService } from "../../services/helper-data-service"; import { Observable} from "rxjs/Observable"; -import { Http, Headers, RequestOptions} from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -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 { Http, Headers, RequestOptions} from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +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 { API_ENDPOINT } from '../../app.settings'; +import { API_ENDPOINT } from "../../app.settings"; @Component({ - selector: 'minister-view', + selector: "minister-view", template: `
>Κατανομή
-
@@ -100,8 +95,7 @@ import { API_ENDPOINT } from '../../app.settings'; @Injectable() export default class MinisterView implements OnInit, OnDestroy { - //public formGroup: FormGroup; - loginInfo$: BehaviorSubject; + private loginInfo$: BehaviorSubject; private modalTitle: BehaviorSubject; private modalText: BehaviorSubject; private modalHeader: BehaviorSubject; @@ -123,145 +117,143 @@ import { API_ENDPOINT } from '../../app.settings'; private _hds: HelperDataService, private activatedRoute: ActivatedRoute, private router: Router) { - this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); - this.modalTitle = new BehaviorSubject(""); - this.modalText = new BehaviorSubject(""); - this.modalHeader = new BehaviorSubject(""); - this.settings$ = new BehaviorSubject([{}]); + 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 { - ($(popupMsgId)).modal('show'); + public showModal(popupMsgId): void { + ($(popupMsgId)).modal("show"); } - public hideModal(popupMsgId):void { - ($(popupMsgId)).modal('hide'); + public hideModal(popupMsgId): void { + ($(popupMsgId)).modal("hide"); } - public onHidden(popupMsgId):void { + public onHidden(popupMsgId): void { } ngOnDestroy() { - ($('#distributionWaitingNotice')).remove(); - ($('#distributionNotice')).remove(); - if (this.loginInfoSub) - this.loginInfoSub.unsubscribe(); - if (this.settingsSub) - this.settingsSub.unsubscribe(); - if (this.loginInfo$) - this.loginInfo$.unsubscribe(); - if (this.settings$) - this.settings$.unsubscribe(); + ($("#distributionWaitingNotice")).remove(); + ($("#distributionNotice")).remove(); + if (this.loginInfoSub) + this.loginInfoSub.unsubscribe(); + if (this.settingsSub) + this.settingsSub.unsubscribe(); } ngOnInit() { - ($('#distributionWaitingNotice')).appendTo("body"); - ($('#distributionNotice')).appendTo("body"); - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({}, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); - - this.retrieveSettings(); + ($("#distributionWaitingNotice")).appendTo("body"); + ($("#distributionNotice")).appendTo("body"); + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({}, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); + + this.retrieveSettings(); } runDistribution() { - this.distStatus = "STARTED"; - this.showModal("#distributionWaitingNotice"); - this._hds.makeDistribution(this.minedu_userName, this.minedu_userPassword) - .then(msg => { - this.modalTitle.next("Κατανομή Μαθητών"); - this.modalText.next("Η κατανομή ολοκληρώθηκε με επιτυχία!"); - this.modalHeader.next("modal-header-success"); - this.showModal("#distributionNotice"); - - if (this.distStatus !== "ERROR") - this.distStatus = "FINISHED"; - }) - .catch(err => { - console.log(err); - this.distStatus = "ERROR"; - - this.modalTitle.next("Κατανομή Μαθητών"); - this.modalText.next("Αποτυχία κατανομής. Προσπαθήστε ξανά. Σε περίπτωση που το πρόβλημα παραμένει, παρακαλώ επικοινωνήστε με το διαχειριστή του συστήματος."); - this.modalHeader.next("modal-header-danger"); - this.showModal("#distributionNotice"); - }); + this.distStatus = "STARTED"; + this.showModal("#distributionWaitingNotice"); + this._hds.makeDistribution(this.minedu_userName, this.minedu_userPassword) + .then(msg => { + this.modalTitle.next("Κατανομή Μαθητών"); + this.modalText.next("Η κατανομή ολοκληρώθηκε με επιτυχία!"); + this.modalHeader.next("modal-header-success"); + this.showModal("#distributionNotice"); + + if (this.distStatus !== "ERROR") + this.distStatus = "FINISHED"; + }) + .catch(err => { + console.log(err); + this.distStatus = "ERROR"; + + this.modalTitle.next("Κατανομή Μαθητών"); + this.modalText.next("Αποτυχία κατανομής. Προσπαθήστε ξανά. Σε περίπτωση που το πρόβλημα παραμένει, παρακαλώ επικοινωνήστε με το διαχειριστή του συστήματος."); + this.modalHeader.next("modal-header-danger"); + this.showModal("#distributionNotice"); + }); } runDistributionSecondPeriod() { - this.distStatus = "STARTED"; + this.distStatus = "STARTED"; - this.showModal("#distributionWaitingNotice"); + this.showModal("#distributionWaitingNotice"); - this._hds.makeDistributionSecondPeriod(this.minedu_userName, this.minedu_userPassword) - .then(msg => { - this.modalTitle.next("Τοποθέτηση Μαθητών 2ης Περιόδου Αιτήσεων"); - this.modalText.next("Η τοποθέτηση μαθητών της δεύτερης περιόδου αιτήσεων ολοκληρώθηκε με επιτυχία!"); - this.modalHeader.next("modal-header-success"); - this.showModal("#distributionNotice"); + this._hds.makeDistributionSecondPeriod(this.minedu_userName, this.minedu_userPassword) + .then(msg => { + this.modalTitle.next("Τοποθέτηση Μαθητών 2ης Περιόδου Αιτήσεων"); + this.modalText.next("Η τοποθέτηση μαθητών της δεύτερης περιόδου αιτήσεων ολοκληρώθηκε με επιτυχία!"); + this.modalHeader.next("modal-header-success"); + this.showModal("#distributionNotice"); - if (this.distStatus !== "ERROR") - this.distStatus = "FINISHED"; - }) - .catch(err => { - console.log(err); - this.distStatus = "ERROR"; + if (this.distStatus !== "ERROR") + this.distStatus = "FINISHED"; + }) + .catch(err => { + console.log(err); + this.distStatus = "ERROR"; - this.modalTitle.next("Τοποθέτηση Μαθητών 2ης Περιόδου Αιτήσεων"); - this.modalText.next("Αποτυχία τοποθέτησης. Προσπαθήστε ξανά. Σε περίπτωση που το πρόβλημα παραμένει, παρακαλώ επικοινωνήστε με το διαχειριστή του συστήματος."); - this.modalHeader.next("modal-header-danger"); - this.showModal("#distributionNotice"); - }); + this.modalTitle.next("Τοποθέτηση Μαθητών 2ης Περιόδου Αιτήσεων"); + this.modalText.next("Αποτυχία τοποθέτησης. Προσπαθήστε ξανά. Σε περίπτωση που το πρόβλημα παραμένει, παρακαλώ επικοινωνήστε με το διαχειριστή του συστήματος."); + this.modalHeader.next("modal-header-danger"); + this.showModal("#distributionNotice"); + }); } - retrieveSettings() { - - this.settingsSub = this._hds.retrieveAdminSettings(this.minedu_userName, this.minedu_userPassword).subscribe(data => { - this.settings$.next(data); - this.capacityDisabled = Boolean(Number(this.settings$.value['capacityDisabled'])); - this.directorViewDisabled = Boolean(Number(this.settings$.value['directorViewDisabled'])); - this.applicantsResultsDisabled = Boolean(Number(this.settings$.value['applicantsResultsDisabled'])); - - this.secondPeriodEnabled = Boolean(Number(this.settings$.value['secondPeriodEnabled'])); - - if (this.capacityDisabled == false) { - this.modalTitle.next("Κατανομή Μαθητών"); - this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να εκτελέσετε την κατανομή, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΑΠΕΝΕΡΓΟΠΟΙΗΣΤΕ ") + - ("τη δυνατότητα των Διευθυντών να τροποποιούν τη χωρητικότητα του σχολείου τους.") ); - this.modalHeader.next("modal-header-warning"); - this.showModal("#distributionNotice"); - } - else if (this.directorViewDisabled == false) { - this.modalTitle.next("Κατανομή Μαθητών"); - this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να εκτελέσετε την κατανομή, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΑΠΕΝΕΡΓΟΠΟΙΗΣΤΕ ") + - ("τη δυνατότητα των Διευθυντών της προβολής κατανομής των μαθητών του σχολείου τους.") ); - this.modalHeader.next("modal-header-warning"); - this.showModal("#distributionNotice"); - } - else if (this.applicantsResultsDisabled == false) { - this.modalTitle.next("Κατανομή Μαθητών"); - this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να εκτελέσετε την κατανομή, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΑΠΕΝΕΡΓΟΠΟΙΗΣΤΕ ") + - ("τη δυνατότητα της προβολής αποτελεσμάτων κατανομής από τους μαθητές.") ); - this.modalHeader.next("modal-header-warning"); - this.showModal("#distributionNotice"); - } - }, - error => { - this.settings$.next([{}]); - console.log("Error Getting MinisterRetrieveSettings"); - }); + retrieveSettings() { + + this.settingsSub = this._hds.retrieveAdminSettings(this.minedu_userName, this.minedu_userPassword).subscribe(data => { + this.settings$.next(data); + this.capacityDisabled = Boolean(Number(this.settings$.value["capacityDisabled"])); + this.directorViewDisabled = Boolean(Number(this.settings$.value["directorViewDisabled"])); + this.applicantsResultsDisabled = Boolean(Number(this.settings$.value["applicantsResultsDisabled"])); + + this.secondPeriodEnabled = Boolean(Number(this.settings$.value["secondPeriodEnabled"])); + + if (this.capacityDisabled === false) { + this.modalTitle.next("Κατανομή Μαθητών"); + this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να εκτελέσετε την κατανομή, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΑΠΕΝΕΡΓΟΠΟΙΗΣΤΕ ") + + ("τη δυνατότητα των Διευθυντών να τροποποιούν τη χωρητικότητα του σχολείου τους.")); + this.modalHeader.next("modal-header-warning"); + this.showModal("#distributionNotice"); + } + else if (this.directorViewDisabled === false) { + this.modalTitle.next("Κατανομή Μαθητών"); + this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να εκτελέσετε την κατανομή, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΑΠΕΝΕΡΓΟΠΟΙΗΣΤΕ ") + + ("τη δυνατότητα των Διευθυντών της προβολής κατανομής των μαθητών του σχολείου τους.")); + this.modalHeader.next("modal-header-warning"); + this.showModal("#distributionNotice"); + } + else if (this.applicantsResultsDisabled === false) { + this.modalTitle.next("Κατανομή Μαθητών"); + this.modalText.next(("ΠΡΟΣΟΧΗ: Για να μπορείτε να εκτελέσετε την κατανομή, παρακαλώ πηγαίνετε στις Ρυθμίσεις και ΑΠΕΝΕΡΓΟΠΟΙΗΣΤΕ ") + + ("τη δυνατότητα της προβολής αποτελεσμάτων κατανομής από τους μαθητές.")); + this.modalHeader.next("modal-header-warning"); + this.showModal("#distributionNotice"); + } + }, + error => { + this.settings$.next([{}]); + console.log("Error Getting MinisterRetrieveSettings"); + }); } } diff --git a/source/components/minister/report-all-stat.ts b/source/components/minister/report-all-stat.ts index b39caef1c2a973aca12323d625d00e6a67f94432..20ec26ea4aa34f51168be8f39e2ef68f7b5c0842 100644 --- a/source/components/minister/report-all-stat.ts +++ b/source/components/minister/report-all-stat.ts @@ -1,20 +1,20 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild, Input } from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { HelperDataService } from '../../services/helper-data-service'; +import { AppSettings } from "../../app.settings"; +import { HelperDataService } from "../../services/helper-data-service"; import { Observable} from "rxjs/Observable"; -import { Http, Headers, RequestOptions} from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -import { Router, ActivatedRoute, Params} from '@angular/router'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -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 { DIDE_ROLE, PDE_ROLE, MINISTRY_ROLE } from '../../constants'; -import {csvCreator} from './csv-creator'; -import {chartCreator} from './chart-creator'; +import { Http, Headers, RequestOptions} from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +import { Router, ActivatedRoute, Params} from "@angular/router"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +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 { DIDE_ROLE, PDE_ROLE, MINISTRY_ROLE } from "../../constants"; +import {CsvCreator} from "./csv-creator"; +import {ChartCreator} from "./chart-creator"; import { FormBuilder, @@ -22,20 +22,20 @@ import { FormControl, FormArray, Validators, -} from '@angular/forms'; +} from "@angular/forms"; -import { API_ENDPOINT } from '../../app.settings'; +import { API_ENDPOINT } from "../../app.settings"; @Component({ - selector: 'report-all-stat', + selector: "report-all-stat", template: `
+ class = "loading" *ngIf="validCreator === 0" >
@@ -44,22 +44,22 @@ import { API_ENDPOINT } from '../../app.settings';
- -
- - @@ -72,7 +72,7 @@ import { API_ENDPOINT } from '../../app.settings';
-
+
@@ -89,49 +89,49 @@ import { API_ENDPOINT } from '../../app.settings';
- -
- -

- -

-
+
- - -
+





@@ -142,9 +142,9 @@ import { API_ENDPOINT } from '../../app.settings'; @Injectable() export default class ReportAllStat implements OnInit, OnDestroy { - public formGroup: FormGroup; - loginInfo$: BehaviorSubject; - loginInfoSub: Subscription; + private formGroup: FormGroup; + private loginInfo$: BehaviorSubject; + private loginInfoSub: Subscription; private generalReport$: BehaviorSubject; private RegionSelections$: BehaviorSubject; private AdminAreaSelections$: BehaviorSubject; @@ -163,7 +163,7 @@ import { API_ENDPOINT } from '../../app.settings'; private minedu_userName: string; private minedu_userPassword: string; private distStatus = "READY"; - private data; + private data: any; private validCreator: number; private reportId: number; private source: LocalDataSource; @@ -183,18 +183,18 @@ import { API_ENDPOINT } from '../../app.settings'; columnMap: Map = new Map(); @Input() settings: any; - private reportSchema = new reportsSchema(); + private reportSchema = new ReportsSchema(); - //csvObj:csvCreator ; - private csvObj = new csvCreator(); + // csvObj:CsvCreator ; + private csvObj = new CsvCreator(); private createGraph: boolean; - //d3 creator - private chartObj = new chartCreator(); - @ViewChild('chart') public chartContainer: ElementRef; + // d3 creator + private chartObj = new ChartCreator(); + @ViewChild("chart") public chartContainer: ElementRef; private d3data: Array; - //private repid: number; + // private repid: number; private routerSub: any; constructor(private fb: FormBuilder, @@ -204,12 +204,12 @@ import { API_ENDPOINT } from '../../app.settings'; private router: Router) { this.formGroup = this.fb.group({ - region: ['', []], - adminarea: ['', []], - schoollist: ['', []], - classid: ['', []], - sector: ['', []], - course: ['', []], + region: ["", []], + adminarea: ["", []], + schoollist: ["", []], + classid: ["", []], + sector: ["", []], + course: ["", []], }); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); @@ -220,7 +220,7 @@ import { API_ENDPOINT } from '../../app.settings'; this.SectorSelections$ = new BehaviorSubject([{}]); this.CourseSelections$ = new BehaviorSubject([{}]); this.RegionRetrieve$ = new BehaviorSubject([{}]); - this.minedu_userName = ''; + this.minedu_userName = ""; this.validCreator = -1; this.showAdminList = new BehaviorSubject(false); this.showSectorList = new BehaviorSubject(false); @@ -239,49 +239,51 @@ import { API_ENDPOINT } from '../../app.settings'; ngOnInit() { - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({}, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - - this.userLoggedIn = loginInfoToken.auth_role; - if (loginInfoToken.auth_role == PDE_ROLE || loginInfoToken.auth_role == DIDE_ROLE) { - let regId = -1; - this.minedu_userName = loginInfoToken.auth_token; - this.minedu_userPassword = loginInfoToken.auth_token; - if (loginInfoToken.auth_role == PDE_ROLE || loginInfoToken.auth_role == DIDE_ROLE) { - - this.RegionRetrieveSub = this._hds.getUserRegistryNo(this.minedu_userName, this.minedu_userPassword).subscribe(data => { - this.RegionRetrieve$.next(data); - this.data = data; - regId = this.data['id']; - - if (loginInfoToken.auth_role == PDE_ROLE) { - this.regionSelected = regId; - this.showAdminList.next(true); - - this.checkregion(this.regionSelected); - } - else if (loginInfoToken.auth_role == DIDE_ROLE) { - this.adminAreaSelected = regId; - this.showAdminList.next(false); - this.checkadminarea(this.adminAreaSelected); - } - }, - error => { - this.RegionRetrieve$.next([{}]); - }); + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({}, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + + this.userLoggedIn = loginInfoToken.auth_role; + if (loginInfoToken.auth_role === PDE_ROLE || loginInfoToken.auth_role === DIDE_ROLE) { + let regId = -1; + this.minedu_userName = loginInfoToken.auth_token; + this.minedu_userPassword = loginInfoToken.auth_token; + if (loginInfoToken.auth_role === PDE_ROLE || loginInfoToken.auth_role === DIDE_ROLE) { + + this.RegionRetrieveSub = this._hds.getUserRegistryNo(this.minedu_userName, this.minedu_userPassword).subscribe(data => { + this.RegionRetrieve$.next(data); + this.data = data; + regId = this.data["id"]; + + if (loginInfoToken.auth_role === PDE_ROLE) { + this.regionSelected = regId; + this.showAdminList.next(true); + + this.checkregion(this.regionSelected); + } + else if (loginInfoToken.auth_role === DIDE_ROLE) { + this.adminAreaSelected = regId; + this.showAdminList.next(false); + this.checkadminarea(this.adminAreaSelected); + } + }, + error => { + this.RegionRetrieve$.next([{}]); + }); + } } - } - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); this.routerSub = this.activatedRoute.params.subscribe(params => { - this.reportId = +params['reportId']; + this.reportId = +params["reportId"]; }); @@ -305,31 +307,8 @@ import { API_ENDPOINT } from '../../app.settings'; this.SectorSelectionsSub.unsubscribe(); if (this.CourseSelectionsSub) this.CourseSelectionsSub.unsubscribe(); - - if (this.loginInfo$) - this.loginInfo$.unsubscribe(); - if (this.generalReport$) - this.generalReport$.unsubscribe(); - if (this.RegionSelections$) - this.RegionSelections$.unsubscribe(); - if (this.AdminAreaSelections$) - this.AdminAreaSelections$.unsubscribe(); - if (this.SchoolSelections$) - this.SchoolSelections$.unsubscribe(); - if (this.SectorSelections$) - this.SectorSelections$.unsubscribe(); - if (this.CourseSelections$) - this.CourseSelections$.unsubscribe(); - if (this.showAdminList) - this.showAdminList.unsubscribe(); - if (this.showSectorList) - this.showSectorList.unsubscribe(); - if (this.showCourseList) - this.showCourseList.unsubscribe(); if (this.RegionRetrieveSub) this.RegionRetrieveSub.unsubscribe(); - if (this.RegionRetrieve$) - this.RegionRetrieve$.unsubscribe(); } @@ -361,8 +340,8 @@ import { API_ENDPOINT } from '../../app.settings'; let regSel = 0, admSel = 0, schSel = 0; if (this.enableRegionFilter) { - //if (regionSel.value != 0) - //regSel = regionSel.value; + // if (regionSel.value !== 0) + // regSel = regionSel.value; regSel = this.regionSelected; admSel = this.adminAreaSelected; schSel = this.schSelected; @@ -375,10 +354,10 @@ import { API_ENDPOINT } from '../../app.settings'; courSel = this.courseSelected; } - if (this.userLoggedIn == PDE_ROLE) { + if (this.userLoggedIn === PDE_ROLE) { regSel = this.regionSelected; } - else if (this.userLoggedIn == DIDE_ROLE) + else if (this.userLoggedIn === DIDE_ROLE) admSel = this.adminAreaSelected; this.generalReportSub = this._hds.makeReport(this.minedu_userName, this.minedu_userPassword, route, regSel, admSel, schSel, clSel, secSel, courSel, this.distribFinalized).subscribe(data => { @@ -398,11 +377,11 @@ import { API_ENDPOINT } from '../../app.settings'; this.source = new LocalDataSource(this.data); this.columnMap = new Map(); - //pass parametes to csv class object + // pass parametes to csv class object this.csvObj.columnMap = this.columnMap; this.csvObj.source = this.source; this.csvObj.settings = this.settings; - //this.prepareColumnMap(); + // this.prepareColumnMap(); this.csvObj.prepareColumnMap(); }, error => { @@ -413,7 +392,7 @@ import { API_ENDPOINT } from '../../app.settings'; } navigateBack() { - this.router.navigate(['/ministry/minister-reports']); + this.router.navigate(["/ministry/minister-reports"]); } showFilters() { @@ -441,7 +420,7 @@ import { API_ENDPOINT } from '../../app.settings'; checkregion(regionId) { - if (typeof regionId.value != "undefined") + if (typeof regionId.value !== "undefined") this.regionSelected = regionId.value; this.adminAreaSelected = 0; this.schSelected = 0; @@ -469,7 +448,7 @@ import { API_ENDPOINT } from '../../app.settings'; this.schSelected = 0; - if (typeof adminId.value != "undefined") + if (typeof adminId.value !== "undefined") this.adminAreaSelected = adminId.value; this.SchoolSelectionsSub = this._hds.getSchoolsPerAdminArea(this.minedu_userName, this.minedu_userPassword, this.adminAreaSelected).subscribe(data => { this.SchoolSelections$.next(data); @@ -498,7 +477,7 @@ import { API_ENDPOINT } from '../../app.settings'; this.sectorSelected = 0; this.courseSelected = 0; - if (this.classSelected == 2 || this.classSelected == 3 || this.classSelected == 4) { + if (this.classSelected === 2 || this.classSelected === 3 || this.classSelected === 4) { this.SectorSelectionsSub = this._hds.getSectors(this.minedu_userName, this.minedu_userPassword, this.classSelected).subscribe(data => { this.SectorSelections$.next(data); this.showSectorList.next(true); @@ -507,7 +486,7 @@ import { API_ENDPOINT } from '../../app.settings'; this.SectorSelections$.next([{}]); console.log("Error Getting SectorSelections"); }); - } //end if + } // end if } @@ -535,7 +514,7 @@ import { API_ENDPOINT } from '../../app.settings'; - onSearch(query: string = '') { + onSearch(query: string = "") { this.csvObj.onSearch(query); } diff --git a/source/components/minister/report-general.ts b/source/components/minister/report-general.ts index af383fa02f144bbab57764091c6663e3bdeff3da..555e5e7a9f7a98628cddf79866222fc1dfcbc1d7 100644 --- a/source/components/minister/report-general.ts +++ b/source/components/minister/report-general.ts @@ -10,10 +10,10 @@ import { Router, ActivatedRoute, Params } from "@angular/router"; import { BehaviorSubject, Subscription } from "rxjs/Rx"; import { ILoginInfo } from "../../store/logininfo/logininfo.types"; import { Ng2SmartTableModule, LocalDataSource } from "ng2-smart-table"; -import { reportsSchema, TableColumn } from "./reports-schema"; +import { ReportsSchema, TableColumn } from "./reports-schema"; import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state"; -import { csvCreator } from "./csv-creator"; -import { chartCreator } from "./chart-creator"; +import { CsvCreator } from "./csv-creator"; +import { ChartCreator } from "./chart-creator"; import { FormBuilder, @@ -76,26 +76,26 @@ import { API_ENDPOINT } from "../../app.settings"; @Injectable() export default class ReportGeneral implements OnInit, OnDestroy { - public formGroup: FormGroup; - loginInfo$: BehaviorSubject; - loginInfoSub: Subscription; + private formGroup: FormGroup; + private loginInfo$: BehaviorSubject; + private loginInfoSub: Subscription; private generalReport$: BehaviorSubject; private generalReportSub: Subscription; private apiEndPoint = API_ENDPOINT; private minedu_userName: string; private minedu_userPassword: string; private distStatus = "READY"; - private data; + private data: any; private validCreator: number; private createGraph: boolean; private source: LocalDataSource; columnMap: Map = new Map(); @Input() settings: any; - private reportSchema = new reportsSchema(); - private csvObj = new csvCreator(); + private reportSchema = new ReportsSchema(); + private csvObj = new CsvCreator(); - private chartObj = new chartCreator(); + private chartObj = new ChartCreator(); @ViewChild("chart") public chartContainer: ElementRef; private d3data: Array; @@ -122,16 +122,18 @@ import { API_ENDPOINT } from "../../app.settings"; ngOnInit() { - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({ }, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({ }, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); } @@ -141,10 +143,6 @@ import { API_ENDPOINT } from "../../app.settings"; this.loginInfoSub.unsubscribe(); if (this.generalReportSub) this.generalReportSub.unsubscribe(); - if (this.loginInfo$) - this.loginInfo$.unsubscribe(); - if (this.generalReport$) - this.generalReport$.unsubscribe(); } diff --git a/source/components/minister/report-no-capacity.ts b/source/components/minister/report-no-capacity.ts index 7e91e67d176e43485ea92800e76eb03c3051e438..d81db3a883fac17215192d64e16bdba68ae63886 100644 --- a/source/components/minister/report-no-capacity.ts +++ b/source/components/minister/report-no-capacity.ts @@ -1,19 +1,19 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild, Input } from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { HelperDataService } from '../../services/helper-data-service'; +import { AppSettings } from "../../app.settings"; +import { HelperDataService } from "../../services/helper-data-service"; import { Observable} from "rxjs/Observable"; -import { Http, Headers, RequestOptions} from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -import { Router, ActivatedRoute, Params} from '@angular/router'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -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 {csvCreator} from './csv-creator'; -import {chartCreator} from './chart-creator'; +import { Http, Headers, RequestOptions} from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +import { Router, ActivatedRoute, Params} from "@angular/router"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +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 {CsvCreator} from "./csv-creator"; +import {ChartCreator} from "./chart-creator"; import { FormBuilder, @@ -21,13 +21,13 @@ import { FormControl, FormArray, Validators, -} from '@angular/forms'; +} from "@angular/forms"; -import { API_ENDPOINT } from '../../app.settings'; +import { API_ENDPOINT } from "../../app.settings"; @Component({ - selector: 'report-no-capacity', + selector: "report-no-capacity", template: `
@@ -77,9 +77,9 @@ import { API_ENDPOINT } from '../../app.settings'; @Injectable() export default class ReportNoCapacity implements OnInit, OnDestroy { - public formGroup: FormGroup; - loginInfo$: BehaviorSubject; - loginInfoSub: Subscription; + private formGroup: FormGroup; + private loginInfo$: BehaviorSubject; + private loginInfoSub: Subscription; private generalReport$: BehaviorSubject; private generalReportSub: Subscription; private apiEndPoint = API_ENDPOINT; @@ -95,11 +95,11 @@ import { API_ENDPOINT } from '../../app.settings'; private source: LocalDataSource; columnMap: Map = new Map(); @Input() settings: any; - private reportSchema = new reportsSchema(); - private csvObj = new csvCreator(); + private reportSchema = new ReportsSchema(); + private csvObj = new CsvCreator(); - private chartObj = new chartCreator(); - @ViewChild('chart') public chartContainer: ElementRef; + private chartObj = new ChartCreator(); + @ViewChild("chart") public chartContainer: ElementRef; private d3data: Array; @@ -110,12 +110,12 @@ import { API_ENDPOINT } from '../../app.settings'; private router: Router) { this.formGroup = this.fb.group({ - capacityEnabled: ['', []], + capacityEnabled: ["", []], }); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); this.generalReport$ = new BehaviorSubject([{}]); - this.minedu_userName = ''; + this.minedu_userName = ""; this.validCreator = -1; this.enableCapacityFilter = false; @@ -123,19 +123,21 @@ import { API_ENDPOINT } from '../../app.settings'; ngOnInit() { - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({}, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({}, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); this.routerSub = this.activatedRoute.params.subscribe(params => { - this.reportId = +params['reportId']; + this.reportId = +params["reportId"]; }); @@ -147,11 +149,6 @@ import { API_ENDPOINT } from '../../app.settings'; this.loginInfoSub.unsubscribe(); if (this.generalReportSub) this.generalReportSub.unsubscribe(); - if (this.loginInfo$) - this.loginInfo$.unsubscribe(); - if (this.generalReport$) - this.generalReport$.unsubscribe(); - } @@ -174,7 +171,7 @@ import { API_ENDPOINT } from '../../app.settings'; this.source = new LocalDataSource(this.data); this.columnMap = new Map(); - //pass parametes to csv class object + // pass parametes to csv class object this.csvObj.columnMap = this.columnMap; this.csvObj.source = this.source; this.csvObj.settings = this.settings; @@ -195,11 +192,11 @@ import { API_ENDPOINT } from '../../app.settings'; } navigateBack() { - this.router.navigate(['/ministry/minister-reports']); + this.router.navigate(["/ministry/minister-reports"]); } - onSearch(query: string = '') { + onSearch(query: string = "") { this.csvObj.onSearch(query); } diff --git a/source/components/minister/report-users.ts b/source/components/minister/report-users.ts index fec24c4cfb10afdcc5fc87b89571fec9c258c4f6..906a3f6b15e0197dd6fc24ed71d9f07a90db1d9f 100644 --- a/source/components/minister/report-users.ts +++ b/source/components/minister/report-users.ts @@ -10,9 +10,9 @@ import { Router, ActivatedRoute, Params} from "@angular/router"; import { BehaviorSubject, Subscription } from "rxjs/Rx"; import { ILoginInfo } from "../../store/logininfo/logininfo.types"; import { Ng2SmartTableModule, LocalDataSource } from "ng2-smart-table"; -import {reportsSchema, TableColumn} from "./reports-schema"; +import {ReportsSchema, TableColumn} from "./reports-schema"; import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state"; -import {csvCreator} from "./csv-creator"; +import {CsvCreator} from "./csv-creator"; import { API_ENDPOINT } from "../../app.settings"; @@ -72,8 +72,8 @@ import { API_ENDPOINT } from "../../app.settings"; private source: LocalDataSource; columnMap: Map = new Map(); @Input() settings: any; - private reportSchema = new reportsSchema(); - private csvObj = new csvCreator(); + private reportSchema = new ReportsSchema(); + private csvObj = new CsvCreator(); constructor( private _ngRedux: NgRedux, @@ -89,16 +89,18 @@ import { API_ENDPOINT } from "../../app.settings"; ngOnInit() { - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({}, loginInfoToken) => { - this.minedu_userName = loginInfoToken.minedu_username; - this.minedu_userPassword = loginInfoToken.minedu_userpassword; - return loginInfoToken; - }, {}); - } - return state.loginInfo; - }).subscribe(this.loginInfo$); + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({}, loginInfoToken) => { + this.minedu_userName = loginInfoToken.minedu_username; + this.minedu_userPassword = loginInfoToken.minedu_userpassword; + return loginInfoToken; + }, {}); + } + this.loginInfo$.next(loginInfo); + }, error => console.log("error selecting loginInfo")); } ngOnDestroy() { diff --git a/source/components/minister/reports-schema.ts b/source/components/minister/reports-schema.ts index 61f3e3864266430416d64aebf7452db837af5944..1a43794ca770f8c4d47069c92aba4e90613a940f 100644 --- a/source/components/minister/reports-schema.ts +++ b/source/components/minister/reports-schema.ts @@ -1,195 +1,195 @@ export class TableColumn { - field: string; - title: string; - type: string; - isDisplay: boolean; - isExport: boolean; - valuePrepareFunction: Function; + field: string; + title: string; + type: string; + isDisplay: boolean; + isExport: boolean; + valuePrepareFunction: Function; } -export class reportsSchema { - - /* - defaultSettings = { - actions: { - columnTitle: 'Actions', - add: false, - edit: false, - delete: false - }, - pager: { - display: true, - perPage: 50 - } - }; - */ - ReportUsersSchema = { - actions: false, - noDataMessage: 'Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης', - columns: { - name: { - title: 'Περιγραφή', - filter: false +export class ReportsSchema { + + /* + defaultSettings = { + actions: { + columnTitle: "Actions", + add: false, + edit: false, + delete: false }, - numStudents: { - title: 'Αριθμός', - filter: false + pager: { + display: true, + perPage: 50 } - } - }; - -genReportSchema = { - actions: false, - noDataMessage: 'Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης', - columns: { - name: { - title: 'Κατηγορία', - filter: false - }, - numStudents: { - title: 'Αριθμός', - filter: false - } - } -}; - -reportAllStatSchema = { - actions: false, - pager : { - display : true, - perPage:10 - }, - noDataMessage: 'Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης', - columns: { - name: { - title: 'Σχολείο', - width: '18%', - filter: false - }, - region: { - title: 'Περιφερειακή Διεύθυνση', - width: '15%', - filter: false - }, - admin: { - title: 'Διεύθυνση Εκπαίδευσης', - width: '15%', - filter: false - }, - section: { - title: 'Τάξη/Τομέας/Ειδικότητα', - width: '18%', - filter: false - }, - num: { - title: 'Αριθμός Μαθητών', - width: '8%', - filter: false - }, - capacity: { - title: 'Χωρ/κα', - width: '8%', - filter: false - }, - percentage: { - title: 'Ποσοστό (%)', - width: '8%', - filter: false - } - } -}; - - - - -reportNoCapacity = { - actions: false, - pager : { - display : true, - perPage:10 - }, - noDataMessage: 'Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης', - columns: { - name: { - title: 'Σχολείο', - width: '22%', - filter: false - }, - region: { - title: 'Περιφερειακή Διεύθυνση', - width: '20%', - filter: false - }, - admin: { - title: 'Διεύθυνση Εκπαίδευσης', - width: '20%', - filter: false - }, - section: { - title: 'Τάξη/Τομέας/Ειδικότητα', - width: '22%', - filter: false - }, - capacity: { - title: 'Χωρητικότητα', - width: '15%', - filter: false - } - } -}; - - - - -reportCompletenessSchema = { - actions: false, - noDataMessage: 'Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης', - columns: { - name: { - title: 'Σχολείο', - width: '15%', - filter: false - }, - region: { - title: 'ΠΔΕ', - width: '10%', - filter: false - }, - admin: { - title: 'ΔΙΔΕ', - width: '10%', - filter: false - }, - percTotal: { - title: '% Σχολείου', - width: '10%', - filter: false - }, - percA: { - title: '% Α\' τάξης', - width: '10%', - filter: false - }, - percB: { - title: '% Β\' τάξης', - width: '10%', - filter: false - }, - percC: { - title: '% Γ\' τάξης', - width: '10%', - filter: false - }, - percD: { - title: '% Δ\' τάξης', - width: '10%', - filter: false - } - } -}; - - -constructor() {} + }; + */ + ReportUsersSchema = { + actions: false, + noDataMessage: "Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης", + columns: { + name: { + title: "Περιγραφή", + filter: false + }, + numStudents: { + title: "Αριθμός", + filter: false + } + } + }; + + genReportSchema = { + actions: false, + noDataMessage: "Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης", + columns: { + name: { + title: "Κατηγορία", + filter: false + }, + numStudents: { + title: "Αριθμός", + filter: false + } + } + }; + + reportAllStatSchema = { + actions: false, + pager: { + display: true, + perPage: 10 + }, + noDataMessage: "Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης", + columns: { + name: { + title: "Σχολείο", + width: "18%", + filter: false + }, + region: { + title: "Περιφερειακή Διεύθυνση", + width: "15%", + filter: false + }, + admin: { + title: "Διεύθυνση Εκπαίδευσης", + width: "15%", + filter: false + }, + section: { + title: "Τάξη/Τομέας/Ειδικότητα", + width: "18%", + filter: false + }, + num: { + title: "Αριθμός Μαθητών", + width: "8%", + filter: false + }, + capacity: { + title: "Χωρ/κα", + width: "8%", + filter: false + }, + percentage: { + title: "Ποσοστό (%)", + width: "8%", + filter: false + } + } + }; + + + + + reportNoCapacity = { + actions: false, + pager: { + display: true, + perPage: 10 + }, + noDataMessage: "Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης", + columns: { + name: { + title: "Σχολείο", + width: "22%", + filter: false + }, + region: { + title: "Περιφερειακή Διεύθυνση", + width: "20%", + filter: false + }, + admin: { + title: "Διεύθυνση Εκπαίδευσης", + width: "20%", + filter: false + }, + section: { + title: "Τάξη/Τομέας/Ειδικότητα", + width: "22%", + filter: false + }, + capacity: { + title: "Χωρητικότητα", + width: "15%", + filter: false + } + } + }; + + + + + reportCompletenessSchema = { + actions: false, + noDataMessage: "Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης", + columns: { + name: { + title: "Σχολείο", + width: "15%", + filter: false + }, + region: { + title: "ΠΔΕ", + width: "10%", + filter: false + }, + admin: { + title: "ΔΙΔΕ", + width: "10%", + filter: false + }, + percTotal: { + title: "% Σχολείου", + width: "10%", + filter: false + }, + percA: { + title: "% Α\" τάξης", + width: "10%", + filter: false + }, + percB: { + title: "% Β\" τάξης", + width: "10%", + filter: false + }, + percC: { + title: "% Γ\" τάξης", + width: "10%", + filter: false + }, + percD: { + title: "% Δ\" τάξης", + width: "10%", + filter: false + } + } + }; + + + constructor() { } } diff --git a/source/components/ministry.home.ts b/source/components/ministry.home.ts index 7462061cc24d89d67abcbae4be389ad8afb67577..9adcc9bc1e0c3045fc883438ddedbe6598c1fe92 100644 --- a/source/components/ministry.home.ts +++ b/source/components/ministry.home.ts @@ -1,12 +1,12 @@ -import { Router, Params} from '@angular/router'; -import { OnInit, OnDestroy, Component} from '@angular/core'; -import { LoginInfoActions } from '../actions/logininfo.actions'; -import { ILoginInfo } from '../store/logininfo/logininfo.types'; -import { NgRedux, select } from '@angular-redux/store'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -import { IAppState } from '../store/store'; -import { HelperDataService } from '../services/helper-data-service'; -import {Http, Response, RequestOptions} from '@angular/http'; +import { Router, Params} from "@angular/router"; +import { OnInit, OnDestroy, Component} from "@angular/core"; +import { LoginInfoActions } from "../actions/logininfo.actions"; +import { ILoginInfo } from "../store/logininfo/logininfo.types"; +import { NgRedux, select } from "@angular-redux/store"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +import { IAppState } from "../store/store"; +import { HelperDataService } from "../services/helper-data-service"; +import {Http, Response, RequestOptions} from "@angular/http"; import { LOGININFO_INITIAL_STATE } from "../store/logininfo/logininfo.initial-state"; import { FormBuilder, @@ -14,12 +14,12 @@ import { FormControl, FormArray, Validators -} from '@angular/forms'; +} from "@angular/forms"; -import { API_ENDPOINT } from '../app.settings'; +import { API_ENDPOINT } from "../app.settings"; @Component({ - selector: 'ministry-home', + selector: "ministry-home", template: `
@@ -59,11 +59,11 @@ import { API_ENDPOINT } from '../app.settings'; }) export default class MinistryHome implements OnInit, OnDestroy { - public userDataGroup: FormGroup; + private userDataGroup: FormGroup; private authRole: string; private mineduUsername: string; - //private mineduPassword: string; - //private cuName: string; + // private mineduPassword: string; + // private cuName: string; private validLogin: number; private loginInfo$: BehaviorSubject; private loginInfoSub: Subscription; @@ -77,38 +77,35 @@ export default class MinistryHome implements OnInit, OnDestroy { private router: Router ) { - this.mineduUsername = ''; - //this.mineduPassword = ''; - this.authRole = ''; - //this.cuName = ''; - //this.validLogin = true; + this.mineduUsername = ""; + this.authRole = ""; this.validLogin = 1; this.userDataGroup = this.fb.group({ - minedu_username: ['', [Validators.required]], - minedu_userpassword: ['', [Validators.required]], - cu_name: [''], - auth_role: [''], + minedu_username: ["", [Validators.required]], + minedu_userpassword: ["", [Validators.required]], + cu_name: [""], + auth_role: [""], }); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); }; ngOnInit() { - this.loginInfoSub = this._ngRedux.select('loginInfo') + this.loginInfoSub = this._ngRedux.select("loginInfo") .subscribe(loginInfo => { let linfo = loginInfo; if (linfo.size > 0) { linfo.reduce(({}, loginInfoToken) => { this.mineduUsername = loginInfoToken.minedu_username; - //this.mineduPassword = loginInfoToken.minedu_userpassword; + // this.mineduPassword = loginInfoToken.minedu_userpassword; if (this.mineduUsername && this.mineduUsername.length > 0) - this.router.navigate(['/ministry/minister-settings']); + this.router.navigate(["/ministry/minister-settings"]); return loginInfoToken; }, {}); } this.loginInfo$.next(linfo); - }, error => {console.log("error selecting loginInfo");}); + }, error => { console.log("error selecting loginInfo"); }); } @@ -119,20 +116,20 @@ export default class MinistryHome implements OnInit, OnDestroy { submitCredentials() { this.validLogin = -1; let success = true; - this._hds.sendMinisrtyCredentials(this.userDataGroup.value['minedu_username'],this.userDataGroup.value['minedu_userpassword']) - .catch(err => {console.log(err); success = false; this.validLogin = 0; }) - .then(msg => { - if (success) { - this.authRole = 'supervisor'; - this._hds.setMineduCurrentUser(this.userDataGroup.value['minedu_username'], this.userDataGroup.value['minedu_userpassword'], this.authRole); - - this.validLogin = 1; - this.userDataGroup.value['cu_name'] = this.userDataGroup.value['minedu_username']; - this.userDataGroup.value['auth_role'] = 'supervisor'; - this._ata.saveMinEduloginInfo([this.userDataGroup.value]); - } - }); - } + this._hds.sendMinisrtyCredentials(this.userDataGroup.value["minedu_username"], this.userDataGroup.value["minedu_userpassword"]) + .catch(err => { console.log(err); success = false; this.validLogin = 0; }) + .then(msg => { + if (success) { + this.authRole = "supervisor"; + this._hds.setMineduCurrentUser(this.userDataGroup.value["minedu_username"], this.userDataGroup.value["minedu_userpassword"], this.authRole); + + this.validLogin = 1; + this.userDataGroup.value["cu_name"] = this.userDataGroup.value["minedu_username"]; + this.userDataGroup.value["auth_role"] = "supervisor"; + this._ata.saveMinEduloginInfo([this.userDataGroup.value]); + } + }); + } diff --git a/source/components/navbar/navbar.component.html b/source/components/navbar/navbar.component.html index f9c28723d3fabfa2737ebdab70b346e23e7b222a..c8794dd428e0cb25d996cc675334205af2c25649 100644 --- a/source/components/navbar/navbar.component.html +++ b/source/components/navbar/navbar.component.html @@ -1,81 +1,81 @@ - +
+ + +
+
diff --git a/source/components/navbar/navbar.component.ts b/source/components/navbar/navbar.component.ts index 0b6d477195f59e194dc291264fcbf4c5e55ef426..bec890570a4b7fd40130b3398da3073a227d5b1b 100644 --- a/source/components/navbar/navbar.component.ts +++ b/source/components/navbar/navbar.component.ts @@ -1,62 +1,64 @@ -import {Component, OnInit, OnDestroy} from '@angular/core'; -import {Router} from '@angular/router'; +import {Component, OnInit, OnDestroy} from "@angular/core"; +import {Router} from "@angular/router"; import { Injectable } from "@angular/core"; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -import { ILoginInfo, ILoginInfoToken } from '../../store/logininfo/logininfo.types'; -import { LoginInfoActions } from '../../actions/logininfo.actions'; -import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state'; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +import { ILoginInfo, ILoginInfoToken } from "../../store/logininfo/logininfo.types"; +import { LoginInfoActions } from "../../actions/logininfo.actions"; +import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state"; @Component({ - selector: 'reg-navbar', - templateUrl: 'navbar.component.html', + selector: "reg-navbar", + templateUrl: "navbar.component.html", }) -@Injectable() export default class NavbarComponent implements OnInit, OnDestroy{ +@Injectable() export default class NavbarComponent implements OnInit, OnDestroy { private authToken: string; private authRole: string; private lockCapacity: BehaviorSubject; private lockStudents: BehaviorSubject; private cuName: string; private loginInfo$: BehaviorSubject; - public cuser :any; + private cuser: any; private loginInfoSub: Subscription; - constructor( private _ngRedux: NgRedux - ) { + constructor(private _ngRedux: NgRedux + ) { - this.authToken = ''; - this.authRole = ''; - this.lockCapacity = new BehaviorSubject(true); - this.lockStudents = new BehaviorSubject(true); - this.cuName = ''; - this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); + this.authToken = ""; + this.authRole = ""; + this.lockCapacity = new BehaviorSubject(true); + this.lockStudents = new BehaviorSubject(true); + this.cuName = ""; + this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); - }; + }; ngOnInit() { - this.loginInfoSub = this._ngRedux.select(state => { - if (state.loginInfo.size > 0) { - state.loginInfo.reduce(({}, loginInfoToken) => { - this.authToken = loginInfoToken.auth_token; - this.authRole = loginInfoToken.auth_role; - if (loginInfoToken.lock_capacity === 1) - this.lockCapacity.next(true); - else - this.lockCapacity.next(false); - if (loginInfoToken.lock_students === 1) - this.lockStudents.next(true); - else - this.lockStudents.next(false); - this.cuName = loginInfoToken.cu_name; - return loginInfoToken; - }, {}) - } + this.loginInfoSub = this._ngRedux.select("loginInfo") + .map(loginInfo => loginInfo) + .subscribe(loginInfo => { + if (loginInfo.size > 0) { + loginInfo.reduce(({}, loginInfoToken) => { + this.authToken = loginInfoToken.auth_token; + this.authRole = loginInfoToken.auth_role; + if (loginInfoToken.lock_capacity === 1) + this.lockCapacity.next(true); + else + this.lockCapacity.next(false); + if (loginInfoToken.lock_students === 1) + this.lockStudents.next(true); + else + this.lockStudents.next(false); + this.cuName = loginInfoToken.cu_name; + return loginInfoToken; + }, {}); + } - return state.loginInfo; - }).subscribe(this.loginInfo$); + this.loginInfo$.next(loginInfo); + }); } diff --git a/source/components/school.home.ts b/source/components/school.home.ts index 16c44e7b5ff1269ea1b39f6bdf2a972eb8048157..f0ad4d310bf2104dfb710367d489c586a59eb429 100644 --- a/source/components/school.home.ts +++ b/source/components/school.home.ts @@ -51,7 +51,7 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from "../app.settings"; }) export default class SchoolHome implements OnInit, OnDestroy { - public formGroup: FormGroup; + private formGroup: FormGroup; private authToken: string; private errorCode$: BehaviorSubject; private authRole: string; @@ -74,7 +74,7 @@ export default class SchoolHome implements OnInit, OnDestroy { this.authRole = ""; this.name = ""; this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); - this.errorCode$ = new BehaviorSubject(''); + this.errorCode$ = new BehaviorSubject(""); this.formGroup = this.fb.group({ }); }; @@ -87,9 +87,9 @@ export default class SchoolHome implements OnInit, OnDestroy { }; ngOnInit() { - this.loginInfoSub = this._ngRedux.select('loginInfo') + this.loginInfoSub = this._ngRedux.select("loginInfo") .subscribe(loginInfo => { - let linfo=loginInfo; + let linfo = loginInfo; if (linfo.size > 0) { linfo.reduce(({ }, loginInfoToken) => { this.authToken = loginInfoToken.auth_token; @@ -117,7 +117,7 @@ export default class SchoolHome implements OnInit, OnDestroy { this.authRole = params["auth_role"]; this.errorCode$.next((params["error_code"] === undefined) ? "" : params["error_code"]); } - if (this.authToken && this.authRole && this.errorCode$.getValue() == "") { + if (this.authToken && this.authRole && this.errorCode$.getValue() === "") { this._ata.getloginInfo({ auth_token: this.authToken, auth_role: this.authRole }); } }); @@ -141,12 +141,11 @@ export default class SchoolHome implements OnInit, OnDestroy { casSignOut() { this._hds.casSignOut().then(data => { this._ata.initLoginInfo(); - // this.router.navigate(['/school']); - this.authToken = ''; - this.authRole = ''; + this.authToken = ""; + this.authRole = ""; window.location.assign((data).next); }).catch(err => { - console.log(err) + console.log(err); }); } } diff --git a/source/components/student-application-form/after.submit.ts b/source/components/student-application-form/after.submit.ts index 195975d1df852a6b8f8345ba47f23ed50c184e2a..4c8e786d0daa27f2fadbd816fb7c40072febbd4d 100644 --- a/source/components/student-application-form/after.submit.ts +++ b/source/components/student-application-form/after.submit.ts @@ -1,22 +1,21 @@ -import {Router} from '@angular/router'; -import {OnInit, OnDestroy, Component, Injectable} from '@angular/core'; -import { HelperDataService } from '../../services/helper-data-service'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -import { ILoginInfo, ILoginInfoToken } from '../../store/logininfo/logininfo.types'; -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'; +import {Router} from "@angular/router"; +import {OnInit, OnDestroy, Component, Injectable} from "@angular/core"; +import { HelperDataService } from "../../services/helper-data-service"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +import { ILoginInfo, ILoginInfoToken } from "../../store/logininfo/logininfo.types"; +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 { StudentDataFieldsActions } from "../../actions/studentdatafields.actions"; @Component({ - selector: 'post-submit', + selector: "post-submit", template: `
@@ -38,7 +37,7 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action private authToken: string; private authRole: string; private cuName: string; - public cuser: any; + private cuser: any; private showLoader$: BehaviorSubject; private loginInfoSub: Subscription; @@ -50,7 +49,6 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action private _rsa: RegionSchoolsActions, private _eca: EpalClassesActions, private _sdfa: StudentDataFieldsActions, - private _cria: CriteriaActions, private _ngRedux: NgRedux, private router: Router ) { @@ -58,7 +56,7 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action }; ngOnInit() { - this.loginInfoSub = this._ngRedux.select('loginInfo') + this.loginInfoSub = this._ngRedux.select("loginInfo") .subscribe(loginInfo => { let linfo = loginInfo; if (linfo.size > 0) { @@ -69,7 +67,7 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action return loginInfoToken; }, {}); } - }, error => {console.log("error selecting epalclasses")}); + }, error => { console.log("error selecting epalclasses"); }); }; ngOnDestroy() { @@ -86,20 +84,19 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action this._rsa.initRegionSchools(); this._csa.initSectorCourses(); this._sdfa.initStudentDataFields(); - this._cria.initCriteria(); - this.router.navigate(['']); - this.authToken = ''; - this.authRole = ''; + this.router.navigate([""]); + this.authToken = ""; + this.authRole = ""; this.showLoader$.next(false); }).catch(err => { this.showLoader$.next(false); - console.log(err) + console.log(err); }); } submittedView() { - this.router.navigate(['/submited-preview']); + this.router.navigate(["/submited-preview"]); } } diff --git a/source/components/student-application-form/application.form.main.html b/source/components/student-application-form/application.form.main.html index 688744494716ad1e4150d63aa07b42b99e307121..01afab054642018eaf9e9d53facb4975ddbffeae 100644 --- a/source/components/student-application-form/application.form.main.html +++ b/source/components/student-application-form/application.form.main.html @@ -138,14 +138,8 @@

- +
Η επιλογή από αυτή τη λίστα είναι απαραίτητη! @@ -218,4 +212,4 @@ - + diff --git a/source/components/student-application-form/application.form.main.ts b/source/components/student-application-form/application.form.main.ts index 1ad5c46df677378a5d2f5f2691cf2deaba8d1414..62f2c2c1554739597e4d9111c6e8d8c168421117 100644 --- a/source/components/student-application-form/application.form.main.ts +++ b/source/components/student-application-form/application.form.main.ts @@ -5,13 +5,10 @@ import { Router } from "@angular/router"; import { NgRedux, select } from "@angular-redux/store"; import { StudentDataFieldsActions } from "../../actions/studentdatafields.actions"; import { IStudentDataFields } from "../../store/studentdatafields/studentdatafields.types"; -import { CriteriaActions } from "../../actions/criteria.actions"; -import { ICriter } from "../../store/criteria/criteria.types"; import { IAppState } from "../../store/store"; import { VALID_NAMES_PATTERN, VALID_UCASE_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_DIGITS_PATTERN, VALID_DATE_PATTERN, FIRST_SCHOOL_YEAR, VALID_YEAR_PATTERN, VALID_TELEPHONE_PATTERN } from "../../constants"; import { STUDENT_DATA_FIELDS_INITIAL_STATE } from "../../store/studentdatafields/studentdatafields.initial-state"; -import { CRITERIA_INITIAL_STATE } from "../../store/criteria/criteria.initial-state"; import { ILoginInfo, ILoginInfoToken } from "../../store/logininfo/logininfo.types"; import { LOGININFO_INITIAL_STATE } from "../../store/logininfo/logininfo.initial-state"; import {IMyDpOptions} from "mydatepicker"; @@ -34,14 +31,13 @@ import { private loginInfo$: BehaviorSubject; private studentDataFields$: BehaviorSubject; - private criteria$: BehaviorSubject; private studentDataFieldsSub: Subscription; private loginInfoSub: Subscription; private criteriaSub: Subscription; - public studentDataGroup: FormGroup; - public studentCriteriaGroup: FormGroup; + private studentDataGroup: FormGroup; + private studentCriteriaGroup: FormGroup; private modalTitle: BehaviorSubject; private modalText: BehaviorSubject; @@ -78,19 +74,17 @@ import { }; constructor(private fb: FormBuilder, - private _sdfa: StudentDataFieldsActions, - private _sdfb: CriteriaActions, - private _ngRedux: NgRedux, - private router: Router, - private http: Http) { + private _sdfa: StudentDataFieldsActions, + private _ngRedux: NgRedux, + private router: Router, + private http: Http) { this.populateSchoolyears(); - this.modalTitle = new BehaviorSubject(""); - this.modalText = new BehaviorSubject(""); - this.modalHeader = new BehaviorSubject(""); + this.modalTitle = new BehaviorSubject(""); + this.modalText = new BehaviorSubject(""); + this.modalHeader = new BehaviorSubject(""); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE); - this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE); this.studentDataGroup = this.fb.group({ name: ["", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]], studentsurname: ["", [Validators.pattern(VALID_UCASE_NAMES_PATTERN), Validators.required]], @@ -101,7 +95,7 @@ import { regiontk: ["", [Validators.pattern(VALID_ADDRESSTK_PATTERN), Validators.required]], regionarea: ["", [Validators.pattern(VALID_NAMES_PATTERN), Validators.required]], relationtostudent: ["", this.checkChoice], - telnum: ["", [Validators.pattern(VALID_TELEPHONE_PATTERN), Validators.required]], + telnum: ["", [Validators.pattern(VALID_TELEPHONE_PATTERN), Validators.required]], lastschool_schoolname: ["", [Validators.required]], lastschool_schoolyear: ["", this.checkChoice], lastschool_class: ["", this.checkChoice], @@ -111,12 +105,12 @@ import { ngOnInit() { ($("#applicationFormNotice")).appendTo("body"); - this.loginInfoSub = this._ngRedux.select('loginInfo') + this.loginInfoSub = this._ngRedux.select("loginInfo") .subscribe(loginInfo => { this.loginInfo$.next(loginInfo); - }, error => {console.log("error selecting loginInfo");}); + }, error => { console.log("error selecting loginInfo"); }); - this.studentDataFieldsSub = this._ngRedux.select('studentDataFields') + this.studentDataFieldsSub = this._ngRedux.select("studentDataFields") .subscribe(studentDataFields => { let sdfds = studentDataFields; if (sdfds.size > 0) { @@ -139,7 +133,7 @@ import { }, {}); } this.studentDataFields$.next(sdfds); - }, error => {console.log("error selecting studentDataFields");}); + }, error => { console.log("error selecting studentDataFields"); }); }; @@ -182,29 +176,29 @@ import { else if ((new Date().getFullYear()) - d.date.year < 14) return 2; if (!this.studentDataGroup.controls["lastschool_schoolname"].value.registry_no && - this.studentDataGroup.controls["lastschool_schoolname"].value.unit_type_id!==38) + this.studentDataGroup.controls["lastschool_schoolname"].value.unit_type_id !== 38) return 3; - else if (this.studentDataGroup.controls["lastschool_schoolname"].value.unit_type_id===38) - this.studentDataGroup.controls["lastschool_schoolname"].value.registry_no='0000000' - if (this.studentDataGroup.controls["telnum"].value.length !== 10 ) + else if (this.studentDataGroup.controls["lastschool_schoolname"].value.unit_type_id === 38) + this.studentDataGroup.controls["lastschool_schoolname"].value.registry_no = "0000000"; + if (this.studentDataGroup.controls["telnum"].value.length !== 10) return 4; return 0; } checkcriteria(cb, mutual_disabled) { - if (mutual_disabled !== "-1" && cb.checked === true) { - // this.studentCriteriaGroup.controls["formArray"]["controls"][mutual_disabled-1].setValue(false); - let mutual_ids = mutual_disabled.split(","); - for (let i = 0; i < mutual_ids.length; i++) { - this.studentCriteriaGroup.controls["formArray"]["controls"][mutual_ids[i] - 1].setValue(false); - } + if (mutual_disabled !== "-1" && cb.checked === true) { + // this.studentCriteriaGroup.controls["formArray"]["controls"][mutual_disabled-1].setValue(false); + let mutual_ids = mutual_disabled.split(","); + for (let i = 0; i < mutual_ids.length; i++) { + this.studentCriteriaGroup.controls["formArray"]["controls"][mutual_ids[i] - 1].setValue(false); + } - } + } } checkChoice(c: FormControl) { - return (c.value === "" ) ? {status: true} : null; + return (c.value === "") ? { status: true } : null; } populateDate(d) { @@ -233,10 +227,12 @@ import { setDate() { let date = new Date(); - return { date: { - year: date.getFullYear() - 14, - month: date.getMonth() + 1, - day: date.getDate()} + return { + date: { + year: date.getFullYear() - 14, + month: date.getMonth() + 1, + day: date.getDate() + } }; } @@ -253,11 +249,11 @@ import { } lastSchoolListFormatter(data: any): string { - return data.name; + return data.name; }; lastSchoolValueFormatter(data: any): string { - return data.name; + return data.name; }; lastSchoolValueChanged(e: any): void { diff --git a/source/components/student-application-form/application.preview.ts b/source/components/student-application-form/application.preview.ts index 501096cf8a49d93451b2163bb851c644c18ebf96..60bacf17ad653c7fed8a52dd03cd9398679e0c3d 100644 --- a/source/components/student-application-form/application.preview.ts +++ b/source/components/student-application-form/application.preview.ts @@ -1,25 +1,25 @@ -import { Component, OnInit, OnDestroy } from '@angular/core'; -import { Router } from '@angular/router'; -import { BehaviorSubject, Subscription } from 'rxjs/Rx'; +import { Component, OnInit, OnDestroy } from "@angular/core"; +import { Router } from "@angular/router"; +import { BehaviorSubject, Subscription } from "rxjs/Rx"; import { Injectable } from "@angular/core"; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -import { SectorFieldsActions } from '../../actions/sectorfields.actions'; -import { SectorCoursesActions } from '../../actions/sectorcourses.actions'; -import { RegionSchoolsActions } from '../../actions/regionschools.actions'; -import { EpalClassesActions } from '../../actions/epalclass.actions'; -import { ISectorFields } from '../../store/sectorfields/sectorfields.types'; -import { ISectors } from '../../store/sectorcourses/sectorcourses.types'; -import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from '../../store/regionschools/regionschools.types'; -import { IEpalClasses } from '../../store/epalclasses/epalclasses.types'; -import {AppSettings} from '../../app.settings'; -import { REGION_SCHOOLS_INITIAL_STATE } from '../../store/regionschools/regionschools.initial-state'; -import { EPALCLASSES_INITIAL_STATE } from '../../store/epalclasses/epalclasses.initial-state'; -import { SECTOR_COURSES_INITIAL_STATE } from '../../store/sectorcourses/sectorcourses.initial-state'; -import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfields.initial-state'; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +import { SectorFieldsActions } from "../../actions/sectorfields.actions"; +import { SectorCoursesActions } from "../../actions/sectorcourses.actions"; +import { RegionSchoolsActions } from "../../actions/regionschools.actions"; +import { EpalClassesActions } from "../../actions/epalclass.actions"; +import { ISectorFields } from "../../store/sectorfields/sectorfields.types"; +import { ISectors } from "../../store/sectorcourses/sectorcourses.types"; +import { IRegionRecord, IRegionRecords, IRegionSchoolRecord } from "../../store/regionschools/regionschools.types"; +import { IEpalClasses } from "../../store/epalclasses/epalclasses.types"; +import {AppSettings} from "../../app.settings"; +import { REGION_SCHOOLS_INITIAL_STATE } from "../../store/regionschools/regionschools.initial-state"; +import { EPALCLASSES_INITIAL_STATE } from "../../store/epalclasses/epalclasses.initial-state"; +import { SECTOR_COURSES_INITIAL_STATE } from "../../store/sectorcourses/sectorcourses.initial-state"; +import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfields.initial-state"; @Component({ - selector: 'application-preview-select', + selector: "application-preview-select", template: `

Οι επιλογές μου

@@ -92,7 +92,7 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel private numSelectedSchools = 0; private numSelectedOrder = 0; private classSelected = 0; - public currentUrl: string; + private currentUrl: string; constructor(private _ngRedux: NgRedux, private router: Router @@ -107,7 +107,7 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel ngOnInit() { this.currentUrl = this.router.url; - this.sectorsSub = this._ngRedux.select('sectors') + this.sectorsSub = this._ngRedux.select("sectors") .subscribe(sectors => { let scs = sectors; scs.reduce((prevSector, sector) => { @@ -123,7 +123,7 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel this.sectors$.next(scs); }); - this.regionsSub = this._ngRedux.select('regions') + this.regionsSub = this._ngRedux.select("regions") .subscribe(regions => { let rgns = regions; let numsel = 0, numsel2 = 0; @@ -148,12 +148,12 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel this.selectedSchools$.next(selectedSchools.sort(this.compareSchools)); }); - this.sectorFieldsSub = this._ngRedux.select('sectorFields') + this.sectorFieldsSub = this._ngRedux.select("sectorFields") .subscribe(sectorFields => { this.sectorFields$.next(sectorFields); - }, error => {console.log("error selecting sectorFields");}); + }, error => { console.log("error selecting sectorFields"); }); - this.epalclassesSub = this._ngRedux.select('epalclasses') + this.epalclassesSub = this._ngRedux.select("epalclasses") .subscribe(epalclasses => { let ecs = epalclasses; ecs.reduce(({}, epalclass) => { @@ -168,11 +168,11 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel return epalclass; }, {}); this.epalclasses$.next(ecs); - }, error => {console.log("error selecting epalclasses");}); + }, error => { console.log("error selecting epalclasses"); }); } - compareSchools(a: IRegionSchoolRecord,b: IRegionSchoolRecord) { + compareSchools(a: IRegionSchoolRecord, b: IRegionSchoolRecord) { if (a.order_id < b.order_id) return -1; if (a.order_id > b.order_id) @@ -183,19 +183,19 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel ngOnDestroy() { if (this.regionsSub) { this.regionsSub.unsubscribe(); -// this.regions$.unsubscribe(); + // this.regions$.unsubscribe(); } if (this.sectorsSub) { this.sectorsSub.unsubscribe(); -// this.sectors$.unsubscribe(); + // this.sectors$.unsubscribe(); } if (this.sectorFieldsSub) { this.sectorFieldsSub.unsubscribe(); -// this.sectorFields$.unsubscribe(); + // this.sectorFields$.unsubscribe(); } if (this.epalclassesSub) { this.epalclassesSub.unsubscribe(); -// this.epalclasses$.unsubscribe(); + // this.epalclasses$.unsubscribe(); } } diff --git a/source/components/student-application-form/application.submit.ts b/source/components/student-application-form/application.submit.ts index 6791d89d9fbfda532c5f72a9cc26b0a522702f6b..b433429ce5f0e3a7b001f142fc43e9382e8dd9a8 100644 --- a/source/components/student-application-form/application.submit.ts +++ b/source/components/student-application-form/application.submit.ts @@ -137,7 +137,7 @@ import { HelperDataService } from "../../services/helper-data-service"; private modalHeader: BehaviorSubject; public isModalShown: BehaviorSubject; private showLoader: BehaviorSubject; - public currentUrl: string; + private currentUrl: string; private cu_name: string; private cu_surname: string; private cu_fathername: string; @@ -156,7 +156,7 @@ import { HelperDataService } from "../../services/helper-data-service"; private http: Http ) { -// this.regions$ = new BehaviorSubject(REGION_SCHOOLS_INITIAL_STATE); + // this.regions$ = new BehaviorSubject(REGION_SCHOOLS_INITIAL_STATE); this.epalclasses$ = new BehaviorSubject(EPALCLASSES_INITIAL_STATE); this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); @@ -171,7 +171,7 @@ import { HelperDataService } from "../../services/helper-data-service"; ngOnInit() { ($("#studentFormSentNotice")).appendTo("body"); - this.loginInfoSub = this._ngRedux.select('loginInfo') + this.loginInfoSub = this._ngRedux.select("loginInfo") .subscribe(loginInfo => { let linfo = loginInfo; console.log("SELECTOR5"); @@ -189,9 +189,9 @@ import { HelperDataService } from "../../services/helper-data-service"; }, {}); } this.loginInfo$.next(linfo); - }, error => {console.log("error selecting loginInfo")}); + }, error => { console.log("error selecting loginInfo"); }); - this.epalclassesSub = this._ngRedux.select('epalclasses').subscribe(epalclasses => { + this.epalclassesSub = this._ngRedux.select("epalclasses").subscribe(epalclasses => { let ecs = epalclasses; console.log("SELECTOR4"); if (ecs.size > 0) { @@ -201,56 +201,40 @@ import { HelperDataService } from "../../services/helper-data-service"; }, {}); } this.epalclasses$.next(ecs); - }, error => {console.log("error selecting epalclasses")}); + }, error => { console.log("error selecting epalclasses"); }); - this.studentDataFieldsSub = this._ngRedux.select('studentDataFields') + this.studentDataFieldsSub = this._ngRedux.select("studentDataFields") .subscribe(studentDataFields => { this.studentDataFields$.next(studentDataFields); - }, error => {console.log("error selecting studentDataFields")}); - -/* this.regionsSub = this._ngRedux.select((state) => { - console.log("SELECTOR3"); - state.regions.reduce((prevRegion, region) => { - region.epals.reduce((prevEpal, epal) => { - if (epal.selected === true) { - this.epalSelected.push(Number(epal.epal_id)); - this.epalSelectedOrder.push(epal.order_id); - } - return epal; - }, {}); - return region; - }, {}); - return state.regions; - }).subscribe(this.regions$); */ - + }, error => { console.log("error selecting studentDataFields"); }); - this.regionsSub = this._ngRedux.select('regions'). + this.regionsSub = this._ngRedux.select("regions"). subscribe(regions => { console.log("SELECTOR: REGIONS"); - let rgns = regions; - let prevSelected: Array = new Array(); - rgns.reduce((prevRgn, rgn) => { - rgn.epals.reduce((prevSchool, school) => { - if (school.selected === true) { - prevSelected = this.epalSelected$.getValue(); - prevSelected[prevSelected.length] = parseInt(school.epal_id); - - this.epalSelected$.next(prevSelected); - this.epalSelectedOrder.push(school.order_id); - } - return school; - }, {}); - return rgn; + let rgns = regions; + let prevSelected: Array = new Array(); + rgns.reduce((prevRgn, rgn) => { + rgn.epals.reduce((prevSchool, school) => { + if (school.selected === true) { + prevSelected = this.epalSelected$.getValue(); + prevSelected[prevSelected.length] = parseInt(school.epal_id); + + this.epalSelected$.next(prevSelected); + this.epalSelectedOrder.push(school.order_id); + } + return school; }, {}); -// this.regions$.next(regions); - }, - error => { - console.log("Error Selecting Regions"); - } - ); + return rgn; + }, {}); + // this.regions$.next(regions); + }, + error => { + console.log("Error Selecting Regions"); + } + ); - this.sectorsSub = this._ngRedux.select('sectors') + this.sectorsSub = this._ngRedux.select("sectors") .subscribe(sectors => { let scs = sectors; console.log("SELECTOR2"); @@ -265,7 +249,7 @@ import { HelperDataService } from "../../services/helper-data-service"; }, {}); }); - this.sectorFieldsSub = this._ngRedux.select('sectorFields') + this.sectorFieldsSub = this._ngRedux.select("sectorFields") .subscribe(sectorFields => { let sfds = sectorFields; console.log("SELECTOR"); @@ -283,33 +267,25 @@ import { HelperDataService } from "../../services/helper-data-service"; ($("#studentFormSentNotice")).remove(); if (this.studentDataFieldsSub) { this.studentDataFieldsSub.unsubscribe(); -// this.studentDataFields$.unsubscribe(); } if (this.regionsSub) { this.regionsSub.unsubscribe(); -// this.regions$.unsubscribe(); } if (this.sectorsSub) { this.sectorsSub.unsubscribe(); -// this.sectors$.unsubscribe(); } if (this.sectorFieldsSub) { this.sectorFieldsSub.unsubscribe(); -// this.sectorFields$.unsubscribe(); } if (this.epalclassesSub) { this.epalclassesSub.unsubscribe(); -// this.epalclasses$.unsubscribe(); } if (this.loginInfoSub) { this.loginInfoSub.unsubscribe(); -// this.loginInfo$.unsubscribe(); } } submitNow() { - // αποστολή στοιχείων μαθητή στο entity: epal_student - // let aitisiObj: Array = []; if (this.studentDataFields$.getValue().size === 0 || this.epalSelected$.getValue().length === 0 || this.epalclasses$.getValue().size === 0 || this.loginInfo$.getValue().size === 0) return; @@ -518,7 +494,7 @@ import { HelperDataService } from "../../services/helper-data-service"; this.showLoader.next(false); console.log("Error HTTP POST Service"); } - ); + ); } diff --git a/source/components/student-application-form/course.fields.select.ts b/source/components/student-application-form/course.fields.select.ts deleted file mode 100644 index 2865abc7b01ff0900bbfb8d406ef4afadf89ddc7..0000000000000000000000000000000000000000 --- a/source/components/student-application-form/course.fields.select.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; -import { Observable } from 'rxjs/Rx'; -import { Injectable } from "@angular/core"; -import { CourseFieldsActions } from '../../actions/coursefields.actions'; -import { NgRedux, select } from '@angular-redux/store'; -import { ICourseFields } from '../../store/coursefields/coursefields.types'; -import { IAppState } from '../../store/store'; - -import { - FormBuilder, - FormGroup, - FormControl, - FormArray -} from '@angular/forms'; -import {AppSettings} from '../../app.settings'; - -@Component({ - selector: 'course-fields-select', - template: ` -
- -
-
-
-
-
-
- -
-
- {{courseField$.name}} -
-
-
-
-
-
- -
-
-
- - ` -}) -@Injectable() export default class CourseFieldsSelect implements OnInit { - private courseFields$: Observable; - - public formGroup: FormGroup; - public cfs = new FormArray([]); - - constructor(private fb: FormBuilder, - private _cfa: CourseFieldsActions, - private _ngRedux: NgRedux, - private router: Router) { - this.formGroup = this.fb.group({ - formArray: this.cfs - }); - }; - - ngOnInit() { - - this._cfa.getCourseFields(); - - this.courseFields$ = this._ngRedux.select(state => { - state.courseFields.reduce(({}, courseField) =>{ - this.cfs.push(new FormControl(courseField.selected, [])); - return courseField; - }, {}); - return state.courseFields; - }); - - } - - saveSelected() { - this._cfa.saveCourseFieldsSelected(this.formGroup.value.formArray); - this.router.navigate(['/region-schools-select']); - } -} diff --git a/source/components/student-application-form/disclaimer.ts b/source/components/student-application-form/disclaimer.ts index 83e8b35c78a97d0f546fbbfff0c179cf5547353f..eac596c479fd43d02c523002702f6649b26fcb42 100644 --- a/source/components/student-application-form/disclaimer.ts +++ b/source/components/student-application-form/disclaimer.ts @@ -1,14 +1,14 @@ import { Component, OnInit, OnDestroy } from "@angular/core"; import { Injectable } from "@angular/core"; -import { AppSettings } from '../../app.settings'; -import { Http, Headers, RequestOptions} from '@angular/http'; -import { NgRedux, select } from '@angular-redux/store'; -import { IAppState } from '../../store/store'; -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 { LoginInfoActions } from '../../actions/logininfo.actions'; +import { AppSettings } from "../../app.settings"; +import { Http, Headers, RequestOptions} from "@angular/http"; +import { NgRedux, select } from "@angular-redux/store"; +import { IAppState } from "../../store/store"; +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 { LoginInfoActions } from "../../actions/logininfo.actions"; import { FormBuilder, @@ -16,10 +16,10 @@ import { FormControl, FormArray, Validators, -} from '@angular/forms'; +} from "@angular/forms"; @Component({ - selector: 'intro-statement', + selector: "intro-statement", template: `