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
b4746228
Commit
b4746228
authored
Jul 31, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'edge_v4' into 'develop_v4'
Restructured IStudentDataFields See merge request !240
parents
5cee655c
f109b9cf
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
78 additions
and
101 deletions
+78
-101
source/components/student-application-form/application.form.main.ts
...ponents/student-application-form/application.form.main.ts
+16
-16
source/components/student-application-form/application.submit.ts
...components/student-application-form/application.submit.ts
+37
-37
source/store/index.ts
source/store/index.ts
+3
-3
source/store/sectorfields/sectorfields.initial-state.ts
source/store/sectorfields/sectorfields.initial-state.ts
+1
-7
source/store/sectorfields/sectorfields.reducer.ts
source/store/sectorfields/sectorfields.reducer.ts
+1
-1
source/store/store.ts
source/store/store.ts
+1
-1
source/store/studentdatafields/index.ts
source/store/studentdatafields/index.ts
+3
-3
source/store/studentdatafields/studentdatafields.initial-state.ts
...tore/studentdatafields/studentdatafields.initial-state.ts
+2
-2
source/store/studentdatafields/studentdatafields.reducer.ts
source/store/studentdatafields/studentdatafields.reducer.ts
+7
-11
source/store/studentdatafields/studentdatafields.transformers.ts
...store/studentdatafields/studentdatafields.transformers.ts
+3
-19
source/store/studentdatafields/studentdatafields.types.ts
source/store/studentdatafields/studentdatafields.types.ts
+4
-1
No files found.
source/components/student-application-form/application.form.main.ts
View file @
b4746228
...
...
@@ -4,7 +4,7 @@ import { Injectable } from "@angular/core";
import
{
Router
}
from
"
@angular/router
"
;
import
{
NgRedux
,
select
}
from
"
@angular-redux/store
"
;
import
{
StudentDataFieldsActions
}
from
"
../../actions/studentdatafields.actions
"
;
import
{
IStudentDataFields
}
from
"
../../store/studentdatafields/studentdatafields.types
"
;
import
{
IStudentDataField
Record
s
}
from
"
../../store/studentdatafields/studentdatafields.types
"
;
import
{
IAppState
}
from
"
../../store/store
"
;
import
{
VALID_NAMES_PATTERN
,
VALID_UCASE_NAMES_PATTERN
,
VALID_ADDRESS_PATTERN
,
VALID_ADDRESSTK_PATTERN
,
VALID_DIGITS_PATTERN
,
VALID_DATE_PATTERN
,
FIRST_SCHOOL_YEAR
,
VALID_YEAR_PATTERN
,
VALID_TELEPHONE_PATTERN
}
from
"
../../constants
"
;
...
...
@@ -30,7 +30,7 @@ import {
@
Injectable
()
export
default
class
StudentApplicationMain
implements
OnInit
{
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataFields
>
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataField
Record
s
>
;
private
studentDataFieldsSub
:
Subscription
;
private
loginInfoSub
:
Subscription
;
...
...
@@ -112,23 +112,23 @@ import {
this
.
studentDataFieldsSub
=
this
.
_ngRedux
.
select
(
"
studentDataFields
"
)
.
subscribe
(
studentDataFields
=>
{
let
sdfds
=
<
IStudentDataFields
>
studentDataFields
;
let
sdfds
=
<
IStudentDataField
Record
s
>
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
));
this
.
studentDataGroup
.
controls
[
"
name
"
].
setValue
(
studentDataField
.
get
(
"
name
"
)
);
this
.
studentDataGroup
.
controls
[
"
studentsurname
"
].
setValue
(
studentDataField
.
get
(
"
studentsurname
"
)
);
this
.
studentDataGroup
.
controls
[
"
fatherfirstname
"
].
setValue
(
studentDataField
.
get
(
"
fatherfirstname
"
)
);
this
.
studentDataGroup
.
controls
[
"
motherfirstname
"
].
setValue
(
studentDataField
.
get
(
"
motherfirstname
"
)
);
this
.
studentDataGroup
.
controls
[
"
regionaddress
"
].
setValue
(
studentDataField
.
get
(
"
regionaddress
"
)
);
this
.
studentDataGroup
.
controls
[
"
regiontk
"
].
setValue
(
studentDataField
.
get
(
"
regiontk
"
)
);
this
.
studentDataGroup
.
controls
[
"
regionarea
"
].
setValue
(
studentDataField
.
get
(
"
regionarea
"
)
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolname
"
].
setValue
(
studentDataField
.
get
(
"
lastschool_schoolname
"
)
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolyear
"
].
setValue
(
studentDataField
.
get
(
"
lastschool_schoolyear
"
)
);
this
.
studentDataGroup
.
controls
[
"
lastschool_class
"
].
setValue
(
studentDataField
.
get
(
"
lastschool_class
"
)
);
this
.
studentDataGroup
.
controls
[
"
relationtostudent
"
].
setValue
(
studentDataField
.
get
(
"
relationtostudent
"
)
);
this
.
studentDataGroup
.
controls
[
"
telnum
"
].
setValue
(
studentDataField
.
get
(
"
telnum
"
)
);
this
.
studentDataGroup
.
controls
[
"
studentbirthdate
"
].
setValue
(
this
.
populateDate
(
studentDataField
.
get
(
"
studentbirthdate
"
)
));
return
studentDataField
;
},
{});
}
...
...
source/components/student-application-form/application.submit.ts
View file @
b4746228
...
...
@@ -5,7 +5,7 @@ import { BehaviorSubject, Subscription } from "rxjs/Rx";
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
NgRedux
,
select
}
from
"
@angular-redux/store
"
;
import
{
IAppState
}
from
"
../../store/store
"
;
import
{
IStudentDataFields
}
from
"
../../store/studentdatafields/studentdatafields.types
"
;
import
{
IStudentDataField
Record
s
}
from
"
../../store/studentdatafields/studentdatafields.types
"
;
import
{
IRegionRecord
,
IRegionRecords
,
IRegionSchoolRecord
}
from
"
../../store/regionschools/regionschools.types
"
;
import
{
ISectors
}
from
"
../../store/sectorcourses/sectorcourses.types
"
;
import
{
ISectorFieldRecords
}
from
"
../../store/sectorfields/sectorfields.types
"
;
...
...
@@ -74,30 +74,30 @@ import { HelperDataService } from "../../services/helper-data-service";
<div *ngFor="let studentDataField$ of studentDataFields$ | async;">
<div class="row oddin" style="margin: 0px 2px 20px 2px; line-height: 2em;">
<div class="col-md-3" style="font-size: 0.8em;">Διεύθυνση</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.
regionaddress
}}</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.
get("regionaddress")
}}</div>
<div class="col-md-3" style="font-size: 0.8em;">ΤΚ - Πόλη</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.
regiontk}} - {{studentDataField$.regionarea
}}</div>
<div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{studentDataField$.
get("regiontk")}} - {{studentDataField$.get("regionarea")
}}</div>
</div>
<div class="row evenin" style="margin: 20px 2px 10px 2px; line-height: 2em;">
<div class="col-md-12" style="font-size: 1.5em; font-weight: bold; text-align: center;">Στοιχεία μαθητή</div>
</div>
<div><label for="name">Όνομα μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
name
}} </p> </div>
<div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
studentsurname
}} </p></div>
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
fatherfirstname
}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
motherfirstname
}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
studentbirthdate
}} </p></div>
<div><label for="lastschool_schoolname">Σχολείο τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
lastschool_schoolname
.name}} </p></div>
<div><label for="lastschool_schoolyear">Σχολικό έτος τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
lastschool_schoolyear
}} </p></div>
<div *ngIf="studentDataField$.
lastschool_class
=== 1"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Α'</p></div>
<div *ngIf="studentDataField$.
lastschool_class
=== 2"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Β'</p></div>
<div *ngIf="studentDataField$.
lastschool_class
=== 3"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Γ'</p></div>
<div *ngIf="studentDataField$.
lastschool_class
=== 4"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Δ'</p></div>
<div><label for="relationtostudent">Η δήλωση προτίμησης γίνεται από</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
relationtostudent
}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
telnum
}} </p></div>
<div><label for="name">Όνομα μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("name")
}} </p> </div>
<div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("studentsurname")
}} </p></div>
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("fatherfirstname")
}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("motherfirstname")
}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("studentbirthdate")
}} </p></div>
<div><label for="lastschool_schoolname">Σχολείο τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("lastschool_schoolname")
.name}} </p></div>
<div><label for="lastschool_schoolyear">Σχολικό έτος τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("lastschool_schoolyear")
}} </p></div>
<div *ngIf="studentDataField$.
get('lastschool_class')
=== 1"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Α'</p></div>
<div *ngIf="studentDataField$.
get('lastschool_class')
=== 2"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Β'</p></div>
<div *ngIf="studentDataField$.
get('lastschool_class')
=== 3"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Γ'</p></div>
<div *ngIf="studentDataField$.
get('lastschool_class')
=== 4"><label for="lastschool_class">Τάξη τελευταίας φοίτησης</label> <p class="form-control" style="border:1px solid #eceeef;">Δ'</p></div>
<div><label for="relationtostudent">Η δήλωση προτίμησης γίνεται από</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("relationtostudent")
}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" style="border:1px solid #eceeef;"> {{studentDataField$.
get("telnum")
}} </p></div>
</div>
<div class="row" style="margin-top: 20px; margin-bottom: 20px;">
<div class="col-md-6">
...
...
@@ -123,7 +123,7 @@ import { HelperDataService } from "../../services/helper-data-service";
private
sectorSelected
;
private
classSelected
;
private
totalPoints
=
<
number
>
0
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataFields
>
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataField
Record
s
>
;
private
epalclasses$
:
BehaviorSubject
<
IEpalClasses
>
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
studentDataFieldsSub
:
Subscription
;
...
...
@@ -205,7 +205,7 @@ import { HelperDataService } from "../../services/helper-data-service";
this
.
studentDataFieldsSub
=
this
.
_ngRedux
.
select
(
"
studentDataFields
"
)
.
subscribe
(
studentDataFields
=>
{
this
.
studentDataFields$
.
next
(
<
IStudentDataFields
>
studentDataFields
);
this
.
studentDataFields$
.
next
(
<
IStudentDataField
Record
s
>
studentDataFields
);
},
error
=>
{
console
.
log
(
"
error selecting studentDataFields
"
);
});
this
.
regionsSub
=
this
.
_ngRedux
.
select
(
"
regions
"
).
...
...
@@ -296,25 +296,25 @@ import { HelperDataService } from "../../services/helper-data-service";
let
std
=
this
.
studentDataFields$
.
getValue
().
get
(
0
);
aitisiObj
[
0
]
=
<
any
>
{};
aitisiObj
[
0
].
name
=
std
.
name
;
aitisiObj
[
0
].
studentsurname
=
std
.
studentsurname
;
aitisiObj
[
0
].
studentbirthdate
=
std
.
studentbirthdate
;
aitisiObj
[
0
].
fatherfirstname
=
std
.
fatherfirstname
;
aitisiObj
[
0
].
motherfirstname
=
std
.
motherfirstname
;
aitisiObj
[
0
].
regionaddress
=
std
.
regionaddress
;
aitisiObj
[
0
].
regionarea
=
std
.
regionarea
;
aitisiObj
[
0
].
regiontk
=
std
.
regiontk
;
aitisiObj
[
0
].
name
=
std
.
get
(
"
name
"
)
;
aitisiObj
[
0
].
studentsurname
=
std
.
get
(
"
studentsurname
"
)
;
aitisiObj
[
0
].
studentbirthdate
=
std
.
get
(
"
studentbirthdate
"
)
;
aitisiObj
[
0
].
fatherfirstname
=
std
.
get
(
"
fatherfirstname
"
)
;
aitisiObj
[
0
].
motherfirstname
=
std
.
get
(
"
motherfirstname
"
)
;
aitisiObj
[
0
].
regionaddress
=
std
.
get
(
"
regionaddress
"
)
;
aitisiObj
[
0
].
regionarea
=
std
.
get
(
"
regionarea
"
)
;
aitisiObj
[
0
].
regiontk
=
std
.
get
(
"
regiontk
"
)
;
aitisiObj
[
0
].
certificatetype
=
""
;
aitisiObj
[
0
].
graduation_year
=
0
;
aitisiObj
[
0
].
lastschool_registrynumber
=
std
.
lastschool_schoolname
.
registry_no
;
aitisiObj
[
0
].
lastschool_schoolname
=
std
.
lastschool_schoolname
.
name
;
aitisiObj
[
0
].
lastschool_schoolyear
=
std
.
lastschool_schoolyear
;
aitisiObj
[
0
].
lastschool_unittypeid
=
std
.
lastschool_schoolname
.
unit_type_id
;
aitisiObj
[
0
].
lastschool_class
=
std
.
lastschool_class
;
aitisiObj
[
0
].
relationtostudent
=
std
.
relationtostudent
;
aitisiObj
[
0
].
telnum
=
std
.
telnum
;
aitisiObj
[
0
].
lastschool_registrynumber
=
std
.
get
(
"
lastschool_schoolname
"
)
.
registry_no
;
aitisiObj
[
0
].
lastschool_schoolname
=
std
.
get
(
"
lastschool_schoolname
"
)
.
name
;
aitisiObj
[
0
].
lastschool_schoolyear
=
std
.
get
(
"
lastschool_schoolyear
"
)
;
aitisiObj
[
0
].
lastschool_unittypeid
=
std
.
get
(
"
lastschool_schoolname
"
)
.
unit_type_id
;
aitisiObj
[
0
].
lastschool_class
=
std
.
get
(
"
lastschool_class
"
)
;
aitisiObj
[
0
].
relationtostudent
=
std
.
get
(
"
relationtostudent
"
)
;
aitisiObj
[
0
].
telnum
=
std
.
get
(
"
telnum
"
)
;
aitisiObj
[
0
].
cu_name
=
this
.
cu_name
;
aitisiObj
[
0
].
cu_surname
=
this
.
cu_surname
;
...
...
source/store/index.ts
View file @
b4746228
...
...
@@ -4,7 +4,7 @@ import { IAppState, rootReducer, deimmutify } from "./store";
import
{
ISectorFieldRecord
,
ISectorFieldRecords
}
from
"
./sectorfields/sectorfields.types
"
;
import
{
IRRegion
,
IRRegionSchool
,
IRegionRecord
,
IRegionRecords
,
IRegionSchoolRecord
,
IRegionSchoolRecords
}
from
"
./regionschools/regionschools.types
"
;
import
{
ISectors
,
ISector
,
ISectorCourse
}
from
"
./sectorcourses/sectorcourses.types
"
;
import
{
IStudentDataField
,
IStudentDataFiel
ds
}
from
"
./studentdatafields/studentdatafields.types
"
;
import
{
IStudentDataField
Record
,
IStudentDataFieldRecor
ds
}
from
"
./studentdatafields/studentdatafields.types
"
;
import
{
IEpalClass
,
IEpalClasses
}
from
"
./epalclasses/epalclasses.types
"
;
import
{
ILoginInfoToken
,
ILoginInfo
}
from
"
./logininfo/logininfo.types
"
;
...
...
@@ -22,8 +22,8 @@ IRRegionSchool,
ISectors
,
ISector
,
ISectorCourse
,
IStudentDataField
,
IStudentDataFields
,
IStudentDataField
Record
,
IStudentDataField
Record
s
,
IEpalClass
,
IEpalClasses
,
ILoginInfo
,
...
...
source/store/sectorfields/sectorfields.initial-state.ts
View file @
b4746228
/* import { List } from "immutable";
import { ISectorField } from "./sectorfields.types";
export const SECTOR_FIELDS_INITIAL_STATE = List<ISectorField>(); */
import
{
List
}
from
"
immutable
"
;
import
{
ISectorFieldRecord
,
ISectorField
}
from
"
./sectorfields.types
"
;
import
{
recordify
}
from
"
typed-immutable-record
"
;
import
{
ISectorFieldRecord
}
from
"
./sectorfields.types
"
;
export
const
SECTOR_FIELDS_INITIAL_STATE
=
List
<
ISectorFieldRecord
>
();
source/store/sectorfields/sectorfields.reducer.ts
View file @
b4746228
import
{
ISectorFieldRecords
,
ISectorFieldRecord
,
ISectorField
}
from
"
./sectorfields.types
"
;
import
{
SECTOR_FIELDS_INITIAL_STATE
}
from
"
./sectorfields.initial-state
"
;
import
{
Seq
,
List
}
from
"
immutable
"
;
import
{
List
}
from
"
immutable
"
;
import
{
recordify
}
from
"
typed-immutable-record
"
;
import
{
...
...
source/store/store.ts
View file @
b4746228
...
...
@@ -10,7 +10,7 @@ export interface IAppState {
sectorFields
?:
sectorFields
.
ISectorFieldRecords
;
regions
?:
regions
.
IRegionRecords
;
sectors
?:
sectors
.
ISectors
;
studentDataFields
?:
studentDataFields
.
IStudentDataFields
;
studentDataFields
?:
studentDataFields
.
IStudentDataField
Record
s
;
epalclasses
?:
epalclasses
.
IEpalClasses
;
loginInfo
?:
loginInfo
.
ILoginInfo
;
};
...
...
source/store/studentdatafields/index.ts
View file @
b4746228
import
{
IStudentDataField
,
IStudentDataFiel
ds
}
from
"
./studentdatafields.types
"
;
import
{
IStudentDataField
Record
,
IStudentDataFieldRecor
ds
}
from
"
./studentdatafields.types
"
;
import
{
studentDataFieldsReducer
}
from
"
./studentdatafields.reducer
"
;
import
{
deimmutifyStudentDataFields
}
from
"
./studentdatafields.transformers
"
;
export
{
IStudentDataField
,
IStudentDataFields
,
IStudentDataField
Record
,
IStudentDataField
Record
s
,
studentDataFieldsReducer
,
deimmutifyStudentDataFields
,
};
source/store/studentdatafields/studentdatafields.initial-state.ts
View file @
b4746228
import
{
List
}
from
"
immutable
"
;
import
{
IStudentDataField
}
from
"
./studentdatafields.types
"
;
import
{
IStudentDataField
Record
}
from
"
./studentdatafields.types
"
;
export
const
STUDENT_DATA_FIELDS_INITIAL_STATE
=
List
<
IStudentDataField
>
();
export
const
STUDENT_DATA_FIELDS_INITIAL_STATE
=
List
<
IStudentDataField
Record
>
();
source/store/studentdatafields/studentdatafields.reducer.ts
View file @
b4746228
import
{
IStudentDataField
s
,
IStudentDataField
}
from
"
./studentdatafields.types
"
;
import
{
IStudentDataField
Records
,
IStudentDataFieldRecord
,
IStudentDataField
}
from
"
./studentdatafields.types
"
;
import
{
STUDENT_DATA_FIELDS_INITIAL_STATE
}
from
"
./studentdatafields.initial-state
"
;
import
{
Seq
}
from
"
immutable
"
;
import
{
recordify
}
from
"
typed-immutable-record
"
;
import
{
List
}
from
"
immutable
"
;
import
{
STUDENTDATAFIELDS_SAVE
,
STUDENTDATAFIELDS_INIT
}
from
"
../../constants
"
;
export
function
studentDataFieldsReducer
(
state
:
IStudentDataField
s
=
STUDENT_DATA_FIELDS_INITIAL_STATE
,
action
):
IStudentDataFiel
ds
{
export
function
studentDataFieldsReducer
(
state
:
IStudentDataField
Records
=
STUDENT_DATA_FIELDS_INITIAL_STATE
,
action
):
IStudentDataFieldRecor
ds
{
switch
(
action
.
type
)
{
case
STUDENTDATAFIELDS_SAVE
:
let
studentDataFields
=
Array
<
IStudentDataField
>
();
let
ind
=
0
;
let
studentDataFields
=
Array
<
IStudentDataFieldRecord
>
();
action
.
payload
.
studentDataFields
.
forEach
(
studentDataField
=>
{
let
transformedDate
=
""
;
...
...
@@ -16,16 +16,12 @@ export function studentDataFieldsReducer(state: IStudentDataFields = STUDENT_DAT
transformedDate
+=
studentDataField
.
studentbirthdate
.
date
.
month
<
10
?
"
0
"
+
studentDataField
.
studentbirthdate
.
date
.
month
+
"
-
"
:
studentDataField
.
studentbirthdate
.
date
.
month
+
"
-
"
;
transformedDate
+=
studentDataField
.
studentbirthdate
.
date
.
day
<
10
?
"
0
"
+
studentDataField
.
studentbirthdate
.
date
.
day
:
studentDataField
.
studentbirthdate
.
date
.
day
;
}
// transformedDate = studentDataField.studentbirthdate.jsDate;
studentDataField
.
studentbirthdate
=
transformedDate
;
studentDataFields
.
push
(
<
IStudentDataField
>
studentDataField
);
ind
++
;
studentDataFields
.
push
(
recordify
<
IStudentDataField
,
IStudentDataFieldRecord
>
(
studentDataField
));
});
return
Seq
(
studentDataFields
).
map
(
n
=>
n
).
toList
(
);
return
List
(
studentDataFields
);
case
STUDENTDATAFIELDS_INIT
:
return
STUDENT_DATA_FIELDS_INITIAL_STATE
;
default
:
return
state
;
...
...
source/store/studentdatafields/studentdatafields.transformers.ts
View file @
b4746228
import
{
IStudentDataField
s
,
IStudentDataField
}
from
"
./studentdatafields.types
"
;
import
{
IStudentDataField
Records
}
from
"
./studentdatafields.types
"
;
export
function
deimmutifyStudentDataFields
(
state
:
IStudentDataFields
):
IStudentDataField
[]
{
let
fetchedStudentDataFields
=
new
Array
();
state
.
forEach
(
studentdataField
=>
{
fetchedStudentDataFields
.
push
(
<
IStudentDataField
>
{
epaluser_id
:
studentdataField
.
epaluser_id
,
name
:
studentdataField
.
name
,
studentsurname
:
studentdataField
.
studentsurname
,
studentbirthdate
:
studentdataField
.
studentbirthdate
,
fatherfirstname
:
studentdataField
.
fatherfirstname
,
fathersurname
:
studentdataField
.
fathersurname
,
motherfirstname
:
studentdataField
.
motherfirstname
,
mothersurname
:
studentdataField
.
mothersurname
,
studentamka
:
studentdataField
.
studentamka
,
regionaddress
:
studentdataField
.
regionaddress
,
regiontk
:
studentdataField
.
regiontk
,
regionarea
:
studentdataField
.
regionarea
,
lastschool_schoolname
:
studentdataField
.
lastschool_schoolname
,
lastschool_schoolyear
:
studentdataField
.
lastschool_schoolyear
,
lastschool_class
:
studentdataField
.
lastschool_class
,
relationtostudent
:
studentdataField
.
relationtostudent
,
currentclass
:
studentdataField
.
currentclass
,
points
:
studentdataField
.
points
});
});
return
fetchedStudentDataFields
;
export
function
deimmutifyStudentDataFields
(
state
:
IStudentDataFieldRecords
):
IStudentDataFieldRecords
{
return
state
;
};
source/store/studentdatafields/studentdatafields.types.ts
View file @
b4746228
import
{
List
}
from
"
immutable
"
;
import
{
TypedRecord
}
from
"
typed-immutable-record
"
;
export
interface
IStudentDataField
{
epaluser_id
:
number
;
...
...
@@ -22,4 +23,6 @@ export interface IStudentDataField {
telnum
:
string
;
}
export
type
IStudentDataFields
=
List
<
IStudentDataField
>
;
export
interface
IStudentDataFieldRecord
extends
TypedRecord
<
IStudentDataFieldRecord
>
,
IStudentDataField
{
};
export
type
IStudentDataFieldRecords
=
List
<
IStudentDataFieldRecord
>
;
// export type IStudentDataFields = List<IStudentDataField>;
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