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_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<IAppState>) {}
constructor(
private _ngRedux: NgRedux<IAppState>) { }
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: {
}
});
};
}
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,
};
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<IAppState>,
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<IAppState>,
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: {
}
});
};
}
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<IAppState>,
private _hds: HelperDataService) {}
constructor(
private _ngRedux: NgRedux<IAppState>,
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
}
});
};
}
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<IAppState>,
private _hds: HelperDataService) {}
constructor(
private _ngRedux: NgRedux<IAppState>,
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
}
});
};
}
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({
......
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<IAppState>) {}
constructor(
private _ngRedux: NgRedux<IAppState>) { }
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: {
......
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);
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 "";
}
}
......@@ -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";
}
<