Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
39b5f295
Commit
39b5f295
authored
Mar 16, 2017
by
Νίκος Κατσαούνος
Browse files
updated applicationForm component
parent
e3c939f6
Changes
7
Hide whitespace changes
Inline
Side-by-side
source/app.settings.deployment.ts
View file @
39b5f295
...
...
@@ -2,6 +2,6 @@ export const API_ENDPOINT = '';
export
class
AppSettings
{
public
static
get
API_ENDPOINT
():
string
{
return
''
;
return
'
http://localhost/drupal-8.2.5
'
;
}
}
source/app.settings.ts
View file @
39b5f295
export
const
API_ENDPOINT
=
'
http://localhost/
angular/eepal-front/
drupal
'
;
export
const
API_ENDPOINT
=
'
http://localhost/drupal
-8.2.5
'
;
export
class
AppSettings
{
public
static
get
API_ENDPOINT
():
string
{
return
'
http://localhost/
angular/eepal-front/
drupal
'
;
return
'
http://localhost/drupal
-8.2.5
'
;
// return 'http://localhost/angular/eepal-front/drupal';
// return 'http://localhost/drupal';
// return 'http://localhost/angular/eepal-front/drupal';
...
...
source/components/student-application-form/application.form.main.html
View file @
39b5f295
<div
class =
"loading"
*ngIf=
"showLoader$ | async"
></div>
<div
class=
"row equal"
>
<div
class=
"col-md-12"
>
<form
novalidate
[formGroup]=
"studentDataGroup"
#form
>
...
...
@@ -111,18 +113,19 @@
</div>
<form
novalidate
(ngSubmit)=
"onSubmit(studentCriteriaGroup)"
[formGroup]=
"studentCriteriaGroup"
>
<form
novalidate
[formGroup]=
"studentCriteriaGroup"
>
<!--
<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" >
<div *ngIf="criter$.name === 'Εισόδημα' && criter$.name !== 'Απόσταση'">
{{criter$.name}} </div></option>
</select>
-->
<div
class=
"form-group"
>
...
...
@@ -142,64 +145,25 @@
</div>
<div
formArrayName=
"formArray"
>
<div
*ngFor=
"let criter$ of criteria$ | async; let i=index"
>
</div>
<legend>
Κοινωνικά κριτήρια
</legend>
<p
style=
"margin-top: 15px; line-height: 1.5em;"
>
Επιλέξτε όσα από τα παρακάτω κριτήρια πληρούνται για εσάς.
Οι επιλογές σας επέχουν θέση υπέυθυνης δήλωσης.
Θα πρέπει να προσκομίσετε τα αντίστοιχα δικαιολογητικά στο σχολείο εγγραφής σας, όταν σας ζητηθεί.
</p>
<!--
<div class="row">
<div class="col-md-1"> <input #cborphanmono type="checkbox" (change)="checkorphan('mono', cborphanmono)" formControlName="orphanmono" ></div>
<div class="col-md-11 pull-left">Ορφανός από τον ένα γονέα</div>
</div>
<div class="row">
<div class="col-md-1"> <input #cborphantwice type="checkbox" (change)="checkorphan('twice', cborphantwice)" formControlName="orphantwice" ></div>
<div class="col-md-11 pull-left">Ορφανός και από τους δύο γονείς</div>
</div>
<div class="row">
<div class="col-md-1"> <input #cbthreechildren type="checkbox" (change)="checkchildren('three', cbthreechildren)" formControlName="threechildren"></div>
<div class="col-md-11 pull-left">Μέλος Τρίτεκνης Οικογένειας</div>
</div>
<div class="row">
<div class="col-md-1"> <input #cbmanychildren type="checkbox" (change)="checkchildren('many', cbmanychildren)" formControlName="manychildren"></div>
<div class="col-md-11 pull-left">Μέλος Πολύτεκνης Οικογένειας</div>
</div>
<div class="row">
<div class="col-md-1"> <input type="checkbox" (change)="checkstatus()" formControlName="twins"></div>
<div class="col-md-11 pull-left">Πολύδυμα Τέκνα</div>
</div>
<div class="row">
<div class="col-md-1"> <input type="checkbox" (change)="checkstatus()" formControlName="disability"></div>
<div class="col-md-11 pull-left">Γονείς, τέκνα, αδέλφια ή σύζυγος με αναπηρία 67% και άνω </div>
</div>
<div class="row">
<div class="col-md-1"> <input type="checkbox" (change)="checkstatus()" formControlName="studies"></div>
<div class="col-md-11 pull-left">Αδελφός,-ή που σπουδάζει σε άλλη πόλη</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=
"col-md-1"
>
<input
#cb
type=
"checkbox"
(change)=
"checkcriteria(cb, criter$.mutual_disabled_id)"
formControlName=
{{i}}
>
</div>
<div
class=
"col-md-11 pull-left"
>
{{criter$.name}}
</div>
</div>
<div
class=
"row"
*ngIf=
"criter$.name !== 'Εισόδημα' && criter$.name !== 'Απόσταση'"
>
<div
class=
"col-md-1"
>
<input
#cb
type=
"checkbox"
(change)=
"checkcriteria(cb, criter$.mutual_disabled_id)"
formControlName=
{{i}}
>
</div>
<div
class=
"col-md-11 pull-left"
>
{{criter$.name}}
</div>
</div>
</div>
<div
class=
"row"
>
</div>
<!--
...
...
@@ -209,7 +173,7 @@
</form>
<div
class=
"row"
style=
"margin-top: 20px;"
>
<div
class=
"row"
style=
"margin-top: 20px;"
*ngIf=
"!(showLoader$ | async)"
>
<div
class=
"col-md-6"
>
<button
type=
"button"
class=
"btn-primary btn-lg pull-left"
(click)=
"navigateBack()"
>
<i
class=
"fa fa-backward"
></i>
...
...
source/components/student-application-form/application.form.main.ts
View file @
39b5f295
...
...
@@ -27,6 +27,7 @@ import {
private
studentDataFields$
:
Observable
<
IStudentDataFields
>
;
private
criteria$
:
Observable
<
ICriter
>
;
private
showLoader$
:
Observable
<
boolean
>
;
public
studentDataGroup
:
FormGroup
;
public
applicantDataGroup
:
FormGroup
;
...
...
@@ -34,8 +35,6 @@ import {
private
rss
=
new
FormArray
([]);
private
selectionIncomeId
=
<
number
>
0
;
//public orphanmode = <number>0;
//public childrenmode = <number>0;
constructor
(
private
fb
:
FormBuilder
,
private
_sdfa
:
StudentDataFieldsActions
,
...
...
@@ -49,8 +48,8 @@ import {
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
:
[
'
Απολυτήριο Λυκείου
'
,
checkChoice
],
relationtostudent
:
[
'
Μαθητής
'
,
checkChoice
],
certificatetype
:
[
'
Απολυτήριο Λυκείου
'
,
this
.
checkChoice
],
relationtostudent
:
[
'
Μαθητής
'
,
this
.
checkChoice
],
telnum
:
[
'
2610789789
'
,
[
Validators
.
pattern
(
VALID_DIGITS_PATTERN
),
Validators
.
required
]],
});
...
...
@@ -59,22 +58,12 @@ import {
guardiansurname
:
[
'
ΚΑΤΣΑΟΥΝΟΣ
'
,
[
Validators
.
pattern
(
VALID_NAMES_PATTERN
),
Validators
.
required
]],
});
/*
this.studentCriteriaGroup = this.fb.group({
orphanmono: false,
orphantwice: false,
threechildren: false,
manychildren: false,
twins: false,
disability: false,
studies: false,
income: ['noincomecriterio', checkChoice ],
});
*/
this
.
studentCriteriaGroup
=
this
.
fb
.
group
({
formArray
:
this
.
rss
,
income
:
[
'
noincomecriterio
'
,
checkChoice
],
incometest
:
[
'
noincomecriterio
'
,
checkChoice
],
//income: ['noincomecriterio', this.checkChoice ],
//income: ['noincomecriterio', Validators.required ],
income
:
[
this
.
selectionIncomeId
,
this
.
checkChoice
],
//incometest: ['noincomecriterio', checkChoice ],
});
};
...
...
@@ -96,91 +85,45 @@ import {
if
(
state
.
criter
.
size
>
0
)
{
state
.
criter
.
reduce
(({},
criteria
)
=>
{
//this.studentCriteriaGroup.setValue(criteria);
if
(
criteria
.
selected
===
true
&&
(
criteria
.
id
===
"
8
"
||
criteria
.
id
===
"
9
"
||
criteria
.
id
===
"
10
"
||
criteria
.
id
===
"
11
"
))
if
(
criteria
.
selected
===
true
&&
(
criteria
.
name
===
"
Εισόδημα
"
))
{
console
.
log
(
"
MPHKA!!!
"
);
this
.
selectionIncomeId
=
Number
(
criteria
.
id
);
console
.
log
(
"
Yes
"
);
console
.
log
(
this
.
selectionIncomeId
);
}
this
.
rss
.
push
(
new
FormControl
(
criteria
.
selected
,
[]));
return
criteria
;
},
{});
}
return
state
.
criter
;
});
this
.
showLoader$
=
this
.
criteria$
.
map
(
criter
=>
criter
.
size
===
0
);
}
navigateBack
()
{
/* this._ngRedux.select(state => {
state.epalclasses.reduce(({}, epalclass) =>{
if (epalclass.name === "Α' Λυκείου")
this.router.navigate(['/region-schools-select']);
else if (epalclass.name === "Β' Λυκείου")
this.router.navigate(['/region-schools-select']);
else if (epalclass.name === "Γ' Λυκείου")
this.router.navigate(['/region-schools-select']);
return epalclass;
}, {});
return state.epalclasses;
}); */
this
.
router
.
navigate
([
'
/schools-order-select
'
]);
}
submitSelected
()
{
this
.
_sdfa
.
saveStudentDataFields
([
this
.
studentDataGroup
.
value
]);
this
.
studentCriteriaGroup
.
controls
[
'
formArray
'
][
'
controls
'
][
7
].
setValue
(
false
);
this
.
studentCriteriaGroup
.
controls
[
'
formArray
'
][
'
controls
'
][
8
].
setValue
(
false
);
this
.
studentCriteriaGroup
.
controls
[
'
formArray
'
][
'
controls
'
][
9
].
setValue
(
false
);
this
.
studentCriteriaGroup
.
controls
[
'
formArray
'
][
'
controls
'
][
10
].
setValue
(
false
);
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
'
]);
}
checkorphan
(
orphanModeName
,
cb
)
{
if
(
orphanModeName
===
"
mono
"
&&
cb
.
checked
===
true
)
this
.
studentCriteriaGroup
.
controls
[
'
orphantwice
'
].
setValue
(
false
);
else
if
(
orphanModeName
===
"
twice
"
&&
cb
.
checked
===
true
)
this
.
studentCriteriaGroup
.
controls
[
'
orphanmono
'
].
setValue
(
false
);
this
.
_sdfb
.
saveCriteria
([
this
.
studentCriteriaGroup
.
value
]);
//console.log("after check");
//console.log(this.studentCriteriaGroup.value);
}
checkchildren
(
childrenModeName
,
cb
)
{
if
(
childrenModeName
===
"
three
"
&&
cb
.
checked
===
true
)
this
.
studentCriteriaGroup
.
controls
[
'
manychildren
'
].
setValue
(
false
);
else
if
(
childrenModeName
===
"
many
"
&&
cb
.
checked
===
true
)
this
.
studentCriteriaGroup
.
controls
[
'
threechildren
'
].
setValue
(
false
);
console
.
log
(
this
.
studentCriteriaGroup
.
controls
[
'
income
'
]);
this
.
_sdfb
.
saveCriteria
([
this
.
studentCriteriaGroup
.
value
]);
this
.
_sdfb
.
saveCriteria
([
this
.
studentCriteriaGroup
.
value
.
formArray
]);
//console.log("after check");
//console.log(this.studentCriteriaGroup.value);
this
.
router
.
navigate
([
'
/application-submit
'
]);
}
checkcriteria
(
cb
,
mutual_disabled
)
{
if
(
mutual_disabled
!==
"
-1
"
&&
cb
.
checked
===
true
)
{
this
.
studentCriteriaGroup
.
controls
[
'
formArray
'
][
'
controls
'
][
mutual_disabled
-
1
].
setValue
(
false
);
}
//this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
}
checkstatus
(
cb
)
{
console
.
log
(
"
Hey
"
);
console
.
log
(
this
.
studentCriteriaGroup
.
value
.
income
);
//this._sdfb.saveCriteria([this.studentCriteriaGroup.value.income]);
console
.
log
(
"
OK
"
);
console
.
log
(
cb
.
value
);
if
(
cb
.
value
===
"
<= 3000 Ευρώ
"
)
this
.
selectionIncomeId
=
8
;
else
if
(
cb
.
value
===
"
<= 6000 Ευρώ
"
)
...
...
@@ -189,26 +132,25 @@ import {
this
.
selectionIncomeId
=
10
;
else
if
(
cb
.
value
===
"
> 9000 Ευρώ
"
)
this
.
selectionIncomeId
=
11
;
//this.studentCriteriaGroup.value[9] = true;
//this.studentCriteriaGroup.value[9] = false;
console
.
log
(
this
.
studentCriteriaGroup
.
value
.
formArray
);
console
.
log
(
this
.
studentCriteriaGroup
.
value
);
//this._sdfb.saveCriteria([this.studentCriteriaGroup.value.formArray]);
}
//checkChoice(c: FormControl) {
checkChoice
(
c
:
FormControl
)
{
console
.
log
(
"
Nikos
"
);
console
.
log
(
c
.
value
);
//if (c.value === "noincomecriterio" ) {
if
(
c
.
value
===
null
||
c
.
value
===
0
)
{
//if (this.selectionIncomeId === null) {
console
.
log
(
"
Nikos1
"
);
console
.
log
(
"
noincomecriterio
"
);
return
{
status
:
true
}
}
else
// Null means valid, believe it or not
return
null
;
}
function
checkChoice
(
c
:
FormControl
)
{
console
.
log
(
c
.
value
);
if
(
c
.
value
===
"
noincomecriterio
"
)
return
{
status
:
true
}
else
// Null means valid, believe it or not
return
null
;
}
source/components/student-application-form/application.submit.ts
View file @
39b5f295
...
...
@@ -42,6 +42,7 @@ import {AppSettings} from '../../app.settings';
-->
<button type="button" class="btn-primary btn-lg pull-center" (click)="submitNow()">Υποβολή</button>
`
})
...
...
source/store/criteria/criteria.transformers.ts
View file @
39b5f295
...
...
@@ -3,15 +3,8 @@ import { ICriteria, ICriter } from './criteria.types';
export
function
deimmutifyCriteria
(
state
:
ICriter
):
ICriteria
[]
{
let
fetchedCriteria
=
new
Array
();
/*
state
.
forEach
(
criteria
=>
{
fetchedCriteria.push(<ICriteria>{orphanmono: criteria.orphanmono, orphantwice: criteria.orphantwice, threechildren: criteria.threechildren,
manychildren: criteria.manychildren, twins: criteria.twins, disability: criteria.disability, studies: criteria.studies, income: criteria.income,
});
});
*/
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
,
mutual_disabled_id
:
criteria
.
mutual_disabled_id
,
selected
:
criteria
.
selected
,
});
});
return
fetchedCriteria
;
...
...
source/store/criteria/criteria.types.ts
View file @
39b5f295
...
...
@@ -15,7 +15,6 @@ export interface ICriteria {
id
:
string
;
name
:
string
;
mutual_disabled_id
:
string
,
//globalIndex: number;
selected
:
boolean
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment