From e0a77286f08cfee082283da6ea484f1d57dfd1b9 Mon Sep 17 00:00:00 2001 From: Haris Papadopoulos Date: Mon, 31 Jul 2017 22:48:57 +0300 Subject: [PATCH] Restructured ISectors --- source/actions/sectorcourses.actions.ts | 25 +++- .../application.preview.ts | 26 ++-- .../application.submit.ts | 12 +- .../region.schools.select.ts | 12 +- .../sector.courses.select.ts | 131 +++++++++++------- source/constants.ts | 1 + source/services/helper-data-service.ts | 6 +- source/store/index.ts | 7 +- .../regionschools.initial-state.ts | 3 +- .../regionschools/regionschools.reducer.ts | 6 +- source/store/sectorcourses/index.ts | 7 +- .../sectorcourses.initial-state.ts | 4 +- .../sectorcourses/sectorcourses.reducer.ts | 54 ++++++-- .../sectorcourses.transformers.ts | 15 +- .../sectorcourses/sectorcourses.types.ts | 8 +- source/store/store.ts | 2 +- 16 files changed, 194 insertions(+), 125 deletions(-) diff --git a/source/actions/sectorcourses.actions.ts b/source/actions/sectorcourses.actions.ts index 8f84a36..8742b8b 100644 --- a/source/actions/sectorcourses.actions.ts +++ b/source/actions/sectorcourses.actions.ts @@ -1,4 +1,4 @@ -import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from "../constants"; +import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SECTOR_SELECTED_SAVE, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from "../constants"; import { Injectable } from "@angular/core"; import { NgRedux } from "@angular-redux/store"; import { IAppState } from "../store"; @@ -33,12 +33,29 @@ export class SectorCoursesActions { }); }; - saveSectorCoursesSelected = (sectorCoursesSelected, sectorSelected) => { + selectSector = (prevChoice, newChoice) => { + return this._ngRedux.dispatch({ + type: SECTORCOURSES_SECTOR_SELECTED_SAVE, + payload: { + prevChoice: prevChoice, + newChoice: newChoice +// sectorCoursesSelected, +// sectorSelected + } + }); + } + + saveSectorCoursesSelected = (oldSIndex, oldCIndex, checked, i, j) => { return this._ngRedux.dispatch({ type: SECTORCOURSES_SELECTED_SAVE, payload: { - sectorCoursesSelected, - sectorSelected + oldSIndex: oldSIndex, + oldCIndex: oldCIndex, + checked: checked, + sIndex: i, + cIndex: j +// sectorCoursesSelected, +// sectorSelected } }); }; diff --git a/source/components/student-application-form/application.preview.ts b/source/components/student-application-form/application.preview.ts index 966b0cb..c7123e4 100644 --- a/source/components/student-application-form/application.preview.ts +++ b/source/components/student-application-form/application.preview.ts @@ -9,7 +9,7 @@ import { SectorCoursesActions } from "../../actions/sectorcourses.actions"; import { RegionSchoolsActions } from "../../actions/regionschools.actions"; import { EpalClassesActions } from "../../actions/epalclass.actions"; import { ISectorFieldRecords } from "../../store/sectorfields/sectorfields.types"; -import { ISectors } from "../../store/sectorcourses/sectorcourses.types"; +import { ISectorRecords } 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"; @@ -45,21 +45,21 @@ import { SECTOR_FIELDS_INITIAL_STATE } from "../../store/sectorfields/sectorfiel
-