Fixed typescript warnings. NgRedux.select() rewrite. Other fixes

parent d91d67ab
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<IAppState>,
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
}
});
};
}
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<IAppState>,
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: {
}
});
};
}
import { EPALCLASSES_SAVE } from '../constants'; import { EPALCLASSES_SAVE } from "../constants";
import { EPALCLASSES_INIT } from '../constants'; import { EPALCLASSES_INIT } from "../constants";
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { NgRedux } from '@angular-redux/store'; import { NgRedux } from "@angular-redux/store";
import { IAppState } from '../store'; import { IAppState } from "../store";
@Injectable() @Injectable()
export class EpalClassesActions { export class EpalClassesActions {
constructor( constructor(
private _ngRedux: NgRedux<IAppState>) {} private _ngRedux: NgRedux<IAppState>) { }
saveEpalClassesSelected = (epalClasses) => { saveEpalClassesSelected = (epalClasses) => {
......
import { CourseFieldsActions } from './coursefields.actions'; import { SectorFieldsActions } from "./sectorfields.actions";
import { SectorFieldsActions } from './sectorfields.actions'; import { RegionSchoolsActions } from "./regionschools.actions";
import { RegionSchoolsActions } from './regionschools.actions'; import { SectorCoursesActions } from "./sectorcourses.actions";
import { SectorCoursesActions } from './sectorcourses.actions'; import { StudentDataFieldsActions } from "./studentdatafields.actions";
import { StudentDataFieldsActions } from './studentdatafields.actions'; import { EpalClassesActions } from "./epalclass.actions";
import { EpalClassesActions } from './epalclass.actions'; import { LoginInfoActions} from "./logininfo.actions";
import { LoginInfoActions} from './logininfo.actions';
import { CriteriaActions} from './criteria.actions';
const ACTION_PROVIDERS = [ CourseFieldsActions, SectorFieldsActions, RegionSchoolsActions, SectorCoursesActions, StudentDataFieldsActions, const ACTION_PROVIDERS = [SectorFieldsActions, RegionSchoolsActions, SectorCoursesActions, StudentDataFieldsActions,
EpalClassesActions, LoginInfoActions, CriteriaActions]; EpalClassesActions, LoginInfoActions];
export { export {
CourseFieldsActions, SectorFieldsActions,
SectorFieldsActions, RegionSchoolsActions,
RegionSchoolsActions, SectorCoursesActions,
SectorCoursesActions, StudentDataFieldsActions,
StudentDataFieldsActions, EpalClassesActions,
EpalClassesActions, LoginInfoActions,
LoginInfoActions, ACTION_PROVIDERS,
CriteriaActions,
ACTION_PROVIDERS,
}; };
import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED, STATEMENTAGREE_SAVE } from '../constants'; import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED, STATEMENTAGREE_SAVE } from "../constants";
import { LOGININFO_INIT } from '../constants'; import { LOGININFO_INIT } from "../constants";
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { NgRedux } from '@angular-redux/store'; import { NgRedux } from "@angular-redux/store";
import { IAppState } from '../store'; import { IAppState } from "../store";
import { HelperDataService } from '../services/helper-data-service'; import { HelperDataService } from "../services/helper-data-service";
@Injectable() @Injectable()
export class LoginInfoActions { export class LoginInfoActions {
constructor( constructor(
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) {} private _hds: HelperDataService) { }
getloginInfo = (loginInfo) => { getloginInfo = (loginInfo) => {
return this._hds.getCurrentUser(loginInfo.auth_token, loginInfo.auth_role).then (loginInfos => { return this._hds.getCurrentUser(loginInfo.auth_token, loginInfo.auth_role).then(loginInfos => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: LOGININFO_SAVE, type: LOGININFO_SAVE,
payload: { payload: {
...@@ -21,7 +21,7 @@ export class LoginInfoActions { ...@@ -21,7 +21,7 @@ export class LoginInfoActions {
} }
}); });
}); });
} }
saveMinEduloginInfo = (loginInfos) => { saveMinEduloginInfo = (loginInfos) => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
...@@ -30,25 +30,25 @@ export class LoginInfoActions { ...@@ -30,25 +30,25 @@ export class LoginInfoActions {
loginInfos loginInfos
} }
}); });
}; };
saveProfile = (profile) => { saveProfile = (profile) => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: PROFILE_SAVE, type: PROFILE_SAVE,
payload: { payload: {
profile profile
} }
}); });
}; };
saveStatementAgree = (disclaimer_checked) => { saveStatementAgree = (disclaimer_checked) => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: STATEMENTAGREE_SAVE, type: STATEMENTAGREE_SAVE,
payload: { payload: {
disclaimer_checked disclaimer_checked
} }
}); });
}; };
initLoginInfo = () => { initLoginInfo = () => {
......
import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE, REGIONSCHOOLS_INIT } from '../constants'; import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE, REGIONSCHOOLS_INIT } from "../constants";
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { NgRedux } from '@angular-redux/store'; import { NgRedux } from "@angular-redux/store";
import { IAppState } from '../store'; import { IAppState } from "../store";
import { HelperDataService } from '../services/helper-data-service'; import { HelperDataService } from "../services/helper-data-service";
@Injectable() @Injectable()
export class RegionSchoolsActions { export class RegionSchoolsActions {
constructor( constructor(
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) {} private _hds: HelperDataService) { }
getRegionSchools = (classActive,courseActive, reload) => { getRegionSchools = (classActive, courseActive, reload) => {
const { regions } = this._ngRedux.getState(); const { regions } = this._ngRedux.getState();
if (reload === true || (reload === false && regions.size === 0)) { if (reload === true || (reload === false && regions.size === 0)) {
return this._hds.getRegionsWithSchools(classActive,courseActive).then(regions => { return this._hds.getRegionsWithSchools(classActive, courseActive).then(regions => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: REGIONSCHOOLS_RECEIVED, type: REGIONSCHOOLS_RECEIVED,
payload: { payload: {
...@@ -32,22 +32,6 @@ export class RegionSchoolsActions { ...@@ -32,22 +32,6 @@ export class RegionSchoolsActions {
}); });
}; };
/*
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
}
});
});
//}
};
*/
saveRegionSchoolsSelected = (checked, i, j) => { saveRegionSchoolsSelected = (checked, i, j) => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: REGIONSCHOOLS_SELECTED_SAVE, type: REGIONSCHOOLS_SELECTED_SAVE,
......
import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from '../constants'; import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from "../constants";
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { NgRedux } from '@angular-redux/store'; import { NgRedux } from "@angular-redux/store";
import { IAppState } from '../store'; import { IAppState } from "../store";
import { HelperDataService } from '../services/helper-data-service'; import { HelperDataService } from "../services/helper-data-service";
@Injectable() @Injectable()
export class SectorCoursesActions { export class SectorCoursesActions {
constructor( constructor(
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) {} private _hds: HelperDataService) { }
getSectorCourses = (reload) => { getSectorCourses = (reload) => {
const { sectors } = this._ngRedux.getState(); const { sectors } = this._ngRedux.getState();
//if (sectors.size === 0) { // if (sectors.size === 0) {
if (reload === true || (reload === false && sectors.size === 0)) { if (reload === true || (reload === false && sectors.size === 0)) {
return this._hds.getSectorsWithCourses().then(sectors => { return this._hds.getSectorsWithCourses().then(sectors => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
...@@ -33,23 +33,7 @@ export class SectorCoursesActions { ...@@ -33,23 +33,7 @@ export class SectorCoursesActions {
}); });
}; };
/* saveSectorCoursesSelected = (sectorCoursesSelected, sectorSelected) => {
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
}
});
});
//}
};
*/
saveSectorCoursesSelected = (sectorCoursesSelected,sectorSelected) => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: SECTORCOURSES_SELECTED_SAVE, type: SECTORCOURSES_SELECTED_SAVE,
payload: { payload: {
......
import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE, SECTORFIELDS_INIT } from '../constants'; import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE, SECTORFIELDS_INIT } from "../constants";
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { NgRedux } from '@angular-redux/store'; import { NgRedux } from "@angular-redux/store";
import { IAppState } from '../store'; import { IAppState } from "../store";
import { HelperDataService } from '../services/helper-data-service'; import { HelperDataService } from "../services/helper-data-service";
@Injectable() @Injectable()
export class SectorFieldsActions { export class SectorFieldsActions {
...@@ -12,7 +12,7 @@ export class SectorFieldsActions { ...@@ -12,7 +12,7 @@ export class SectorFieldsActions {
getSectorFields = (reload) => { getSectorFields = (reload) => {
const { sectorFields } = this._ngRedux.getState(); const { sectorFields } = this._ngRedux.getState();
//if (sectorFields.size === 0) { // if (sectorFields.size === 0) {
if (reload === true || (reload === false && sectorFields.size === 0)) { if (reload === true || (reload === false && sectorFields.size === 0)) {
return this._hds.getSectorFields().then(sectorFields => { return this._hds.getSectorFields().then(sectorFields => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
......
import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_INIT } from '../constants'; import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_INIT } from "../constants";
import { Injectable } from '@angular/core'; import { Injectable } from "@angular/core";
import { NgRedux } from '@angular-redux/store'; import { NgRedux } from "@angular-redux/store";
import { IAppState } from '../store'; import { IAppState } from "../store";
//import { UserDataService } from '../services/user-data-service';
@Injectable() @Injectable()
export class StudentDataFieldsActions { export class StudentDataFieldsActions {
constructor( constructor(
private _ngRedux: NgRedux<IAppState>) {} private _ngRedux: NgRedux<IAppState>) { }
saveStudentDataFields = (studentDataFields) => { saveStudentDataFields = (studentDataFields) => {
......
import { RouterModule } from '@angular/router'; import { RouterModule } from "@angular/router";
import { MainRoutes, MainDeclarations } import { MainRoutes, MainDeclarations }
from './containers/main.routes'; from "./containers/main.routes";
export const routes = [ export const routes = [
...MainRoutes ...MainRoutes
......
export const API_ENDPOINT = ''; export const API_ENDPOINT = "";
export const API_ENDPOINT_PARAMS = ''; export const API_ENDPOINT_PARAMS = "";
export class AppSettings { export class AppSettings {
public static get API_ENDPOINT(): string { public static get API_ENDPOINT(): string {
return ''; return "";
} }
public static get API_ENDPOINT_PARAMS(): string { public static get API_ENDPOINT_PARAMS(): string {
return ''; return "";
} }
} }
...@@ -26,7 +26,6 @@ import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; ...@@ -26,7 +26,6 @@ import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import Main from "./containers/main"; import Main from "./containers/main";
import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from "./app.routes"; import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from "./app.routes";
/* Here we import services */
import {HelperDataService} from "./services/helper-data-service"; import {HelperDataService} from "./services/helper-data-service";
import {LoaderService} from "./services/Spinner.service"; import {LoaderService} from "./services/Spinner.service";
import {AuthService} from "./services/auth.service"; import {AuthService} from "./services/auth.service";
...@@ -78,7 +77,7 @@ class MyLocalization extends NgLocalization { ...@@ -78,7 +77,7 @@ class MyLocalization extends NgLocalization {
Main, FooterComponent, HeaderComponent, NavbarComponent, MainComponent, Main, FooterComponent, HeaderComponent, NavbarComponent, MainComponent,
APP_DECLARATIONS, APP_DECLARATIONS,
], ],
bootstrap: [ Main ], bootstrap: [Main],
providers: [ providers: [
{ provide: APP_BASE_HREF, useValue: "/" }, { provide: APP_BASE_HREF, useValue: "/" },
{ provide: LocationStrategy, useClass: HashLocationStrategy }, { provide: LocationStrategy, useClass: HashLocationStrategy },
...@@ -100,7 +99,7 @@ class MyLocalization extends NgLocalization { ...@@ -100,7 +99,7 @@ class MyLocalization extends NgLocalization {
ReportsAuthGuard ReportsAuthGuard
] ]
}) })
class AppModule {} class AppModule { }
// enableProdMode(); // enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule); platformBrowserDynamic().bootstrapModule(AppModule);
import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core"; import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core";
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings'; import { AppSettings } from "../../app.settings";
import { HelperDataService } from '../../services/helper-data-service'; import { HelperDataService } from "../../services/helper-data-service";
import {Observable} from "rxjs/Observable"; import {Observable} from "rxjs/Observable";
import {Http, Headers, RequestOptions} from '@angular/http'; import {Http, Headers, RequestOptions} from "@angular/http";
import { NgRedux, select } from '@angular-redux/store'; import { NgRedux, select } from "@angular-redux/store";
import { IAppState } from '../../store/store'; import { IAppState } from "../../store/store";
import {Router, ActivatedRoute, Params} from '@angular/router'; import {Router, ActivatedRoute, Params} from "@angular/router";
import { BehaviorSubject, Subscription } from 'rxjs/Rx'; import { BehaviorSubject, Subscription } from "rxjs/Rx";
import { ILoginInfo } from '../../store/logininfo/logininfo.types'; import { ILoginInfo } from "../../store/logininfo/logininfo.types";
import { VALID_CAPACITY_PATTERN} from '../../constants'; import { VALID_CAPACITY_PATTERN} from "../../constants";
import {maxValue} from '../../constants'; import {maxValue} from "../../constants";
import {minValue} from '../../constants'; import {minValue} from "../../constants";
import { import {
...@@ -20,9 +20,9 @@ import { ...@@ -20,9 +20,9 @@ import {
FormControl, FormControl,
FormArray, FormArray,
Validators, Validators,
} from '@angular/forms'; } from "@angular/forms";
@Component({ @Component({
selector: 'director-classcapacity', selector: "director-classcapacity",
template: ` template: `
<div class = "loading" *ngIf="(showLoader | async) === true"></div> <div class = "loading" *ngIf="(showLoader | async) === true"></div>
<div style="min-height: 500px;"> <div style="min-height: 500px;">
...@@ -92,7 +92,7 @@ import { ...@@ -92,7 +92,7 @@ import {
@Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy { @Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy {
public formGroup: FormGroup; private formGroup: FormGroup;
private CapacityPerCourse$: BehaviorSubject<any>; private CapacityPerCourse$: BehaviorSubject<any>;
private CapacityPerCourseSub: Subscription; private CapacityPerCourseSub: Subscription;
...@@ -124,12 +124,11 @@ import {