diff --git a/package.json b/package.json index 0230daf5a6201f172c53d9a5eae8034658f229ea..95533f182fec96992bdf39ff45b5787e74634bb7 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "tslint": "^3.15.1", "tslint-loader": "^2.1.5", "typescript": "^2.0.10", - "redux-logger" : "^2.7.4", + "redux-logger": "^2.7.4", "webpack": "^1.14.0", "webpack-dashboard": "^0.2.0", "webpack-dev-server": "^1.16.2" @@ -41,7 +41,8 @@ "@angular/platform-browser-dynamic": "^2.0.0", "@angular/router": "^3.2.0", "@types/node": "^6.0.60", - "babel-polyfill" : "^6.20.0", + "babel-polyfill": "^6.20.0", + "bootstrap": "^4.0.0-alpha.6", "core-js": "^2.4.1", "css-loader": "^0.25.0", "d3": "^3.5.16", diff --git a/source/actions/regionschools.actions.ts b/source/actions/regionschools.actions.ts index e3e1e928049d0e60c15dc486500ffea34354119d..071e474332178a042a3f49a16766fbc45d232895 100644 --- a/source/actions/regionschools.actions.ts +++ b/source/actions/regionschools.actions.ts @@ -10,10 +10,10 @@ export class RegionSchoolsActions { private _ngRedux: NgRedux, private _hds: HelperDataService) {} - getRegionSchools = () => { + getRegionSchools = (courseActive, reload) => { const { regions } = this._ngRedux.getState(); - if (regions.size === 0) { - return this._hds.getRegionsWithSchools().then(regions => { + if (reload === true || (reload === false && regions.size === 0)) { + return this._hds.getRegionsWithSchools(courseActive).then(regions => { return this._ngRedux.dispatch({ type: REGIONSCHOOLS_RECEIVED, payload: { @@ -24,6 +24,22 @@ 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 = (regionSchoolsSelected) => { return this._ngRedux.dispatch({ type: REGIONSCHOOLS_SELECTED_SAVE, diff --git a/source/actions/sectorcourses.actions.ts b/source/actions/sectorcourses.actions.ts index e17cc38b4c3eb0e7e986da3b6aeada3dc5d30353..882c6da68e6e462c09845be9bc1647366c631258 100644 --- a/source/actions/sectorcourses.actions.ts +++ b/source/actions/sectorcourses.actions.ts @@ -10,9 +10,10 @@ export class SectorCoursesActions { private _ngRedux: NgRedux, private _hds: HelperDataService) {} - getSectorCourses = () => { + getSectorCourses = (reload) => { const { sectors } = this._ngRedux.getState(); - if (sectors.size === 0) { + //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, @@ -24,11 +25,28 @@ export class SectorCoursesActions { } }; - saveSectorCoursesSelected = (sectorCoursesSelected) => { + /* + 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({ type: SECTORCOURSES_SELECTED_SAVE, payload: { - sectorCoursesSelected + sectorCoursesSelected, + sectorSelected } }); }; diff --git a/source/actions/studentdatafields.actions.ts b/source/actions/studentdatafields.actions.ts index 8f1491e06d7fff6427ef0eb0dcc4909e26b3f567..31f434eb5565f776714f206ea7ac16ae716929df 100644 --- a/source/actions/studentdatafields.actions.ts +++ b/source/actions/studentdatafields.actions.ts @@ -2,8 +2,7 @@ import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_RECEIVED } from '../constants import { Injectable } from '@angular/core'; import { NgRedux } from 'ng2-redux'; import { IAppState } from '../store'; -//import { HelperDataService } from '../services/helper-data-service'; -import { UserDataService } from '../services/user-data-service'; +//import { UserDataService } from '../services/user-data-service'; @Injectable() diff --git a/source/app.settings.ts b/source/app.settings.ts index 1d2ee0c9e318d0e1be3e4a0f114414200d0742fb..99560f7562409fe937c9540a69618aa99ff89ff1 100644 --- a/source/app.settings.ts +++ b/source/app.settings.ts @@ -1,8 +1,8 @@ export class AppSettings { public static get API_ENDPOINT(): string { - return 'http://localhost/angproject/eepal-front/drupal'; -// return 'http://localhost/drupal-8.2.5'; -// return 'http://eepal.dev/drupal'; -// return 'http://eduslim2.minedu.gov.gr/drupal'; + return 'http://localhost/dist'; + // return 'http://localhost/drupal-8.2.5'; + // return 'http://eepal.dev/drupal'; + // return 'http://eduslim2.minedu.gov.gr/drupal'; } } diff --git a/source/app.ts b/source/app.ts index 265c4ceffd711fddf45ac1cfee68942fe6a12604..7d30e2e624b48b0d1e3aeaa3bbe137da0211b477 100644 --- a/source/app.ts +++ b/source/app.ts @@ -27,7 +27,7 @@ import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from './app.routes'; /* Here we import services */ import {HelperDataService} from './services/helper-data-service'; -import {UserDataService} from './services/user-data-service'; +//import {UserDataService} from './services/user-data-service'; import { ACTION_PROVIDERS } from './actions'; import Home from './components/home'; @@ -69,9 +69,9 @@ class MyLocalization extends NgLocalization { { provide: NgLocalization, useClass: MyLocalization }, DevToolsExtension, ACTION_PROVIDERS, -// Service1, again services here + //Service1, again services here HelperDataService, - UserDataService, + //UserDataService, ] }) class AppModule {} diff --git a/source/components/student-application-form/application.form.main.html b/source/components/student-application-form/application.form.main.html index 1c5f131a52af4f798486549353a2d6241b8ad540..b21b114bbcc01ecddb620800ce640a8de5f56429 100644 --- a/source/components/student-application-form/application.form.main.html +++ b/source/components/student-application-form/application.form.main.html @@ -1,11 +1,17 @@
-
+
+
+ Το πεδίο δεν μπορεί να αφεθεί κενό! +
+
+ Επιτρέπονται μόνο ψηφία σε αυτό το πεδίο! +
@@ -13,7 +19,7 @@
Το πεδίο δεν μπορεί να αφεθεί κενό!
-
+
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
@@ -23,7 +29,7 @@
Το πεδίο δεν μπορεί να αφεθεί κενό!
-
+
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
@@ -33,7 +39,7 @@
Το πεδίο δεν μπορεί να αφεθεί κενό!
-
+
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
@@ -44,7 +50,7 @@
Το πεδίο δεν μπορεί να αφεθεί κενό!
-
+
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
@@ -54,16 +60,34 @@
+
+ Το πεδίο δεν μπορεί να αφεθεί κενό! +
+
+ Δεν επιτρέπονται μη έγκυροι χαρακτήρες σε αυτό το πεδίο! +
+
+ Το πεδίο δεν μπορεί να αφεθεί κενό! +
+
+ Δεν επιτρέπονται γράμματα αλφαβήτου ή μη έγκυροι χαρακτήρες σε αυτό το πεδίο! +
+
+ Το πεδίο δεν μπορεί να αφεθεί κενό! +
+
+ Δεν επιτρέπονται μη έγκυροι χαρακτήρες σε αυτό το πεδίο! +
@@ -76,7 +100,7 @@
-
+
Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
@@ -87,7 +111,7 @@ -
+
Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
@@ -99,7 +123,7 @@
-
diff --git a/source/components/student-application-form/application.form.main.ts b/source/components/student-application-form/application.form.main.ts index c59e87e1b8203429f843db5dd20e42faf52ed3b6..5f45b2a0f95992002b5f471c9c6c01b56324b93b 100644 --- a/source/components/student-application-form/application.form.main.ts +++ b/source/components/student-application-form/application.form.main.ts @@ -8,7 +8,7 @@ import { NgRedux, select } from 'ng2-redux'; import { IStudentDataFields } from '../../store/studentdatafields/studentdatafields.types'; import { ICourseFields } from '../../store/coursefields/coursefields.types'; import { IAppState } from '../../store/store'; -import { VALID_NAMES_PATTERN } from '../../constants'; +import { VALID_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_AMKA_PATTERN } from '../../constants'; import { FormBuilder, @@ -34,6 +34,7 @@ import { private _ngRedux: NgRedux, private router: Router) { this.studentDataGroup = this.fb.group({ + /* studentAmka: ['12346', Validators.required], studentFirstname: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], studentSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], @@ -44,6 +45,17 @@ import { regionArea: ['ΠΑΤΡΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], certificateType: ['Απολυτήριο Λυκείου', Validators.required], relationToStudent: ['Μαθητής', Validators.required], + */ + studentAmka: ['12346', [Validators.pattern(VALID_AMKA_PATTERN),Validators.required]], + studentFirstname: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + studentSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + guardianFirstname: ['ΑΝΑΣΤΑΣΙΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + guardianSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + regionAddress: ['ΓΙΑΝΝΙΤΣΩΝ 5', [Validators.pattern(VALID_ADDRESS_PATTERN),Validators.required]], + regionTK: ['26334', [Validators.pattern(VALID_ADDRESSTK_PATTERN),Validators.required]], + regionArea: ['ΠΑΤΡΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], + certificateType: ['Απολυτήριο Λυκείου', Validators.required], + relationToStudent: ['Μαθητής', Validators.required], }); }; @@ -57,13 +69,6 @@ import { } return state.studentDataFields; }); - - this.courseFields$ = this._ngRedux.select(state => { - state.courseFields.reduce(({}, courseField) =>{ - return courseField; - }, {}); - return state.courseFields; - }); } saveSelected() { diff --git a/source/components/student-application-form/application.preview.ts b/source/components/student-application-form/application.preview.ts index e5c96a141889e7839ba9d6e543f26f53f879910e..da372f81b625de64cf62904b529a8d485ded36a7 100644 --- a/source/components/student-application-form/application.preview.ts +++ b/source/components/student-application-form/application.preview.ts @@ -36,11 +36,22 @@ import {AppSettings} from '../../app.settings';
-
+ + +
    @@ -53,7 +64,7 @@ import {AppSettings} from '../../app.settings';
    -
    @@ -96,6 +107,9 @@ import {AppSettings} from '../../app.settings'; private regions$: Observable; private sectorFields$: Observable; private studentDataFields$: Observable; + private courseActive = "-1"; + private numSelectedSchools = 0; + //private numSelectedCourses = 0; constructor(private _rsa: SectorCoursesActions, private _rsb: RegionSchoolsActions, @@ -107,29 +121,36 @@ import {AppSettings} from '../../app.settings'; }; ngOnInit() { - this._rsa.getSectorCourses(); + this.courseActive = this.getCourseActive(); this.sectors$ = this._ngRedux.select(state => { + //let numsel = 0; state.sectors.reduce((prevSector, sector) =>{ sector.courses.reduce((prevCourse, course) =>{ + //if (course.selected === true) { + // numsel++; + //} return course; }, {}); return sector; }, {}); + //this.numSelectedCourses = numsel; return state.sectors; }); - this._rsb.getRegionSchools(); this.regions$ = this._ngRedux.select(state => { - state.regions.reduce((prevRegion, region) =>{ - region.epals.reduce((prevSchool, school) =>{ - return school; - }, {}); - return region; - }, {}); - return state.regions; - }); + let numsel = 0; + state.regions.reduce((prevRegion, region) =>{ + region.epals.reduce((prevEpal, epal) =>{ + if (epal.selected === true) + numsel++; + return epal; + }, {}); + return region; + }, {}); + this.numSelectedSchools = numsel; + return state.regions; + }); - this._rsc.getSectorFields(); this.sectorFields$ = this._ngRedux.select(state => { state.sectorFields.reduce(({}, sectorField) =>{ return sectorField; @@ -149,9 +170,7 @@ import {AppSettings} from '../../app.settings'; defineSector() { this.router.navigate(['/sector-fields-select']); } - defineCourse() { - this.router.navigate(['/sectorcourses-fields-select']); - } + defineSchools() { this.router.navigate(['/region-schools-select']); } @@ -159,4 +178,51 @@ import {AppSettings} from '../../app.settings'; this.router.navigate(['/student-application-form-main']); } + getCourseActive() { + const { sectors } = this._ngRedux.getState(); + let l,m; + for ( l=0; l { + let numsel = 0; + state.regions.reduce((prevRegion, region) =>{ + region.epals.reduce((prevSchool, school) =>{ + if (school.selected === true) + numsel++; + return school; + }, {}); + return region; + }, {}); + this.numSelectedSchools = numsel; + return state.regions; + }); + + this._rsa.getSectorCourses(true); + this.sectors$ = this._ngRedux.select(state => { + state.sectors.reduce((prevSector, sector) =>{ + sector.courses.reduce((prevCourse, course) =>{ + return course; + }, {}); + return sector; + }, {}); + return state.sectors; + }); + + this.router.navigate(['/sectorcourses-fields-select']); + + } + */ + + defineCourse() { + this.router.navigate(['/sectorcourses-fields-select']); + } + } diff --git a/source/components/student-application-form/region.schools.select.ts b/source/components/student-application-form/region.schools.select.ts index 6ffbea9f5699ee8673f1d66abe9bfd2d1b4790e1..6d571acf9d0270b225b61ba1f4e2c9b048aadc3d 100644 --- a/source/components/student-application-form/region.schools.select.ts +++ b/source/components/student-application-form/region.schools.select.ts @@ -5,8 +5,13 @@ import { Injectable } from "@angular/core"; import { RegionSchoolsActions } from '../../actions/regionschools.actions'; import { NgRedux, select } from 'ng2-redux'; import { IRegions } from '../../store/regionschools/regionschools.types'; + +import { SectorCoursesActions } from '../../actions/sectorcourses.actions'; +import { ISectors } from '../../store/sectorcourses/sectorcourses.types'; + import { IAppState } from '../../store/store'; + import { FormBuilder, FormGroup, @@ -32,7 +37,10 @@ import {AppSettings} from '../../app.settings';
  • - +
    {{epal$.epal_name}} @@ -45,7 +53,7 @@ import {AppSettings} from '../../app.settings';
    -
    @@ -53,20 +61,26 @@ import {AppSettings} from '../../app.settings';
    +
    +
    ` }) @Injectable() export default class RegionSchoolsSelect implements OnInit { private regions$: Observable; + private sectors$: Observable; private formGroup: FormGroup; private rss = new FormArray([]); private regionActive = -1; + private numSelected = 0; + private courseActive = "-1"; constructor(private fb: FormBuilder, private _rsa: RegionSchoolsActions, + private _rsb: SectorCoursesActions, private _ngRedux: NgRedux, private router: Router ) { @@ -77,23 +91,32 @@ import {AppSettings} from '../../app.settings'; ngOnInit() { - this._rsa.getRegionSchools(); + this.courseActive = this.getCourseActive(); + this._rsa.getRegionSchools(this.courseActive, false); this.regions$ = this._ngRedux.select(state => { + let numsel = 0; state.regions.reduce((prevRegion, region) =>{ region.epals.reduce((prevEpal, epal) =>{ this.rss.push( new FormControl(epal.selected, [])); + if (epal.selected === true) { + numsel++; + console.log(epal.epal_name); + } return epal; }, {}); return region; }, {}); + this.numSelected = numsel; return state.regions; }); } setActiveRegion(ind) { - this.regionActive = ind; + if (ind === this.regionActive) + ind = -1; + this.regionActive = ind; } toggleBackgroundColor(ind) { @@ -102,6 +125,32 @@ import {AppSettings} from '../../app.settings'; saveSelected() { this._rsa.saveRegionSchoolsSelected(this.formGroup.value.formArray); - this.router.navigate(['/student-application-form-main']); + //this.router.navigate(['/student-application-form-main']); + } + + navigateToApplication() { + this.router.navigate(['/student-application-form-main']); + } + + //not used + updateCheckedOptions(globalIndex, cb){ + /* + if (cb.checked) + this.numselected--; + else + this.numselected++; + */ + this.saveSelected(); } + + getCourseActive() { + const { sectors } = this._ngRedux.getState(); + let l,m; + for ( l=0; l
    {{sector$.sector_name}}
  • -
  • + [checked] = " course$.globalIndex === idx " + >
    {{course$.course_name}} @@ -48,7 +50,7 @@ import {AppSettings} from '../../app.settings';
    -
    @@ -64,13 +66,16 @@ import {AppSettings} from '../../app.settings'; }) @Injectable() export default class SectorCoursesSelect implements OnInit { private sectors$: Observable; + private regions$: Observable; private formGroup: FormGroup; private rss = new FormArray([]); private sectorActive = -1; private idx = -1; + private sectorsList: Array = new Array(); constructor(private fb: FormBuilder, private _rsa: SectorCoursesActions, + private _rsr: RegionSchoolsActions, private _ngRedux: NgRedux, private router: Router ) { @@ -80,24 +85,39 @@ import {AppSettings} from '../../app.settings'; }; ngOnInit() { - this._rsa.getSectorCourses(); + //re-initialize schools-redux-state + this.getAllSchools(); + this._rsa.getSectorCourses(true); + let ids = 0; this.sectors$ = this._ngRedux.select(state => { state.sectors.reduce((prevSector, sector) =>{ + this.sectorsList[ids] = sector.sector_selected; + ids++; + //In case we want to preserve last checked option when we revisit the form + //if (sector.sector_selected === true) + //this.sectorActive = ids-1; sector.courses.reduce((prevCourse, course) =>{ this.rss.push( new FormControl(course.selected, [])); - this.retrieveCheck(); + //this.retrieveCheck(); + if (course.selected === true) { + //In case we want to preserve last checked option when we revisit the form + //this.idx = course.globalIndex; + } return course; }, {}); return sector; }, {}); + ids = 0; return state.sectors; }); } setActiveSector(ind) { - this.sectorActive = ind; + if (ind === this.sectorActive) + ind = -1; + this.sectorActive = ind; } toggleBackgroundColor(ind) { @@ -105,34 +125,44 @@ import {AppSettings} from '../../app.settings'; } saveSelected() { - this._rsa.saveSectorCoursesSelected(this.formGroup.value.formArray); + this._rsa.saveSectorCoursesSelected(this.formGroup.value.formArray, this.sectorsList); + } + + navigateToSchools() { this.router.navigate(['/region-schools-select']); } updateCheckedOptions(globalIndex, cb){ - /* - if (this.oneselected) - this.oneselected = 0; - else - this.oneselected = 1; - console.log(this.oneselected); - */ - //this.idx = index; this.idx = globalIndex; - for (let i = 0; i < this.formGroup.value.formArray.length; i++) this.formGroup.value.formArray[i] = false; this.formGroup.value.formArray[globalIndex] = cb.checked; if (cb.checked === false) this.idx = -1; + + for (let i = 0; i < this.sectorsList.length; i++) + this.sectorsList[i] = false; + this.sectorsList[this.sectorActive] = true; + + this.saveSelected(); } -retrieveCheck() { - for (let i = 0; i < this.formGroup.value.formArray.length; i++) - if (this.formGroup.value.formArray[i] === true) { - this.idx = i; - return; - } +getAllSchools() { + //store in Redux the whole schools + this._rsr.getRegionSchools("-1", true); + this.regions$ = this._ngRedux.select(state => { + let numsel = 0; + state.regions.reduce((prevRegion, region) =>{ + region.epals.reduce((prevEpal, epal) =>{ + this.rss.push( new FormControl(epal.selected, [])); + return epal; + }, {}); + return region; + }, {}); + return state.regions; + }); + } + } diff --git a/source/components/student-application-form/sector.fields.select.ts b/source/components/student-application-form/sector.fields.select.ts index b89ff0ee9bf8f965905fe7615dac59ba036188d7..6bd9c007436bbc872b8ebfde0ed13ae90c129507 100644 --- a/source/components/student-application-form/sector.fields.select.ts +++ b/source/components/student-application-form/sector.fields.select.ts @@ -19,25 +19,43 @@ import {AppSettings} from '../../app.settings'; @Component({ selector: 'sector-fields-select', - //declarations: [ - // ApplicationPreview, - //] , - - //directives:[ApplicationPreview], template: ` +
    +
    +
    -
  • +
  • {{sectorField$.name}}
  • + + +
    + +
    -
    @@ -75,7 +93,9 @@ import {AppSettings} from '../../app.settings'; this.sectorFields$ = this._ngRedux.select(state => { state.sectorFields.reduce(({}, sectorField) =>{ this.cfs.push(new FormControl(sectorField.selected, [])); - this.retrieveCheck(); + if (sectorField.selected === true) { + this.sectorActive = sectorField.id - 1; + } return sectorField; }, {}); return state.sectorFields; @@ -83,17 +103,25 @@ import {AppSettings} from '../../app.settings'; } - saveSelected() { - for (let i = 0; i < this.formGroup.value.formArray.length; i++) - this.formGroup.value.formArray[i] = false; - if (this.sectorActive != -1) - this.formGroup.value.formArray[this.sectorActive] = true; - this._cfa.saveSectorFieldsSelected(this.formGroup.value.formArray); + navigateToSchools() { + //this.saveSelected(); this.router.navigate(['/region-schools-select']); } - setActiveSector(ind) { + saveSelected() { + for (let i = 0; i < this.formGroup.value.formArray.length; i++) + this.formGroup.value.formArray[i] = false; + if (this.sectorActive != -1) + this.formGroup.value.formArray[this.sectorActive] = true; + + this._cfa.saveSectorFieldsSelected(this.formGroup.value.formArray); + } + + setActiveSectorAndSave(ind) { + if (ind === this.sectorActive) + ind = -1; this.sectorActive = ind; + this.saveSelected(); } toggleBackgroundColor(ind) { diff --git a/source/constants.ts b/source/constants.ts index c74a7fb01da569b53c051fa1264c41567a400ad1..4a0b04a26edacc71981987e1d921d58820e1510c 100644 --- a/source/constants.ts +++ b/source/constants.ts @@ -13,4 +13,8 @@ export const SECTORCOURSES_SELECTED_SAVE = 'SECTORCOURSES_SELECTED_SAVE'; export const STUDENTDATAFIELDS_RECEIVED = 'STUDENTDATAFIELDS_RECEIVED'; export const STUDENTDATAFIELDS_SAVE = 'STUDENTDATAFIELDS_SAVE'; -export const VALID_NAMES_PATTERN = '[Α-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$'; +//export const VALID_NAMES_PATTERN = '[Α-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$'; +export const VALID_NAMES_PATTERN = '[A-Za-zΑ-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$'; +export const VALID_ADDRESS_PATTERN = '[0-9A-Za-zΑ-ΩΆΈΉΊΎΌΏα-ωάέήίύόώ ]*$'; +export const VALID_ADDRESSTK_PATTERN = '[0-9 ]*$'; +export const VALID_AMKA_PATTERN = '[0-9]*$'; diff --git a/source/containers/globalstyles.css b/source/containers/globalstyles.css index 85409d6208d50a45606da83cd8cedbb25e3d3c07..903e76d23de28ae7776ad7a482aabc308e16b9a6 100644 --- a/source/containers/globalstyles.css +++ b/source/containers/globalstyles.css @@ -126,6 +126,24 @@ } } -.bootstrap-select.btn-group.show-tick .dropdown-menu li.selected a span.check-mark { - position: relative; +.form-group input[type="checkbox"] { + display: none; +} + +.form-group input[type="checkbox"] + .btn-group > label span { + width: 7px; +} + +.form-group input[type="checkbox"] + .btn-group > label span:first-child { + display: none; +} +.form-group input[type="checkbox"] + .btn-group > label span:last-child { + display: inline-block; +} + +.form-group input[type="checkbox"]:checked + .btn-group > label span:first-child { + display: inline-block; +} +.form-group input[type="checkbox"]:checked + .btn-group > label span:last-child { + display: none; } diff --git a/source/containers/main.ts b/source/containers/main.ts index d54637448fe7386f75ddcb53dbd001517dd21acd..23bfd67670c3d4ed1ad8c534627dc7b16ec26d42 100644 --- a/source/containers/main.ts +++ b/source/containers/main.ts @@ -6,6 +6,7 @@ import { } from '@angular/router'; import './globalstyles.css'; +//import '../../myschool/main.scss'; import { DevToolsExtension, NgRedux, select } from 'ng2-redux'; import { IAppState, diff --git a/source/services/helper-data-service.ts b/source/services/helper-data-service.ts index fb7809a17bbd94b5a9d9bd431bdfa473242dbd62..c3ebdb60303524a769109f8b4c0df8e6643cffc6 100644 --- a/source/services/helper-data-service.ts +++ b/source/services/helper-data-service.ts @@ -44,19 +44,26 @@ export class HelperDataService { }); }; - getRegionsWithSchools() { + getRegionsWithSchools(courseActive) { return new Promise((resolve, reject) => { - this.http.get(`${AppSettings.API_ENDPOINT}/regions/list`) - .map(response => response.json()) - .subscribe(data => { -// console.log(data); - resolve(this.transformRegionSchoolsSchema(data)); - }, // put the data returned from the server in our variable - error => { - console.log("Error HTTP GET Service"); // in case of failure show this message - reject("Error HTTP GET Service"); - }, - () => console.log("region schools service"));//run this code in all cases); */ + let getConnectionString = null; + if (courseActive === -1) + getConnectionString = `${AppSettings.API_ENDPOINT}/regions/list`; + else + getConnectionString = `${AppSettings.API_ENDPOINT}/coursesperschool/list?course_id=${courseActive}`; + + //this.http.get(`${AppSettings.API_ENDPOINT}/regions/list`) + //this.http.get(`${AppSettings.API_ENDPOINT}/`.concat(`coursesperschool/list?course_id=${courseActive}`)) + this.http.get(getConnectionString) + .map(response => response.json()) + .subscribe(data => { + resolve(this.transformRegionSchoolsSchema(data)); + }, // put the data returned from the server in our variable + error => { + console.log("Error HTTP GET Service"); // in case of failure show this message + reject("Error HTTP GET Service"); + }, + () => console.log("region schools service"));//run this code in all cases); */ }); }; @@ -109,7 +116,7 @@ export class HelperDataService { sectorCourses.forEach(sectorCourse => { if (trackSectorId !== sectorCourse.sector_id) { trackIndex++; - rsa.push({'sector_id': sectorCourse.sector_id, 'sector_name': sectorCourse.sector_name, 'sector_selected': sectorCourse.sector_selected, 'courses': Array()}); + rsa.push({'sector_id': sectorCourse.sector_id, 'sector_name': sectorCourse.sector_name, 'sector_selected': false, 'courses': Array()}); trackSectorId = sectorCourse.sector_id; } rsa[trackIndex].courses.push({'course_id': sectorCourse.course_id, 'course_name': sectorCourse.course_name, 'globalIndex': j, 'selected': false}); diff --git a/source/services/user-data-service.ts b/source/services/user-data-service.ts deleted file mode 100644 index fdd5fb484388ca1dfb2dd05bae888d059259e201..0000000000000000000000000000000000000000 --- a/source/services/user-data-service.ts +++ /dev/null @@ -1,66 +0,0 @@ -import {Http, Headers} from '@angular/http'; -import {Injectable} from '@angular/core'; -import {Observable} from "rxjs/Observable"; -import 'rxjs/add/operator/map'; -import { IStudentDataField } from '../store/studentdatafields/studentdatafields.types'; -import {AppSettings} from '../app.settings'; - -const HEADER = { headers: new Headers({ 'Content-Type': 'application/json' }) }; - -@Injectable() -export class UserDataService { - constructor(private http: Http) { - }; - getStudentDataFields() { - - return new Promise((resolve, reject) => { - this.http.get(`${AppSettings.API_ENDPOINT}/studentList`) - .map(response => response.json()) - .subscribe(data => { - resolve(data); - }, // put the data returned from the server in our variable - error => { - console.log("Error HTTP GET Service"); // in case of failure show this message - reject("Error HTTP GET Service"); - }, - () => console.log("Student Data Fields Received"));//run this code in all cases); */ - }); - }; -} - - -/* -import {Http, Headers} from '@angular/http'; -import {Injectable} from '@angular/core'; -import {Observable} from "rxjs/Observable"; -import 'rxjs/add/operator/map'; -//import { ICourseField } from '../store/coursefields/coursefields.types'; -import { IStudentDataField } from '../store/studentdatafields/studentdatafields.types'; -import {AppSettings} from '../app.settings'; - -const HEADER = { headers: new Headers({ 'Content-Type': 'application/json' }) }; - -@Injectable() -//export class HelperDataService { -export class UserDataService { - constructor(private http: Http) { - }; - getStudentDataFields() { - - return new Promise((resolve, reject) => { - //this.http.get(`${AppSettings.API_ENDPOINT}/coursefields/list`) - this.http.get(`${AppSettings.API_ENDPOINT}/studentList`) - .map(response => response.json()) - .subscribe(data => { - console.log(data); - resolve(data); - }, - error => { - console.log("Error HTTP GET Service"); // in case of failure show this message - reject("Error HTTP GET Service"); - }, - () => console.log("Student Fields Received")); - }); - }; -} -*/ diff --git a/source/store/sectorcourses/sectorcourses.reducer.ts b/source/store/sectorcourses/sectorcourses.reducer.ts index 650122ba25f744c1dba7133bab77ac51592b6614..4d9bb3fdc961adc545e57d1a221337d4c40dc2a0 100644 --- a/source/store/sectorcourses/sectorcourses.reducer.ts +++ b/source/store/sectorcourses/sectorcourses.reducer.ts @@ -25,7 +25,7 @@ export function sectorCoursesReducer(state: ISectors = INITIAL_STATE, action): I let sectorsWithSelections = Array(); let ind=0, j = 0; state.forEach(sector => { - sectorsWithSelections.push({sector_id: sector.sector_id, sector_name: sector.sector_name, sector_selected: sector.sector_selected, courses: Array()}); + sectorsWithSelections.push({sector_id: sector.sector_id, sector_name: sector.sector_name, sector_selected: action.payload.sectorSelected[ind], courses: Array()}); sector.courses.forEach(course => { sectorsWithSelections[ind].courses.push({course_id: course.course_id, course_name: course.course_name, globalIndex: course.globalIndex, selected: action.payload.sectorCoursesSelected[j]}); j++;