Commit 7e10b99b authored by Νίκος Κατσαούνος's avatar Νίκος Κατσαούνος
Browse files

updated Criteria Redux Store, updated application.form.main Component, updated...

updated Criteria Redux Store, updated application.form.main Component, updated Disrtibution Controllers in order to support pdo connection
parent 0c26ebb4
......@@ -71,11 +71,11 @@ class ApplicationSubmit extends ControllerBase {
'epaluser_id' => $epalUser->id(),
'name' => $applicationForm[0][name],
'studentsurname' => $applicationForm[0][studentsurname],
//'birthdate' => $applicationForm[0][birthdate],
//'fatherfirstname' => $applicationForm[0][fatherfirstname],
//'fathersurname' => $applicationForm[0][fathersurname],
//'motherfirstname' => $applicationForm[0][motherfirstname],
//'mothersurname' => $applicationForm[0][mothersurname],
'birthdate' => $applicationForm[0][studentbirthdate],
'fatherfirstname' => $applicationForm[0][fatherfirstname],
'fathersurname' => $applicationForm[0][fathersurname],
'motherfirstname' => $applicationForm[0][motherfirstname],
'mothersurname' => $applicationForm[0][mothersurname],
'studentamka' => $applicationForm[0][studentamka],
'regionaddress' => $applicationForm[0][regionaddress],
'regionarea' => $applicationForm[0][regionarea],
......@@ -85,6 +85,7 @@ class ApplicationSubmit extends ControllerBase {
'currentclass' => $applicationForm[0][currentclass],
//'currentepal' => $applicationForm[0][currentepal],
//'currentsector' => $applicationForm[0][currentsector],
'points' => $applicationForm[0][points],
'relationtostudent' => $applicationForm[0][relationtostudent],
'telnum' => $applicationForm[0][telnum]
);
......
......@@ -12,6 +12,8 @@ dependencies:
- rest
- serialization
- user
_core:
default_config_hash: 2NbNzaqbe_smf6WW5GA6xdNaOyLrqo5IfrwynZngc0k
id: criterialist
label: criteriaList
module: views
......@@ -213,6 +215,71 @@ display:
multi_type: separator
separator: ', '
field_api_classes: false
category:
id: category
table: epal_criteria
field: category
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: string
settings:
link_to_entity: false
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: epal_criteria
entity_field: category
plugin_id: field
mutual_disabled_id:
id: mutual_disabled_id
table: epal_criteria
......@@ -279,6 +346,74 @@ display:
entity_type: epal_criteria
entity_field: mutual_disabled_id
plugin_id: field
moria:
id: moria
table: epal_criteria
field: moria
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: number_decimal
settings:
thousand_separator: ''
prefix_suffix: true
decimal_separator: .
scale: 2
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: epal_criteria
entity_field: moria
plugin_id: field
filters: { }
sorts: { }
header: { }
......@@ -326,9 +461,15 @@ display:
name:
alias: ''
raw_output: true
category:
alias: ''
raw_output: true
mutual_disabled_id:
alias: ''
raw_output: true
moria:
alias: points
raw_output: true
auth:
- basic_auth
cache_metadata:
......
......@@ -77,9 +77,22 @@
</div>
<div class="form-group">
<label for="studentbirthdate">Ημερομηνία γέννησης</label><input class="form-control" type="date" formControlName="studentbirthdate">
<label for="studentbirthdate">Ημερομηνία γέννησης</label>
<input class="form-control" type="text" formControlName="studentbirthdate">
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').pristine ">
Η ημερομηνία γέννησης πρέπει να είναι της μορφής ΗΗ/ΜΜ/ΕΕΕΕ
</div>
<div class="alert alert-danger" *ngIf="studentDataGroup.get('studentbirthdate').dirty && studentDataGroup.get('studentbirthdate').hasError('pattern')">
Η ημερομηνία γέννησης πρέπει να είναι της μορφής ΗΗ/ΜΜ/ΕΕΕΕ
</div>
<table>
<tr>
<td>
......@@ -157,19 +170,19 @@
<!--
<fieldset class="group">
-->
<legend>Εισοδηματικά κριτήρια</legend>
<!-- TEST for defining income in combolist in a redux-dynamic way-->
<!--
<select #cblsttest class="form-control" (change)="checkstatus(cblsttest)" formControlName="incometest">
<option *ngFor="let criter$ of criteria$ | async; let i=index">
<option *ngFor="let criterIncome$ of criteriaIncome$ | async; let i=index">
<div *ngIf="criter$.name === 'Εισόδημα' && criter$.name !== 'Απόσταση'">
{{criter$.name}}> </div> </option>
{{criterIncome$.name}}> </div> </option>
</select>
-->
<!--
<div class="form-group">
<label for="income">Το κατά κεφαλήν εισόδημα στο προηγούμενο φορολογικό έτος είναι:</label><br/>
<select #cblst class="form-control" (change)="checkstatus(cblst)" formControlName="income">
<option value="noincomecriterio" [selected] = "selectionIncomeId === 0" >Παρακαλώ επιλέξτε..</option>
......@@ -183,19 +196,15 @@
Η επιλογή από αυτή τη λίστα είναι απαραίτητη!
</div>
</div>
-->
<div formArrayName="formArray">
<legend>Κοινωνικά κριτήρια</legend>
<p style="margin-top: 15px; line-height: 1.5em;">Επιλέξτε όσα από τα παρακάτω κριτήρια πληρούνται για εσάς.
Οι επιλογές σας επέχουν θέση υπέυθυνης δήλωσης.
Θα πρέπει να προσκομίσετε τα αντίστοιχα δικαιολογητικά στο σχολείο εγγραφής σας, όταν σας ζητηθεί.
</p>
<div *ngFor="let criter$ of criteria$ | async; let i=index">
<div class="row" *ngIf="criter$.name !== 'Εισόδημα' && criter$.name !== 'Απόσταση'">
<legend>Εισοδηματικά κριτήρια</legend>
<div *ngFor="let criter$ of criteria$ | async; let j=index">
<div class="row" *ngIf="criter$.category === 'Εισοδηματικό' ">
<div class="col-md-1">
<input #cb type="checkbox" (change)="checkcriteria(cb, criter$.mutual_disabled_id)" formControlName={{i}}>
<input #cb type="checkbox" (change)="checkcriteria(cb, criter$.mutual_disabled_id)" formControlName={{j}}>
</div>
<div class="col-md-11 pull-left">
{{criter$.name}}
......@@ -203,9 +212,14 @@
</div>
</div>
<legend>Κοινωνικά κριτήρια</legend>
<p style="margin-top: 15px; line-height: 1.5em;">Επιλέξτε όσα από τα παρακάτω κριτήρια πληρούνται για εσάς.
Οι επιλογές σας επέχουν θέση υπέυθυνης δήλωσης.
Θα πρέπει να προσκομίσετε τα αντίστοιχα δικαιολογητικά στο σχολείο εγγραφής σας, όταν σας ζητηθεί.
</p>
<div *ngFor="let criter$ of criteria$ | async; let i=index">
<div class="row" *ngIf="criter$.name === 'Εισόδημα' && criter$.name !== 'Απόσταση'">
<div class="row" *ngIf="criter$.category === 'Κοινωνικό' ">
<div class="col-md-1">
<input #cb type="checkbox" (change)="checkcriteria(cb, criter$.mutual_disabled_id)" formControlName={{i}}>
</div>
......@@ -233,7 +247,7 @@
</button>
</div>
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right" (click)="submitSelected()" [disabled]="studentDataGroup.invalid || (studentCriteriaGroup.invalid || selectionIncomeId === 0)" >
<button type="button" class="btn-primary btn-lg pull-right" (click)="submitSelected()" [disabled]="studentDataGroup.invalid || studentCriteriaGroup.invalid " >
<i class="fa fa-forward"></i>
</button>
</div>
......
......@@ -8,7 +8,7 @@ import { IStudentDataFields } from '../../store/studentdatafields/studentdatafie
import { CriteriaActions } from '../../actions/criteria.actions';
import { ICriter } from '../../store/criteria/criteria.types';
import { IAppState } from '../../store/store';
import { VALID_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_DIGITS_PATTERN } from '../../constants';
import { VALID_NAMES_PATTERN, VALID_ADDRESS_PATTERN, VALID_ADDRESSTK_PATTERN, VALID_DIGITS_PATTERN, VALID_DATE_PATTERN } from '../../constants';
import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields/studentdatafields.initial-state';
import { CRITERIA_INITIAL_STATE } from '../../store/criteria/criteria.initial-state';
......@@ -38,9 +38,9 @@ import {
public studentCriteriaGroup: FormGroup;
private rss = new FormArray([]);
private selectionIncomeId = <number>0;
//private selectionIncomeId = <number>0;
private sdate; // = Date.now();
//private sdate;// = new Date(2013,7,29); // = Date.now();
//date: [datePipe.transform(this.event.date, 'yyyy-MM-dd'), [Validators.required]]
constructor(private fb: FormBuilder,
......@@ -55,8 +55,8 @@ import {
epaluser_id: [,[]],
name: ['ΝΙΚΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
studentsurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
studentbirthdate: [this.sdate, [Validators.required]],
//studentbirthdate: [datePipe.transform(this.event.date, 'yyyy-MM-dd'), [Validators.required]],
//studentbirthdate: [this.sdate, [Validators.required]],
studentbirthdate: ['', [Validators.pattern(VALID_DATE_PATTERN),Validators.required]],
fatherfirstname: ['ΑΝΑΣΤΑΣΙΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
fathersurname: ['ΚΑΤΣΑΟΥΝΟΣ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
motherfirstname: ['ΚΑΤΕΡΙΝΑ', [Validators.pattern(VALID_NAMES_PATTERN),Validators.required]],
......@@ -76,10 +76,10 @@ import {
this.studentCriteriaGroup = this.fb.group({
formArray: this.rss,
income: ['', this.checkChoice ],
//income: ['', this.checkChoice ],
//income: ['noincomecriterio', Validators.required ],
//income: [this.selectionIncomeId, this.checkChoice ],
incometest: ['noincomecriterio', this. checkChoice ],
//incometest: ['noincomecriterio', this. checkChoice ],
});
};
......@@ -101,9 +101,10 @@ import {
if (state.criter.size > 0) {
state.criter.reduce(({}, criteria) => {
//this.studentCriteriaGroup.setValue(criteria);
if (criteria.selected === true && (criteria.name === "Εισόδημα" )) {
this.selectionIncomeId = Number(criteria.id);
}
//if (criteria.selected === true && (criteria.name === "Εισόδημα" )) {
// this.selectionIncomeId = Number(criteria.id);
//}
this.rss.push( new FormControl(criteria.selected, []));
return criteria;
}, {});
......@@ -126,11 +127,6 @@ import {
submitSelected() {
this._sdfa.saveStudentDataFields([this.studentDataGroup.value]);
for (let i=7; i < 11; i++)
this.studentCriteriaGroup.controls['formArray']['controls'][i].setValue(false);
this.studentCriteriaGroup.controls['formArray']['controls'][this.selectionIncomeId-1].setValue(true);
this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
this.router.navigate(['/application-submit']);
......@@ -138,11 +134,21 @@ import {
checkcriteria(cb, mutual_disabled) {
if (mutual_disabled !== "-1" && cb.checked === true) {
this.studentCriteriaGroup.controls['formArray']['controls'][mutual_disabled-1].setValue(false);
//this.studentCriteriaGroup.controls['formArray']['controls'][mutual_disabled-1].setValue(false);
let mutual_ids = mutual_disabled.split(",");
for (let i=0; i<mutual_ids.length; i++) {
this.studentCriteriaGroup.controls['formArray']['controls'][mutual_ids[i]-1].setValue(false);
}
}
//this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
}
/*
checkstatus(cb) {
if (cb.value === "<= 3000 Ευρώ")
this.selectionIncomeId = 8;
else if (cb.value === "<= 6000 Ευρώ")
......@@ -152,6 +158,7 @@ import {
else if (cb.value === "> 9000 Ευρώ")
this.selectionIncomeId = 11;
}
*/
//checkChoice(c: FormControl) {
checkChoice(c: FormControl) {
......
......@@ -41,6 +41,7 @@ import {AppSettings} from '../../app.settings';
private courseSelected;
private sectorSelected;
private classSelected;
private totalPoints= <number>0;
private studentDataFields$: BehaviorSubject<IStudentDataFields>;
private regions$: BehaviorSubject<IRegions>;
private criteria$: BehaviorSubject<ICriter>;
......@@ -120,8 +121,11 @@ import {AppSettings} from '../../app.settings';
if (state.criter.size > 0) {
state.criter.reduce(({}, criteria) => {
//code to be replaced in next version
if (criteria.selected === true && Number(criteria.id) !== 11)
//if (criteria.selected === true && Number(criteria.id) !== 11)
if (criteria.selected === true ) {
this.studentCriteria.push(Number(criteria.id));
this.totalPoints = this.totalPoints + Number(criteria.points);
}
return criteria;
}, {});
......@@ -129,7 +133,6 @@ import {AppSettings} from '../../app.settings';
return state.criter;
}).subscribe(this.criteria$);
this.sectorsSub = this._ngRedux.select(state => {
state.sectors.reduce((prevSector, sector) =>{
sector.courses.reduce((prevCourse, course) =>{
......@@ -178,11 +181,11 @@ import {AppSettings} from '../../app.settings';
let epalObj: Array<StudentEpalChosen> = [];
let criteriaObj: Array<StudentCriteriaChosen> = [];
//aitisiObj[0] = studentDataFields["_tail"]["array"][0];
aitisiObj[0] = this.student;
console.log("Hello:"); console.log(aitisiObj[0]['studentbirthdate']);
//console.log(aitisiObj[0]['studentbirthdate']);
aitisiObj[0]['currentclass'] = this.classSelected;
//aitisiObj[0]['studentamka'] = ...;
aitisiObj[0]['points'] = this.totalPoints;
for (let i=0; i < this.epalSelected.length; i++)
epalObj[i] =new StudentEpalChosen(null, this.epalSelected[i] , this.epalSelectedOrder[i]);
......
......@@ -36,4 +36,14 @@ 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_DIGITS_PATTERN = '[0-9]*$';
export const VALID_EMAIL_PATTERN = '[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}';
//YYYY-MM-DD FULL
//export const VALID_DATE_PATTERN = '(?:19|20)[0-9]{2}/(?:(?:0[1-9]|1[0-2])/(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))';
//MM-DD-YYYY FULL
//export const VALID_DATE_PATTERN = '(?:(?:0[1-9]|1[0-2])[\/\\-. ]?(?:0[1-9]|[12][0-9])|(?:(?:0[13-9]|1[0-2])[\/\\-. ]?30)|(?:(?:0[13578]|1[02])[\/\\-. ]?31))[\/\\-. ]?(?:19|20)[0-9]{2}';
//DD-MM-YYYY
export const VALID_DATE_PATTERN = '([1-9]|0[1-9]|[12][0-9]|3[01])[- /.]([1-9]|0[1-9]|1[012])[- /.](19|20)[0-9][0-9]';
......@@ -308,6 +308,7 @@ export class HelperDataService {
}
getCriteria() {
this.loginInfo$.forEach(loginInfoToken => {
console.log(loginInfoToken.get(0));
this.authToken = loginInfoToken.get(0).auth_token;
......@@ -320,6 +321,7 @@ export class HelperDataService {
let options = new RequestOptions({ headers: headers });
return new Promise((resolve, reject) => {
this.http.get(`${AppSettings.API_ENDPOINT}/criteria/list`, options)
//this.http.get(`${AppSettings.API_ENDPOINT}/criteria/list?category=${category}`, options)
.map(response => <ISectorField[]>response.json())
.subscribe(data => {
resolve(data);
......@@ -533,7 +535,7 @@ export class HelperDataService {
() => console.log("Saving Profile"));
});
}
}
......@@ -562,7 +564,7 @@ export class HelperDataService {
() => console.log("Saving Capacity"));
});
}
}
......
......@@ -13,7 +13,8 @@ export function criteriaReducer(state: ICriter = CRITERIA_INITIAL_STATE, action)
let newCriter = Array<ICriteria>();
let i=0;
action.payload.criteria.forEach(criteria => {
newCriter.push(<ICriteria>{id: criteria.id, name: criteria.name, mutual_disabled_id: criteria.mutual_disabled_id, selected: false});
newCriter.push(<ICriteria>{id: criteria.id, name: criteria.name, category: criteria.category,
points: criteria.points, mutual_disabled_id: criteria.mutual_disabled_id, selected: false});
i++;
});
return Seq(newCriter).map(n => n).toList();
......@@ -22,7 +23,8 @@ export function criteriaReducer(state: ICriter = CRITERIA_INITIAL_STATE, action)
let criter = Array<ICriteria>();
let ind=0;
state.forEach(criteria => {
criter.push(<ICriteria>{id: criteria.id, name: criteria.name, mutual_disabled_id: criteria.mutual_disabled_id, selected: action.payload.criter[0][ind]});
criter.push(<ICriteria>{id: criteria.id, name: criteria.name, category: criteria.category,
points: criteria.points, mutual_disabled_id: criteria.mutual_disabled_id, selected: action.payload.criter[0][ind]});
ind++;
});
......
......@@ -4,7 +4,8 @@ export function deimmutifyCriteria(state: ICriter): ICriteria[] {
let fetchedCriteria = new Array();
state.forEach(criteria => {
fetchedCriteria.push(<ICriteria>{id: criteria.id, name: criteria.name, mutual_disabled_id: criteria.mutual_disabled_id, selected: criteria.selected,
fetchedCriteria.push(<ICriteria>{id: criteria.id, name: criteria.name, category: criteria.category,
mutual_disabled_id: criteria.mutual_disabled_id, points: criteria.points, selected: criteria.selected,
});
});
return fetchedCriteria;
......
......@@ -3,7 +3,9 @@ import { List } from 'immutable';
export interface ICriteria {
id: string;
name: string;
mutual_disabled_id: string,
category: string;
mutual_disabled_id: string;
points: string;
selected: boolean;
}
......
......@@ -21,7 +21,7 @@ export function deimmutifyStudentDataFields(state: IStudentDataFields): IStudent
studentamka: studentdataField.studentamka, regionaddress: studentdataField.regionaddress,
regiontk: studentdataField.regiontk,regionarea: studentdataField.regionarea,
certificatetype: studentdataField.certificatetype, relationtostudent: studentdataField.relationtostudent,
currentclass: studentdataField.currentclass
currentclass: studentdataField.currentclass, points: studentdataField.points
});
});
return fetchedStudentDataFields;
......
......@@ -30,6 +30,7 @@ export interface IStudentDataField {
certificatetype: string;
relationtostudent: string;
currentclass: string;
points: number;
}
export type IStudentDataFields = List<IStudentDataField>;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment