Commit 06ee6f8e authored by Open Source Developer's avatar Open Source Developer

merge

Merge branch 'develop' of https://git.minedu.gov.gr/itminedu/e-epal into loginpage

Conflicts:
	package.json
	source/app.settings.ts
	source/app.ts
	source/components/student-application-form/application.preview.ts
	source/constants.ts
parents 38090a82 854b26fa
...@@ -10,10 +10,10 @@ export class RegionSchoolsActions { ...@@ -10,10 +10,10 @@ export class RegionSchoolsActions {
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) {} private _hds: HelperDataService) {}
getRegionSchools = () => { getRegionSchools = (courseActive, reload) => {
const { regions } = this._ngRedux.getState(); const { regions } = this._ngRedux.getState();
if (regions.size === 0) { if (reload === true || (reload === false && regions.size === 0)) {
return this._hds.getRegionsWithSchools().then(regions => { return this._hds.getRegionsWithSchools(courseActive).then(regions => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: REGIONSCHOOLS_RECEIVED, type: REGIONSCHOOLS_RECEIVED,
payload: { payload: {
...@@ -24,6 +24,22 @@ export class RegionSchoolsActions { ...@@ -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) => { saveRegionSchoolsSelected = (regionSchoolsSelected) => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: REGIONSCHOOLS_SELECTED_SAVE, type: REGIONSCHOOLS_SELECTED_SAVE,
......
...@@ -10,9 +10,10 @@ export class SectorCoursesActions { ...@@ -10,9 +10,10 @@ export class SectorCoursesActions {
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) {} private _hds: HelperDataService) {}
getSectorCourses = () => { 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)) {
return this._hds.getSectorsWithCourses().then(sectors => { return this._hds.getSectorsWithCourses().then(sectors => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: SECTORCOURSES_RECEIVED, type: SECTORCOURSES_RECEIVED,
...@@ -24,11 +25,28 @@ export class SectorCoursesActions { ...@@ -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({ return this._ngRedux.dispatch({
type: SECTORCOURSES_SELECTED_SAVE, type: SECTORCOURSES_SELECTED_SAVE,
payload: { payload: {
sectorCoursesSelected sectorCoursesSelected,
sectorSelected
} }
}); });
}; };
......
...@@ -2,8 +2,7 @@ import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_RECEIVED } from '../constants ...@@ -2,8 +2,7 @@ import { STUDENTDATAFIELDS_SAVE, STUDENTDATAFIELDS_RECEIVED } from '../constants
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux'; import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store'; 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() @Injectable()
......
...@@ -5,5 +5,8 @@ export class AppSettings { ...@@ -5,5 +5,8 @@ export class AppSettings {
// return 'http://localhost/drupal-8.2.5'; // return 'http://localhost/drupal-8.2.5';
// return 'http://eepal.dev/drupal'; // return 'http://eepal.dev/drupal';
// return 'http://eduslim2.minedu.gov.gr/drupal'; // return 'http://eduslim2.minedu.gov.gr/drupal';
// return 'http://localhost/drupal-8.2.5';
// return 'http://eepal.dev/drupal';
// return 'http://eduslim2.minedu.gov.gr/drupal';
} }
} }
...@@ -26,10 +26,14 @@ import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from './app.routes'; ...@@ -26,10 +26,14 @@ import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from './app.routes';
/* Here we import services */ /* Here we import services */
import {HelperDataService} from './services/helper-data-service'; import {HelperDataService} from './services/helper-data-service';
import {UserDataService} from './services/user-data-service'; import {UserDataService} from './services/user-data-service';
import {AmkaCheckService} from './services/amkacheck-service'; import {AmkaCheckService} from './services/amkacheck-service';
//import {UserDataService} from './services/user-data-service';
import { ACTION_PROVIDERS } from './actions'; import { ACTION_PROVIDERS } from './actions';
import Home from './components/home'; import Home from './components/home';
import { Ng2SmartTableModule } from 'ng2-smart-table'; import { Ng2SmartTableModule } from 'ng2-smart-table';
...@@ -74,10 +78,12 @@ class MyLocalization extends NgLocalization { ...@@ -74,10 +78,12 @@ class MyLocalization extends NgLocalization {
{ provide: NgLocalization, useClass: MyLocalization }, { provide: NgLocalization, useClass: MyLocalization },
DevToolsExtension, DevToolsExtension,
ACTION_PROVIDERS, ACTION_PROVIDERS,
// Service1, again services here //Service1, again services here
HelperDataService, HelperDataService,
UserDataService, UserDataService,
AmkaCheckService, AmkaCheckService,
] ]
}) })
class AppModule {} class AppModule {}
......
<div class="row equal"> <div class="row equal">
<div class="col-md-8"> <div class="col-md-8">
<form novalidate [formGroup]="studentDataGroup"> <form novalidate (ngSubmit)="onSubmit(studentDataGroup)" [formGroup]="studentDataGroup">
<div *ngFor="let studentDataField$ of studentDataFields$ | async; "> </div> <div *ngFor="let studentDataField$ of studentDataFields$ | async; "> </div>
<div class="form-group"> <div class="form-group">
<label for="studentAmka">ΑΜΚΑ μαθητή</label><input class="form-control" type="text" formControlName="studentAmka"> <label for="studentAmka">ΑΜΚΑ μαθητή</label><input class="form-control" type="text" formControlName="studentAmka">
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentAmka').touched && studentDataGroup.get('studentAmka').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentAmka').dirty && studentDataGroup.get('studentAmka').hasError('pattern')">
Επιτρέπονται μόνο ψηφία σε αυτό το πεδίο!
</div>
<div class="form-group"> <div class="form-group">
<label for="studentFirstname">Όνομα μαθητή</label><input class="form-control" type="text" formControlName="studentFirstname"> <label for="studentFirstname">Όνομα μαθητή</label><input class="form-control" type="text" formControlName="studentFirstname">
...@@ -13,7 +19,7 @@ ...@@ -13,7 +19,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentFirstname').touched && studentDataGroup.get('studentFirstname').hasError('required')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('studentFirstname').touched && studentDataGroup.get('studentFirstname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό! Το πεδίο δεν μπορεί να αφεθεί κενό!
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentFirstname').touched && studentDataGroup.get('studentFirstname').hasError('pattern')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('studentFirstname').dirty && studentDataGroup.get('studentFirstname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο! Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div> </div>
...@@ -23,7 +29,7 @@ ...@@ -23,7 +29,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentSurname').touched && studentDataGroup.get('studentSurname').hasError('required')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('studentSurname').touched && studentDataGroup.get('studentSurname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό! Το πεδίο δεν μπορεί να αφεθεί κενό!
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentSurname').touched && studentDataGroup.get('studentSurname').hasError('pattern')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('studentSurname').dirty && studentDataGroup.get('studentSurname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο! Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div> </div>
...@@ -33,7 +39,7 @@ ...@@ -33,7 +39,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianFirstname').touched && studentDataGroup.get('guardianFirstname').hasError('required')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianFirstname').touched && studentDataGroup.get('guardianFirstname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό! Το πεδίο δεν μπορεί να αφεθεί κενό!
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianFirstname').touched && studentDataGroup.get('guardianFirstname').hasError('pattern')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianFirstname').dirty && studentDataGroup.get('guardianFirstname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο! Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div> </div>
...@@ -44,7 +50,7 @@ ...@@ -44,7 +50,7 @@
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianSurname').touched && studentDataGroup.get('guardianSurname').hasError('required')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianSurname').touched && studentDataGroup.get('guardianSurname').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό! Το πεδίο δεν μπορεί να αφεθεί κενό!
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianSurname').touched && studentDataGroup.get('guardianSurname').hasError('pattern')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('guardianSurname').dirty && studentDataGroup.get('guardianSurname').hasError('pattern')">
Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο! Δεν επιτρέπονται ψηφία ή άλλοι μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div> </div>
...@@ -54,16 +60,34 @@ ...@@ -54,16 +60,34 @@
<div class="form-group"> <div class="form-group">
<label for="regionAddress">Διεύθυνση κατοικίας</label><input class="form-control" type="text" formControlName="regionAddress"> <label for="regionAddress">Διεύθυνση κατοικίας</label><input class="form-control" type="text" formControlName="regionAddress">
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionAddress').touched && studentDataGroup.get('regionAddress').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionAddress').dirty && studentDataGroup.get('regionAddress').hasError('pattern')">
Δεν επιτρέπονται μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
</td> </td>
<td> <td>
<div class="form-group"> <div class="form-group">
<label for="regionTK">TK </label><input class="form-control" type="text" formControlName="regionTK"> <label for="regionTK">TK </label><input class="form-control" type="text" formControlName="regionTK">
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionTK').touched && studentDataGroup.get('regionTK').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionTK').dirty && studentDataGroup.get('regionTK').hasError('pattern')">
Δεν επιτρέπονται γράμματα αλφαβήτου ή μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
</td> </td>
<td> <td>
<div class="form-group"> <div class="form-group">
<label for="regionArea">Πόλη/Περιοχή</label><input class="form-control" type="text" formControlName="regionArea"> <label for="regionArea">Πόλη/Περιοχή</label><input class="form-control" type="text" formControlName="regionArea">
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionArea').touched && studentDataGroup.get('regionArea').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('regionArea').dirty && studentDataGroup.get('regionArea').hasError('pattern')">
Δεν επιτρέπονται μη έγκυροι χαρακτήρες σε αυτό το πεδίο!
</div>
</td> </td>
</tr> </tr>
</table> </table>
...@@ -76,7 +100,7 @@ ...@@ -76,7 +100,7 @@
<option value="Απολυτήριο Λυκείου">Απολυτήριο Λυκείου</option> <option value="Απολυτήριο Λυκείου">Απολυτήριο Λυκείου</option>
</select> </select>
</div> </div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('certificateType').touched && studentDataGroup.get('certificateType').hasError('required')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('certificateType').dirty && studentDataGroup.get('certificateType').hasError('required')">
Η επιλογή από αυτή τη λίστα είναι απαραίτητη! Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
</div> </div>
...@@ -87,7 +111,7 @@ ...@@ -87,7 +111,7 @@
<option value="Γονέας/Κηδεμόνας">Γονέας/Κηδεμόνας</option> <option value="Γονέας/Κηδεμόνας">Γονέας/Κηδεμόνας</option>
<option value="Μαθητής">Μαθητής</option> <option value="Μαθητής">Μαθητής</option>
</select> </select>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('relationToStudent').touched && studentDataGroup.get('relationToStudent').hasError('required')"> <div class="alert alert-danger" *ngIf="studentDataGroup.get('relationToStudent').dirty && studentDataGroup.get('relationToStudent').hasError('required')">
Η επιλογή από αυτή τη λίστα είναι απαραίτητη! Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
</div> </div>
</div> </div>
...@@ -99,7 +123,7 @@ ...@@ -99,7 +123,7 @@
</button> </button>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<button type="button" class="btn-primary btn-lg pull-center" (click)="submitSelected()"> <button type="button" class="btn-primary btn-lg pull-center" (click)="submitSelected()" [disabled]="studentDataGroup.invalid">
Αποστολή<span class="glyphicon glyphicon-menu-right"></span> Αποστολή<span class="glyphicon glyphicon-menu-right"></span>
</button> </button>
</div> </div>
......
...@@ -7,7 +7,7 @@ import { NgRedux, select } from 'ng2-redux'; ...@@ -7,7 +7,7 @@ import { NgRedux, select } from 'ng2-redux';
import { IStudentDataFields } from '../../store/studentdatafields/studentdatafields.types'; import { IStudentDataFields } from '../../store/studentdatafields/studentdatafields.types';
import { ICourseFields } from '../../store/coursefields/coursefields.types'; import { ICourseFields } from '../../store/coursefields/coursefields.types';
import { IAppState } from '../../store/store'; 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 { import {
FormBuilder, FormBuilder,
...@@ -33,6 +33,7 @@ import { ...@@ -33,6 +33,7 @@ import {
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private router: Router) { private router: Router) {
this.studentDataGroup = this.fb.group({ this.studentDataGroup = this.fb.group({
/*
studentAmka: ['12346', Validators.required], studentAmka: ['12346', Validators.required],
studentFirstname: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], studentFirstname: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
studentSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], studentSurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
...@@ -43,6 +44,17 @@ import { ...@@ -43,6 +44,17 @@ import {
regionArea: ['ΠΑΤΡΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]], regionArea: ['ΠΑΤΡΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
certificateType: ['Απολυτήριο Λυκείου', Validators.required], certificateType: ['Απολυτήριο Λυκείου', Validators.required],
relationToStudent: ['Μαθητής', 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],
}); });
}; };
...@@ -56,13 +68,6 @@ import { ...@@ -56,13 +68,6 @@ import {
} }
return state.studentDataFields; return state.studentDataFields;
}); });
this.courseFields$ = this._ngRedux.select(state => {
state.courseFields.reduce(({}, courseField) =>{
return courseField;
}, {});
return state.courseFields;
});
} }
saveSelected() { saveSelected() {
......
...@@ -56,11 +56,21 @@ import {AppSettings} from '../../app.settings'; ...@@ -56,11 +56,21 @@ import {AppSettings} from '../../app.settings';
<div class="row"> <div class="row">
<div class="btn-group inline pull-center"> <div class="btn-group inline pull-center">
<button type="button" class="btn-primary btn-md pull-center" (click)="defineCourse()"> <button type="button" class="btn-primary btn-md pull-center" (click)="defineCourse()" >
Η ειδικότητά μου<span class="glyphicon glyphicon-menu-right"></span> Η ειδικότητά μου<span class="glyphicon glyphicon-menu-right"></span>
</button> </button>
</div> </div>
</div> </div>
<!--
<div class="row">
<div class="btn-group inline pull-right">
<button class="btn-primary btn-md pull-right my-btn" type="button" (click)="defineCourse()" [hidden] = "numSelectedCourses === 0" >
Επαναφορά<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
<ul class="list-group" style="margin-bottom: 20px;"> <ul class="list-group" style="margin-bottom: 20px;">
<div *ngFor="let sector$ of sectors$ | async;"> <div *ngFor="let sector$ of sectors$ | async;">
<div *ngFor="let course$ of sector$.courses;" > <div *ngFor="let course$ of sector$.courses;" >
...@@ -73,7 +83,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -73,7 +83,7 @@ import {AppSettings} from '../../app.settings';
<div class="row"> <div class="row">
<div class="btn-group inline pull-center"> <div class="btn-group inline pull-center">
<button type="button" class="btn-primary btn-md pull-center" (click)="defineSchools()"> <button type="button" id = "butsch" class="btn-primary btn-md pull-center" (click)="defineSchools()" [disabled] = "numSelectedSchools === 0 ">
Τα σχολεία μου<span class="glyphicon glyphicon-menu-right"></span> Τα σχολεία μου<span class="glyphicon glyphicon-menu-right"></span>
</button> </button>
</div> </div>
...@@ -119,6 +129,10 @@ import {AppSettings} from '../../app.settings'; ...@@ -119,6 +129,10 @@ import {AppSettings} from '../../app.settings';
private epalclasses$: Observable<IEpalClasses>; private epalclasses$: Observable<IEpalClasses>;
private courseActive = "-1";
private numSelectedSchools = <number>0;
//private numSelectedCourses = <number>0;
constructor(private _rsa: SectorCoursesActions, constructor(private _rsa: SectorCoursesActions,
private _rsb: RegionSchoolsActions, private _rsb: RegionSchoolsActions,
private _rsc: SectorFieldsActions, private _rsc: SectorFieldsActions,
...@@ -130,29 +144,36 @@ import {AppSettings} from '../../app.settings'; ...@@ -130,29 +144,36 @@ import {AppSettings} from '../../app.settings';
}; };
ngOnInit() { ngOnInit() {
this._rsa.getSectorCourses(); this.courseActive = this.getCourseActive();
this.sectors$ = this._ngRedux.select(state => { this.sectors$ = this._ngRedux.select(state => {
//let numsel = 0;
state.sectors.reduce((prevSector, sector) =>{ state.sectors.reduce((prevSector, sector) =>{
sector.courses.reduce((prevCourse, course) =>{ sector.courses.reduce((prevCourse, course) =>{
//if (course.selected === true) {
// numsel++;
//}
return course; return course;
}, {}); }, {});
return sector; return sector;
}, {}); }, {});
//this.numSelectedCourses = numsel;
return state.sectors; return state.sectors;
}); });
this._rsb.getRegionSchools();
this.regions$ = this._ngRedux.select(state => { this.regions$ = this._ngRedux.select(state => {
state.regions.reduce((prevRegion, region) =>{ let numsel = 0;
region.epals.reduce((prevSchool, school) =>{ state.regions.reduce((prevRegion, region) =>{
return school; region.epals.reduce((prevEpal, epal) =>{
}, {}); if (epal.selected === true)
return region; numsel++;
}, {}); return epal;
return state.regions; }, {});
}); return region;
}, {});
this.numSelectedSchools = numsel;
return state.regions;
});
this._rsc.getSectorFields();
this.sectorFields$ = this._ngRedux.select(state => { this.sectorFields$ = this._ngRedux.select(state => {
state.sectorFields.reduce(({}, sectorField) =>{ state.sectorFields.reduce(({}, sectorField) =>{
return sectorField; return sectorField;
...@@ -181,9 +202,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -181,9 +202,7 @@ import {AppSettings} from '../../app.settings';
defineSector() { defineSector() {
this.router.navigate(['/sector-fields-select']); this.router.navigate(['/sector-fields-select']);
} }
defineCourse() {
this.router.navigate(['/sectorcourses-fields-select']);
}
defineSchools() { defineSchools() {
this.router.navigate(['/region-schools-select']); this.router.navigate(['/region-schools-select']);
} }
...@@ -195,4 +214,51 @@ import {AppSettings} from '../../app.settings'; ...@@ -195,4 +214,51 @@ import {AppSettings} from '../../app.settings';
} }
getCourseActive() {
const { sectors } = this._ngRedux.getState();
let l,m;
for ( l=0; l<sectors.size; l++)
if (sectors["_tail"]["array"][l]["sector_selected"] === true)
for ( m=0; m < sectors["_tail"]["array"][l]["courses"].length; m++)
if (sectors["_tail"]["array"][l]["courses"][m]["selected"] === true)
return sectors["_tail"]["array"][l]["courses"][m]["course_id"];
}
/*
defineCourse() {
this._rsb.getRegionSchools("-1", true);
this.regions$ = this._ngRedux.select(state => {
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']);
}
} }