Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
a1f0d9db
Commit
a1f0d9db
authored
Jul 26, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NgRedux.select rewrite(WIP)
parent
f4987505
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
446 additions
and
405 deletions
+446
-405
source/components/header/header.component.ts
source/components/header/header.component.ts
+27
-25
source/components/home.ts
source/components/home.ts
+21
-13
source/components/ministry.home.ts
source/components/ministry.home.ts
+25
-16
source/components/school.home.ts
source/components/school.home.ts
+20
-18
source/components/student-application-form/after.submit.ts
source/components/student-application-form/after.submit.ts
+14
-16
source/components/student-application-form/application.form.main.ts
...ponents/student-application-form/application.form.main.ts
+32
-36
source/components/student-application-form/application.preview.ts
...omponents/student-application-form/application.preview.ts
+61
-60
source/components/student-application-form/application.submit.ts
...components/student-application-form/application.submit.ts
+53
-51
source/components/student-application-form/disclaimer.ts
source/components/student-application-form/disclaimer.ts
+12
-13
source/components/student-application-form/epal.class.select.ts
.../components/student-application-form/epal.class.select.ts
+20
-13
source/components/student-application-form/help-desk.ts
source/components/student-application-form/help-desk.ts
+15
-18
source/components/student-application-form/info.ts
source/components/student-application-form/info.ts
+4
-12
source/components/student-application-form/parent.form.ts
source/components/student-application-form/parent.form.ts
+0
-2
source/components/student-application-form/region.schools.select.ts
...ponents/student-application-form/region.schools.select.ts
+72
-38
source/components/student-application-form/schools-order-select.ts
...mponents/student-application-form/schools-order-select.ts
+20
-26
source/components/student-application-form/sector.courses.select.ts
...ponents/student-application-form/sector.courses.select.ts
+5
-5
source/components/student-application-form/sector.fields.select.ts
...mponents/student-application-form/sector.fields.select.ts
+15
-15
source/services/auth.service.ts
source/services/auth.service.ts
+14
-16
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+16
-12
No files found.
source/components/header/header.component.ts
View file @
a1f0d9db
...
...
@@ -68,35 +68,37 @@ export default class HeaderComponent implements OnInit, OnDestroy {
ngOnInit
()
{
(
<
any
>
$
(
"
#headerNotice
"
)).
appendTo
(
"
body
"
);
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
this
.
cuName
=
loginInfoToken
.
cu_name
;
return
loginInfoToken
;
},
{});
if
(
this
.
hasvalue
==
false
)
{
this
.
showLoader
.
next
(
true
);
this
.
TotalStudentsSub
=
this
.
_hds
.
findTotalStudents
().
subscribe
(
x
=>
{
this
.
TotalStudents$
.
next
(
x
);
this
.
showLoader
.
next
(
false
);
this
.
hasvalue
=
true
;
},
error
=>
{
this
.
TotalStudents$
.
next
([{}]);
console
.
log
(
"
Error Getting courses perSchool
"
);
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
'
loginInfo
'
)
.
map
(
loginInfo
=>
<
ILoginInfo
>
loginInfo
)
.
subscribe
(
loginInfo
=>
{
if
(
loginInfo
.
size
>
0
)
{
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
this
.
cuName
=
loginInfoToken
.
cu_name
;
return
loginInfoToken
;
},
{});
if
(
this
.
hasvalue
==
false
)
{
this
.
showLoader
.
next
(
true
);
this
.
TotalStudentsSub
=
this
.
_hds
.
findTotalStudents
().
subscribe
(
x
=>
{
this
.
TotalStudents$
.
next
(
x
);
this
.
showLoader
.
next
(
false
);
});
this
.
hasvalue
=
true
;
},
error
=>
{
this
.
TotalStudents$
.
next
([{}]);
console
.
log
(
"
Error Getting courses perSchool
"
);
this
.
showLoader
.
next
(
false
);
});
}
}
}
}
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
this
.
loginInfo$
.
next
(
loginInfo
)
;
}
);
...
...
source/components/home.ts
View file @
a1f0d9db
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
import
{
OnInit
,
OnDestroy
,
Component
}
from
'
@angular/core
'
;
import
{
LoginInfoActions
}
from
'
../actions/logininfo.actions
'
;
import
{
ILoginInfo
}
from
'
../store/logininfo/logininfo.types
'
;
import
{
NgRedux
,
select
}
from
'
@angular-redux/store
'
;
import
{
Observable
}
from
'
rxjs/Rx
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
IAppState
}
from
'
../store/store
'
;
import
{
HelperDataService
}
from
'
../services/helper-data-service
'
;
import
{
CookieService
}
from
'
ngx-cookie
'
;
import
{
STUDENT_ROLE
}
from
'
../constants
'
;
import
{
LOGININFO_INITIAL_STATE
}
from
"
../store/logininfo/logininfo.initial-state
"
;
import
{
FormBuilder
,
FormGroup
,
...
...
@@ -27,16 +28,16 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings';
<p>
<strong>Ανακοίνωση:</strong> Παρακαλείσθε να μην καταχωρείτε δήλωση προτίμησης επιλέγοντας τα παρακάτω:</p>
<ul>
<li> 9ο ΕΠΑ.Λ. Πειραιά, Β τάξη, Τομέας Ναυτιλιακών Επαγγελμάτων, Γ τάξη-Ειδικότητες Πλοίαρχος Εμπορικού Ναυτικού, Μηχανικός Εμπορικού Ναυτικού
<li> 9ο ΕΠΑ.Λ. Πειραιά, Β τάξη, Τομέας Ναυτιλιακών Επαγγελμάτων, Γ τάξη-Ειδικότητες Πλοίαρχος Εμπορικού Ναυτικού, Μηχανικός Εμπορικού Ναυτικού
</li>
<li> 1ο ΕΠΑ.Λ. Δάφνης, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
<li> 1ο ΕΠΑ.Λ. Δάφνης, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
</li>
<li> 1ο Ημερήσιο ΕΠΑ.Λ. Σιβιτανιδείου, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
<li> 1ο Ημερήσιο ΕΠΑ.Λ. Σιβιτανιδείου, Γ τάξη, Ειδικότητα Βοηθός Νοσηλευτή
</li>
</ul>
<p>Τα τμήματα έχουν πληρότητα από την 1η περίοδο κατανομής.
</p>
</div>
</div>
...
...
@@ -56,15 +57,16 @@ import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../app.settings';
`
})
export
default
class
Home
implements
OnInit
{
export
default
class
Home
implements
OnInit
,
OnDestroy
{
public
formGroup
:
FormGroup
;
private
authToken
:
string
;
private
authRole
:
string
;
private
name
:
any
;
private
xcsrftoken
:
any
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
apiEndPoint
=
API_ENDPOINT
;
private
apiEndPointParams
=
API_ENDPOINT_PARAMS
;
private
loginInfoSub
:
Subscription
;
constructor
(
private
fb
:
FormBuilder
,
private
_ata
:
LoginInfoActions
,
...
...
@@ -79,13 +81,15 @@ export default class Home implements OnInit {
this
.
name
=
''
;
this
.
formGroup
=
this
.
fb
.
group
({
});
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
};
ngOnInit
()
{
this
.
loginInfo$
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
'
loginInfo
'
).
subscribe
(
loginInfo
=>
{
let
linfo
=<
ILoginInfo
>
loginInfo
;
if
(
linfo
.
size
>
0
)
{
linfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
if
(
this
.
authToken
&&
this
.
authToken
.
length
>
0
&&
this
.
authRole
&&
this
.
authRole
===
STUDENT_ROLE
)
{
...
...
@@ -99,8 +103,8 @@ export default class Home implements OnInit {
},
{});
}
return
state
.
loginInfo
;
});
this
.
loginInfo$
.
next
(
linfo
)
;
}
,
error
=>
{
console
.
log
(
"
error selecting loginInfo
"
);}
);
// subscribe to router event
this
.
activatedRoute
.
queryParams
.
subscribe
((
params
:
Params
)
=>
{
...
...
@@ -115,6 +119,10 @@ export default class Home implements OnInit {
});
}
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
}
getCookie
(
key
:
string
){
return
this
.
_cookieService
.
get
(
key
);
}
...
...
source/components/ministry.home.ts
View file @
a1f0d9db
import
{
Router
,
Params
}
from
'
@angular/router
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
import
{
OnInit
,
OnDestroy
,
Component
}
from
'
@angular/core
'
;
import
{
LoginInfoActions
}
from
'
../actions/logininfo.actions
'
;
import
{
ILoginInfo
}
from
'
../store/logininfo/logininfo.types
'
;
import
{
NgRedux
,
select
}
from
'
@angular-redux/store
'
;
import
{
Observable
}
from
'
rxjs/Rx
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
IAppState
}
from
'
../store/store
'
;
import
{
HelperDataService
}
from
'
../services/helper-data-service
'
;
import
{
Http
,
Response
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
LOGININFO_INITIAL_STATE
}
from
"
../store/logininfo/logininfo.initial-state
"
;
import
{
FormBuilder
,
FormGroup
,
...
...
@@ -57,14 +58,15 @@ import { API_ENDPOINT } from '../app.settings';
`
})
export
default
class
MinistryHome
implements
OnInit
{
export
default
class
MinistryHome
implements
OnInit
,
OnDestroy
{
public
userDataGroup
:
FormGroup
;
private
authRole
:
string
;
private
mineduUsername
:
string
;
//private mineduPassword: string;
//private cuName: string;
private
validLogin
:
number
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
loginInfoSub
:
Subscription
;
private
apiEndPoint
=
API_ENDPOINT
;
constructor
(
private
fb
:
FormBuilder
,
...
...
@@ -89,22 +91,29 @@ export default class MinistryHome implements OnInit {
cu_name
:
[
''
],
auth_role
:
[
''
],
});
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
};
ngOnInit
()
{
this
.
loginInfo$
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
mineduUsername
=
loginInfoToken
.
minedu_username
;
//this.mineduPassword = loginInfoToken.minedu_userpassword;
if
(
this
.
mineduUsername
&&
this
.
mineduUsername
.
length
>
0
)
this
.
router
.
navigate
([
'
/ministry/minister-settings
'
]);
return
loginInfoToken
;
},
{});
}
return
state
.
loginInfo
;
});
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
'
loginInfo
'
)
.
subscribe
(
loginInfo
=>
{
let
linfo
=
<
ILoginInfo
>
loginInfo
;
if
(
linfo
.
size
>
0
)
{
linfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
mineduUsername
=
loginInfoToken
.
minedu_username
;
//this.mineduPassword = loginInfoToken.minedu_userpassword;
if
(
this
.
mineduUsername
&&
this
.
mineduUsername
.
length
>
0
)
this
.
router
.
navigate
([
'
/ministry/minister-settings
'
]);
return
loginInfoToken
;
},
{});
}
this
.
loginInfo$
.
next
(
linfo
);
},
error
=>
{
console
.
log
(
"
error selecting loginInfo
"
);});
}
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
}
submitCredentials
()
{
...
...
source/components/school.home.ts
View file @
a1f0d9db
...
...
@@ -87,26 +87,28 @@ export default class SchoolHome implements OnInit, OnDestroy {
};
ngOnInit
()
{
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({
},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
if
(
this
.
authToken
&&
this
.
authToken
.
length
>
0
)
{
if
(
this
.
authRole
===
"
director
"
)
{
this
.
router
.
navigate
([
"
/school/director-buttons
"
]);
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
'
loginInfo
'
)
.
subscribe
(
loginInfo
=>
{
let
linfo
=<
ILoginInfo
>
loginInfo
;
if
(
linfo
.
size
>
0
)
{
linfo
.
reduce
(({
},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
if
(
this
.
authToken
&&
this
.
authToken
.
length
>
0
)
{
if
(
this
.
authRole
===
"
director
"
)
{
this
.
router
.
navigate
([
"
/school/director-buttons
"
]);
}
else
if
(
this
.
authRole
===
"
pde
"
)
this
.
router
.
navigate
([
"
/school/perfecture-view
"
]);
else
if
(
this
.
authRole
===
"
dide
"
)
this
.
router
.
navigate
([
"
/school/eduadmin-view
"
]);
}
else
if
(
this
.
authRole
===
"
pde
"
)
this
.
router
.
navigate
([
"
/school/perfecture-view
"
]);
else
if
(
this
.
authRole
===
"
dide
"
)
this
.
router
.
navigate
([
"
/school/eduadmin-view
"
]);
}
return
loginInfoToken
;
},
{});
}
return
loginInfoToken
;
},
{});
}
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
this
.
loginInfo$
.
next
(
linfo
)
;
}
);
// subscribe to router event
this
.
activatedRoute
.
queryParams
.
subscribe
((
params
:
Params
)
=>
{
...
...
source/components/student-application-form/after.submit.ts
View file @
a1f0d9db
...
...
@@ -38,7 +38,6 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action
private
authToken
:
string
;
private
authRole
:
string
;
private
cuName
:
string
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
public
cuser
:
any
;
private
showLoader$
:
BehaviorSubject
<
boolean
>
;
private
loginInfoSub
:
Subscription
;
...
...
@@ -59,25 +58,24 @@ import { StudentDataFieldsActions } from '../../actions/studentdatafields.action
};
ngOnInit
()
{
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
this
.
cuName
=
loginInfoToken
.
cu_name
;
return
loginInfoToken
;
},
{})
}
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
}
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
'
loginInfo
'
)
.
subscribe
(
loginInfo
=>
{
let
linfo
=
<
ILoginInfo
>
loginInfo
;
if
(
linfo
.
size
>
0
)
{
linfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
this
.
cuName
=
loginInfoToken
.
cu_name
;
return
loginInfoToken
;
},
{});
}
},
error
=>
{
console
.
log
(
"
error selecting epalclasses
"
)}
);
}
;
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
}
};
signOut
()
{
this
.
showLoader$
.
next
(
true
);
...
...
source/components/student-application-form/application.form.main.ts
View file @
a1f0d9db
...
...
@@ -32,17 +32,17 @@ import {
@
Injectable
()
export
default
class
StudentApplicationMain
implements
OnInit
{
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataFields
>
;
private
criteria$
:
BehaviorSubject
<
ICriter
>
;
private
studentDataFieldsSub
:
Subscription
;
private
loginInfoSub
:
Subscription
;
private
criteriaSub
:
Subscription
;
public
studentDataGroup
:
FormGroup
;
public
studentCriteriaGroup
:
FormGroup
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
modalTitle
:
BehaviorSubject
<
string
>
;
private
modalText
:
BehaviorSubject
<
string
>
;
private
modalHeader
:
BehaviorSubject
<
string
>
;
...
...
@@ -84,11 +84,11 @@ import {
private
router
:
Router
,
private
http
:
Http
)
{
this
.
populateSchoolyears
();
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
this
.
modalTitle
=
new
BehaviorSubject
(
""
);
this
.
modalText
=
new
BehaviorSubject
(
""
);
this
.
modalHeader
=
new
BehaviorSubject
(
""
);
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
this
.
studentDataFields$
=
new
BehaviorSubject
(
STUDENT_DATA_FIELDS_INITIAL_STATE
);
this
.
criteria$
=
new
BehaviorSubject
(
CRITERIA_INITIAL_STATE
);
this
.
studentDataGroup
=
this
.
fb
.
group
({
...
...
@@ -111,45 +111,41 @@ import {
ngOnInit
()
{
(
<
any
>
$
(
"
#applicationFormNotice
"
)).
appendTo
(
"
body
"
);
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
return
loginInfoToken
;
},
{});
}
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
this
.
studentDataFieldsSub
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
studentDataFields
.
size
>
0
)
{
state
.
studentDataFields
.
reduce
(({},
studentDataField
)
=>
{
this
.
studentDataGroup
.
controls
[
"
name
"
].
setValue
(
studentDataField
.
name
);
this
.
studentDataGroup
.
controls
[
"
studentsurname
"
].
setValue
(
studentDataField
.
studentsurname
);
this
.
studentDataGroup
.
controls
[
"
fatherfirstname
"
].
setValue
(
studentDataField
.
fatherfirstname
);
this
.
studentDataGroup
.
controls
[
"
motherfirstname
"
].
setValue
(
studentDataField
.
motherfirstname
);
this
.
studentDataGroup
.
controls
[
"
regionaddress
"
].
setValue
(
studentDataField
.
regionaddress
);
this
.
studentDataGroup
.
controls
[
"
regiontk
"
].
setValue
(
studentDataField
.
regiontk
);
this
.
studentDataGroup
.
controls
[
"
regionarea
"
].
setValue
(
studentDataField
.
regionarea
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolname
"
].
setValue
(
studentDataField
.
lastschool_schoolname
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolyear
"
].
setValue
(
studentDataField
.
lastschool_schoolyear
);
this
.
studentDataGroup
.
controls
[
"
lastschool_class
"
].
setValue
(
studentDataField
.
lastschool_class
);
this
.
studentDataGroup
.
controls
[
"
relationtostudent
"
].
setValue
(
studentDataField
.
relationtostudent
);
this
.
studentDataGroup
.
controls
[
"
telnum
"
].
setValue
(
studentDataField
.
telnum
);
this
.
studentDataGroup
.
controls
[
"
studentbirthdate
"
].
setValue
(
this
.
populateDate
(
studentDataField
.
studentbirthdate
));
return
studentDataField
;
},
{});
}
return
state
.
studentDataFields
;
}).
subscribe
(
this
.
studentDataFields$
);
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
'
loginInfo
'
)
.
subscribe
(
loginInfo
=>
{
this
.
loginInfo$
.
next
(
<
ILoginInfo
>
loginInfo
);
},
error
=>
{
console
.
log
(
"
error selecting loginInfo
"
);});
this
.
studentDataFieldsSub
=
this
.
_ngRedux
.
select
(
'
studentDataFields
'
)
.
subscribe
(
studentDataFields
=>
{
let
sdfds
=
<
IStudentDataFields
>
studentDataFields
;
if
(
sdfds
.
size
>
0
)
{
sdfds
.
reduce
(({},
studentDataField
)
=>
{
this
.
studentDataGroup
.
controls
[
"
name
"
].
setValue
(
studentDataField
.
name
);
this
.
studentDataGroup
.
controls
[
"
studentsurname
"
].
setValue
(
studentDataField
.
studentsurname
);
this
.
studentDataGroup
.
controls
[
"
fatherfirstname
"
].
setValue
(
studentDataField
.
fatherfirstname
);
this
.
studentDataGroup
.
controls
[
"
motherfirstname
"
].
setValue
(
studentDataField
.
motherfirstname
);
this
.
studentDataGroup
.
controls
[
"
regionaddress
"
].
setValue
(
studentDataField
.
regionaddress
);
this
.
studentDataGroup
.
controls
[
"
regiontk
"
].
setValue
(
studentDataField
.
regiontk
);
this
.
studentDataGroup
.
controls
[
"
regionarea
"
].
setValue
(
studentDataField
.
regionarea
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolname
"
].
setValue
(
studentDataField
.
lastschool_schoolname
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolyear
"
].
setValue
(
studentDataField
.
lastschool_schoolyear
);
this
.
studentDataGroup
.
controls
[
"
lastschool_class
"
].
setValue
(
studentDataField
.
lastschool_class
);
this
.
studentDataGroup
.
controls
[
"
relationtostudent
"
].
setValue
(
studentDataField
.
relationtostudent
);
this
.
studentDataGroup
.
controls
[
"
telnum
"
].
setValue
(
studentDataField
.
telnum
);
this
.
studentDataGroup
.
controls
[
"
studentbirthdate
"
].
setValue
(
this
.
populateDate
(
studentDataField
.
studentbirthdate
));
return
studentDataField
;
},
{});
}
this
.
studentDataFields$
.
next
(
sdfds
);
},
error
=>
{
console
.
log
(
"
error selecting studentDataFields
"
);});
};
ngOnDestroy
()
{
(
<
any
>
$
(
"
#applicationFormNotice
"
)).
remove
();
if
(
this
.
studentDataFieldsSub
)
this
.
studentDataFieldsSub
.
unsubscribe
();
if
(
this
.
studentDataFields$
)
this
.
studentDataFields$
.
unsubscribe
();
if
(
this
.
loginInfo$
)
this
.
loginInfo$
.
unsubscribe
();
}
navigateBack
()
{
...
...
source/components/student-application-form/application.preview.ts
View file @
a1f0d9db
...
...
@@ -66,7 +66,7 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel
</ul>
</div>
<ul *ngIf="(
region
s$ | async)" class="list-group left-side-view" style="margin-bottom: 20px;">
<ul *ngIf="(
selectedSchool
s$ | async)" class="list-group left-side-view" style="margin-bottom: 20px;">
<div *ngFor="let epal$ of selectedSchools$ | async; let i=index; let isOdd=odd; let isEven=even" >
...
...
@@ -107,67 +107,68 @@ import { SECTOR_FIELDS_INITIAL_STATE } from '../../store/sectorfields/sectorfiel
ngOnInit
()
{
this
.
currentUrl
=
this
.
router
.
url
;
this
.
sectorsSub
=
this
.
_ngRedux
.
select
(
state
=>
{
state
.
sectors
.
reduce
((
prevSector
,
sector
)
=>
{
sector
.
courses
.
reduce
((
prevCourse
,
course
)
=>
{
if
(
course
.
selected
===
true
)
{
this
.
courseActive
=
course
.
course_id
;
}
return
course
;
this
.
sectorsSub
=
this
.
_ngRedux
.
select
(
'
sectors
'
)
.
subscribe
(
sectors
=>
{
let
scs
=
<
ISectors
>
sectors
;
scs
.
reduce
((
prevSector
,
sector
)
=>
{
sector
.
courses
.
reduce
((
prevCourse
,
course
)
=>
{
if
(
course
.
selected
===
true
)
{
this
.
courseActive
=
course
.
course_id
;
}
return
course
;
},
{});
return
sector
;
},
{});
return
sector
;
},
{});
//this.numSelectedCourses = numsel;
return
state
.
sectors
;
}).
subscribe
(
this
.
sectors$
);
this
.
regionsSub
=
this
.
_ngRedux
.
select
(
state
=>
{
let
numsel
=
0
,
numsel2
=
0
;
let
selectedSchools
=
Array
<
IRegionSchoolRecord
>
();
if
(
state
.
regions
.
size
===
0
)
return
;
state
.
regions
.
reduce
((
prevRegion
,
region
)
=>
{
region
.
get
(
"
epals
"
).
reduce
((
prevEpal
,
epal
)
=>
{
if
(
epal
.
get
(
"
selected
"
)
===
true
)
{
numsel
++
;
selectedSchools
.
push
(
epal
);
}
if
(
epal
.
get
(
"
order_id
"
)
!==
0
)
{
numsel2
++
;
}
return
epal
;
this
.
sectors$
.
next
(
scs
);
});
this
.
regionsSub
=
this
.
_ngRedux
.
select
(
'
regions
'
)
.
subscribe
(
regions
=>
{
let
rgns
=
<
IRegionRecords
>
regions
;
let
numsel
=
0
,
numsel2
=
0
;
let
selectedSchools
=
Array
<
IRegionSchoolRecord
>
();
if
(
rgns
.
size
===
0
)
return
;
rgns
.
reduce
((
prevRegion
,
region
)
=>
{
region
.
get
(
"
epals
"
).
reduce
((
prevEpal
,
epal
)
=>
{
if
(
epal
.
get
(
"
selected
"
)
===
true
)
{
numsel
++
;
selectedSchools
.
push
(
epal
);
}
if
(
epal
.
get
(
"
order_id
"
)
!==
0
)
{
numsel2
++
;
}
return
epal
;
},
{});
return
region
;
},
{});
return
region
;
},
{});
this
.
numSelectedSchools
=
numsel
;
this
.
numSelectedOrder
=
numsel2
;
this
.
selectedSchools$
.
next
(
selectedSchools
.
sort
(
this
.
compareSchools
));
// this.selectedSchools$.next(selectedSchools);
return
state
.
regions
;
}).
subscribe
(
this
.
regions$
);
this
.
sectorFieldsSub
=
this
.
_ngRedux
.
select
(
state
=>
{
state
.
sectorFields
.
reduce
(({},
sectorField
)
=>
{
return
sectorField
;
},
{});
return
state
.
sectorFields
;
}).
subscribe
(
this
.
sectorFields$
);
this
.
epalclassesSub
=
this
.
_ngRedux
.
select
(
state
=>
{
state
.
epalclasses
.
reduce
(({},
epalclass
)
=>
{
if
(
epalclass
.
name
===
"
Α' Λυκείου
"
)
this
.
classSelected
=
1
;
else
if
(
epalclass
.
name
===
"
Β' Λυκείου
"
)
this
.
classSelected
=
2
;
else
if
(
epalclass
.
name
===
"
Γ' Λυκείου
"
)
this
.
classSelected
=
3
;
else
if
(
epalclass
.
name
===
"
Δ' Λυκείου
"
)
this
.
classSelected
=
4
;
return
epalclass
;
},
{});
return
state
.
epalclasses
;
}).
subscribe
(
this
.
epalclasses$
);
this
.
numSelectedSchools
=
numsel
;
this
.
numSelectedOrder
=
numsel2
;
this
.
selectedSchools$
.
next
(
selectedSchools
.
sort
(
this
.
compareSchools
));
});
this
.
sectorFieldsSub
=
this
.
_ngRedux
.
select
(
'
sectorFields
'
)
.
subscribe
(
sectorFields
=>
{
this
.
sectorFields$
.
next
(
<
ISectorFields
>
sectorFields
);
},
error
=>
{
console
.
log
(
"
error selecting sectorFields
"
);});
this
.
epalclassesSub
=
this
.
_ngRedux
.
select
(
'
epalclasses
'
)
.
subscribe
(
epalclasses
=>
{
let
ecs
=
<
IEpalClasses
>
epalclasses
;
ecs
.
reduce
(({},
epalclass
)
=>
{
if
(
epalclass
.
name
===
"
Α' Λυκείου
"
)
this
.
classSelected
=
1
;
else
if
(
epalclass
.
name
===
"
Β' Λυκείου
"
)
this
.
classSelected
=
2
;
else
if
(
epalclass
.
name
===
"
Γ' Λυκείου
"
)
this
.
classSelected
=
3
;
else
if
(
epalclass
.
name
===
"
Δ' Λυκείου
"
)
this
.
classSelected
=
4
;
return
epalclass
;
},
{});
this
.
epalclasses$
.
next
(
ecs
);
},
error
=>
{
console
.
log
(
"
error selecting epalclasses
"
);});
}
...
...
source/components/student-application-form/application.submit.ts
View file @
a1f0d9db
...
...
@@ -124,8 +124,6 @@ import { HelperDataService } from "../../services/helper-data-service";
private
classSelected
;
private
totalPoints
=
<
number
>
0
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataFields
>
;
private
sectors$
:
BehaviorSubject
<
ISectors
>
;
private
sectorFields$
:
BehaviorSubject
<
ISectorFields
>
;
private
epalclasses$
:
BehaviorSubject
<
IEpalClasses
>
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
studentDataFieldsSub
:
Subscription
;
...
...
@@ -160,8 +158,6 @@ import { HelperDataService } from "../../services/helper-data-service";
// this.regions$ = new BehaviorSubject(REGION_SCHOOLS_INITIAL_STATE);
this
.
epalclasses$
=
new
BehaviorSubject
(
EPALCLASSES_INITIAL_STATE
);
this
.
sectors$
=
new
BehaviorSubject
(
SECTOR_COURSES_INITIAL_STATE
);
this
.
sectorFields$
=
new
BehaviorSubject
(
SECTOR_FIELDS_INITIAL_STATE
);