Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
f109b9cf
Commit
f109b9cf
authored
Jul 31, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restructured IStudentDataFields
parent
17ff7053
Changes
11
Expand all
Show 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 @
f109b9cf
...
@@ -4,7 +4,7 @@ import { Injectable } from "@angular/core";
...
@@ -4,7 +4,7 @@ import { Injectable } from "@angular/core";
import
{
Router
}
from
"
@angular/router
"
;
import
{
Router
}
from
"
@angular/router
"
;
import
{
NgRedux
,
select
}
from
"
@angular-redux/store
"
;
import
{
NgRedux
,
select
}
from
"
@angular-redux/store
"
;
import
{
StudentDataFieldsActions
}
from
"
../../actions/studentdatafields.actions
"
;
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
{
IAppState
}
from
"
../../store/store
"
;
import
{
VALID_NAMES_PATTERN
,
VALID_UCASE_NAMES_PATTERN
,
VALID_ADDRESS_PATTERN
,
VALID_ADDRESSTK_PATTERN
,
VALID_DIGITS_PATTERN
,
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
"
;
VALID_DATE_PATTERN
,
FIRST_SCHOOL_YEAR
,
VALID_YEAR_PATTERN
,
VALID_TELEPHONE_PATTERN
}
from
"
../../constants
"
;
...
@@ -30,7 +30,7 @@ import {
...
@@ -30,7 +30,7 @@ import {
@
Injectable
()
export
default
class
StudentApplicationMain
implements
OnInit
{
@
Injectable
()
export
default
class
StudentApplicationMain
implements
OnInit
{
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataFields
>
;
private
studentDataFields$
:
BehaviorSubject
<
IStudentDataField
Record
s
>
;
private
studentDataFieldsSub
:
Subscription
;
private
studentDataFieldsSub
:
Subscription
;
private
loginInfoSub
:
Subscription
;
private
loginInfoSub
:
Subscription
;
...
@@ -112,23 +112,23 @@ import {
...
@@ -112,23 +112,23 @@ import {
this
.
studentDataFieldsSub
=
this
.
_ngRedux
.
select
(
"
studentDataFields
"
)
this
.
studentDataFieldsSub
=
this
.
_ngRedux
.
select
(
"
studentDataFields
"
)
.
subscribe
(
studentDataFields
=>
{
.
subscribe
(
studentDataFields
=>
{
let
sdfds
=
<
IStudentDataFields
>
studentDataFields
;
let
sdfds
=
<
IStudentDataField
Record
s
>
studentDataFields
;
if
(
sdfds
.
size
>
0
)
{
if
(
sdfds
.
size
>
0
)
{
sdfds
.
reduce
(({},
studentDataField
)
=>
{
sdfds
.
reduce
(({},
studentDataField
)
=>
{
this
.
studentDataGroup
.
controls
[
"
name
"
].
setValue
(
studentDataField
.
name
);
this
.
studentDataGroup
.
controls
[
"
name
"
].
setValue
(
studentDataField
.
get
(
"
name
"
)
);
this
.
studentDataGroup
.
controls
[
"
studentsurname
"
].
setValue
(
studentDataField
.
studentsurname
);
this
.
studentDataGroup
.
controls
[
"
studentsurname
"
].
setValue
(
studentDataField
.
get
(
"
studentsurname
"
)
);
this
.
studentDataGroup
.
controls
[
"
fatherfirstname
"
].
setValue
(
studentDataField
.
fatherfirstname
);
this
.
studentDataGroup
.
controls
[
"
fatherfirstname
"
].
setValue
(
studentDataField
.
get
(
"
fatherfirstname
"
)
);
this
.
studentDataGroup
.
controls
[
"
motherfirstname
"
].
setValue
(
studentDataField
.
motherfirstname
);
this
.
studentDataGroup
.
controls
[
"
motherfirstname
"
].
setValue
(
studentDataField
.
get
(
"
motherfirstname
"
)
);
this
.
studentDataGroup
.
controls
[
"
regionaddress
"
].
setValue
(
studentDataField
.
regionaddress
);
this
.
studentDataGroup
.
controls
[
"
regionaddress
"
].
setValue
(
studentDataField
.
get
(
"
regionaddress
"
)
);
this
.
studentDataGroup
.
controls
[
"
regiontk
"
].
setValue
(
studentDataField
.
regiontk
);
this
.
studentDataGroup
.
controls
[
"
regiontk
"
].
setValue
(
studentDataField
.
get
(
"
regiontk
"
)
);
this
.
studentDataGroup
.
controls
[
"
regionarea
"
].
setValue
(
studentDataField
.
regionarea
);
this
.
studentDataGroup
.
controls
[
"
regionarea
"
].
setValue
(
studentDataField
.
get
(
"
regionarea
"
)
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolname
"
].
setValue
(
studentDataField
.
lastschool_schoolname
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolname
"
].
setValue
(
studentDataField
.
get
(
"
lastschool_schoolname
"
)
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolyear
"
].
setValue
(
studentDataField
.
lastschool_schoolyear
);
this
.
studentDataGroup
.
controls
[
"
lastschool_schoolyear
"
].
setValue
(
studentDataField
.
get
(
"
lastschool_schoolyear
"
)
);
this
.
studentDataGroup
.
controls
[
"
lastschool_class
"
].
setValue
(
studentDataField
.
lastschool_class
);
this
.
studentDataGroup
.
controls
[
"
lastschool_class
"
].
setValue
(
studentDataField
.
get
(
"
lastschool_class
"
)
);
this
.
studentDataGroup
.
controls
[
"
relationtostudent
"
].
setValue
(
studentDataField
.
relationtostudent
);
this
.
studentDataGroup
.
controls
[
"
relationtostudent
"
].
setValue
(
studentDataField
.
get
(
"
relationtostudent
"
)
);
this
.
studentDataGroup
.
controls
[
"
telnum
"
].
setValue
(
studentDataField
.
telnum
);
this
.
studentDataGroup
.
controls
[
"
telnum
"
].
setValue
(
studentDataField
.
get
(
"
telnum
"
)
);
this
.
studentDataGroup
.
controls
[
"
studentbirthdate
"
].
setValue
(
this
.
populateDate
(
studentDataField
.
studentbirthdate
));
this
.
studentDataGroup
.
controls
[
"
studentbirthdate
"
].
setValue
(
this
.
populateDate
(
studentDataField
.
get
(
"
studentbirthdate
"
)
));
return
studentDataField
;
return
studentDataField
;
},
{});
},
{});
}
}
...
...
source/components/student-application-form/application.submit.ts
View file @
f109b9cf
This diff is collapsed.
Click to expand it.
source/store/index.ts
View file @
f109b9cf
...
@@ -4,7 +4,7 @@ import { IAppState, rootReducer, deimmutify } from "./store";
...
@@ -4,7 +4,7 @@ import { IAppState, rootReducer, deimmutify } from "./store";
import
{
ISectorFieldRecord
,
ISectorFieldRecords
}
from
"
./sectorfields/sectorfields.types
"
;
import
{
ISectorFieldRecord
,
ISectorFieldRecords
}
from
"
./sectorfields/sectorfields.types
"
;
import
{
IRRegion
,
IRRegionSchool
,
IRegionRecord
,
IRegionRecords
,
IRegionSchoolRecord
,
IRegionSchoolRecords
}
from
"
./regionschools/regionschools.types
"
;
import
{
IRRegion
,
IRRegionSchool
,
IRegionRecord
,
IRegionRecords
,
IRegionSchoolRecord
,
IRegionSchoolRecords
}
from
"
./regionschools/regionschools.types
"
;
import
{
ISectors
,
ISector
,
ISectorCourse
}
from
"
./sectorcourses/sectorcourses.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
{
IEpalClass
,
IEpalClasses
}
from
"
./epalclasses/epalclasses.types
"
;
import
{
ILoginInfoToken
,
ILoginInfo
}
from
"
./logininfo/logininfo.types
"
;
import
{
ILoginInfoToken
,
ILoginInfo
}
from
"
./logininfo/logininfo.types
"
;
...
@@ -22,8 +22,8 @@ IRRegionSchool,
...
@@ -22,8 +22,8 @@ IRRegionSchool,
ISectors
,
ISectors
,
ISector
,
ISector
,
ISectorCourse
,
ISectorCourse
,
IStudentDataField
,
IStudentDataField
Record
,
IStudentDataFields
,
IStudentDataField
Record
s
,
IEpalClass
,
IEpalClass
,
IEpalClasses
,
IEpalClasses
,
ILoginInfo
,
ILoginInfo
,
...
...
source/store/sectorfields/sectorfields.initial-state.ts
View file @
f109b9cf
/* import { List } from "immutable";
import { ISectorField } from "./sectorfields.types";
export const SECTOR_FIELDS_INITIAL_STATE = List<ISectorField>(); */
import
{
List
}
from
"
immutable
"
;
import
{
List
}
from
"
immutable
"
;
import
{
ISectorFieldRecord
,
ISectorField
}
from
"
./sectorfields.types
"
;
import
{
ISectorFieldRecord
}
from
"
./sectorfields.types
"
;
import
{
recordify
}
from
"
typed-immutable-record
"
;
export
const
SECTOR_FIELDS_INITIAL_STATE
=
List
<
ISectorFieldRecord
>
();
export
const
SECTOR_FIELDS_INITIAL_STATE
=
List
<
ISectorFieldRecord
>
();
source/store/sectorfields/sectorfields.reducer.ts
View file @
f109b9cf
import
{
ISectorFieldRecords
,
ISectorFieldRecord
,
ISectorField
}
from
"
./sectorfields.types
"
;
import
{
ISectorFieldRecords
,
ISectorFieldRecord
,
ISectorField
}
from
"
./sectorfields.types
"
;
import
{
SECTOR_FIELDS_INITIAL_STATE
}
from
"
./sectorfields.initial-state
"
;
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
{
recordify
}
from
"
typed-immutable-record
"
;
import
{
import
{
...
...
source/store/store.ts
View file @
f109b9cf
...
@@ -10,7 +10,7 @@ export interface IAppState {
...
@@ -10,7 +10,7 @@ export interface IAppState {
sectorFields
?:
sectorFields
.
ISectorFieldRecords
;
sectorFields
?:
sectorFields
.
ISectorFieldRecords
;
regions
?:
regions
.
IRegionRecords
;
regions
?:
regions
.
IRegionRecords
;
sectors
?:
sectors
.
ISectors
;
sectors
?:
sectors
.
ISectors
;
studentDataFields
?:
studentDataFields
.
IStudentDataFields
;
studentDataFields
?:
studentDataFields
.
IStudentDataField
Record
s
;
epalclasses
?:
epalclasses
.
IEpalClasses
;
epalclasses
?:
epalclasses
.
IEpalClasses
;
loginInfo
?:
loginInfo
.
ILoginInfo
;
loginInfo
?:
loginInfo
.
ILoginInfo
;
};
};
...
...
source/store/studentdatafields/index.ts
View file @
f109b9cf
import
{
IStudentDataField
,
IStudentDataFiel
ds
}
from
"
./studentdatafields.types
"
;
import
{
IStudentDataField
Record
,
IStudentDataFieldRecor
ds
}
from
"
./studentdatafields.types
"
;
import
{
studentDataFieldsReducer
}
from
"
./studentdatafields.reducer
"
;
import
{
studentDataFieldsReducer
}
from
"
./studentdatafields.reducer
"
;
import
{
deimmutifyStudentDataFields
}
from
"
./studentdatafields.transformers
"
;
import
{
deimmutifyStudentDataFields
}
from
"
./studentdatafields.transformers
"
;
export
{
export
{
IStudentDataField
,
IStudentDataField
Record
,
IStudentDataFields
,
IStudentDataField
Record
s
,
studentDataFieldsReducer
,
studentDataFieldsReducer
,
deimmutifyStudentDataFields
,
deimmutifyStudentDataFields
,
};
};
source/store/studentdatafields/studentdatafields.initial-state.ts
View file @
f109b9cf
import
{
List
}
from
"
immutable
"
;
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 @
f109b9cf
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
{
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
"
;
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
)
{
switch
(
action
.
type
)
{
case
STUDENTDATAFIELDS_SAVE
:
case
STUDENTDATAFIELDS_SAVE
:
let
studentDataFields
=
Array
<
IStudentDataField
>
();
let
studentDataFields
=
Array
<
IStudentDataFieldRecord
>
();
let
ind
=
0
;
action
.
payload
.
studentDataFields
.
forEach
(
studentDataField
=>
{
action
.
payload
.
studentDataFields
.
forEach
(
studentDataField
=>
{
let
transformedDate
=
""
;
let
transformedDate
=
""
;
...
@@ -16,16 +16,12 @@ export function studentDataFieldsReducer(state: IStudentDataFields = STUDENT_DAT
...
@@ -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
.
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
.
date
.
day
<
10
?
"
0
"
+
studentDataField
.
studentbirthdate
.
date
.
day
:
studentDataField
.
studentbirthdate
.
date
.
day
;
}
}
// transformedDate = studentDataField.studentbirthdate.jsDate;
studentDataField
.
studentbirthdate
=
transformedDate
;
studentDataField
.
studentbirthdate
=
transformedDate
;
studentDataFields
.
push
(
recordify
<
IStudentDataField
,
IStudentDataFieldRecord
>
(
studentDataField
));
studentDataFields
.
push
(
<
IStudentDataField
>
studentDataField
);
ind
++
;
});
});
return
Seq
(
studentDataFields
).
map
(
n
=>
n
).
toList
(
);
return
List
(
studentDataFields
);
case
STUDENTDATAFIELDS_INIT
:
case
STUDENTDATAFIELDS_INIT
:
return
STUDENT_DATA_FIELDS_INITIAL_STATE
;
return
STUDENT_DATA_FIELDS_INITIAL_STATE
;
default
:
return
state
;
default
:
return
state
;
...
...
source/store/studentdatafields/studentdatafields.transformers.ts
View file @
f109b9cf
import
{
IStudentDataField
s
,
IStudentDataField
}
from
"
./studentdatafields.types
"
;
import
{
IStudentDataField
Records
}
from
"
./studentdatafields.types
"
;
export
function
deimmutifyStudentDataFields
(
state
:
IStudentDataFields
):
IStudentDataField
[]
{
export
function
deimmutifyStudentDataFields
(
state
:
IStudentDataFieldRecords
):
IStudentDataFieldRecords
{
let
fetchedStudentDataFields
=
new
Array
();
return
state
;
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
;
};
};
source/store/studentdatafields/studentdatafields.types.ts
View file @
f109b9cf
import
{
List
}
from
"
immutable
"
;
import
{
List
}
from
"
immutable
"
;
import
{
TypedRecord
}
from
"
typed-immutable-record
"
;
export
interface
IStudentDataField
{
export
interface
IStudentDataField
{
epaluser_id
:
number
;
epaluser_id
:
number
;
...
@@ -22,4 +23,6 @@ export interface IStudentDataField {
...
@@ -22,4 +23,6 @@ export interface IStudentDataField {
telnum
:
string
;
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