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
c6940e79
Commit
c6940e79
authored
May 09, 2017
by
Νίκος Κατσαούνος
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated minister-reports component by creating reports based on specificfilters
parent
e72a58de
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
320 additions
and
29 deletions
+320
-29
source/components/minister/minister-reports.ts
source/components/minister/minister-reports.ts
+240
-21
source/containers/globalstyles.css
source/containers/globalstyles.css
+11
-3
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+69
-5
No files found.
source/components/minister/minister-reports.ts
View file @
c6940e79
...
...
@@ -14,6 +14,14 @@ import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial
import
{
reportsSchema
,
TableColumn
}
from
'
./reports-schema
'
;
import
{
FormBuilder
,
FormGroup
,
FormControl
,
FormArray
,
Validators
,
}
from
'
@angular/forms
'
;
import
*
as
d3
from
'
d3
'
;
...
...
@@ -28,18 +36,82 @@ import { API_ENDPOINT } from '../../app.settings';
<div>
<form [formGroup]="formGroup" #form>
<h5> >Επιλογή Φίλτρων <br><br></h5>
<div class="form-group">
<label>Περιφερειακή Διεύθυνση</label>
<select #regsel class="form-control" (change)="checkregion(regsel)" formControlName="region">
<option *ngFor="let RegionSelection$ of RegionSelections$ | async; let i=index" [value] = "RegionSelection$.id"> {{RegionSelection$.name}} </option>
</select>
</div>
<div class="form-group">
<label *ngIf="showAdminList | async">Διεύθυνση Εκπαίδευσης</label>
<select #admsel class="form-control" *ngIf="showAdminList | async" (change)="checkadminarea(admsel)" formControlName="adminarea">
<option *ngFor="let AdminAreaSelection$ of AdminAreaSelections$ | async; let i=index" [value] = "AdminAreaSelection$.id"> {{AdminAreaSelection$.name}} {{AdminAreaSelection$.id}}</option>
</select>
</div>
<div class="form-group">
<label *ngIf="showAdminList | async">Σχολείο</label>
<select #schsel class="form-control" *ngIf="showAdminList | async" (change)="checkschool(schsel)" formControlName="schoollist">
<option *ngFor="let SchoolSelection$ of SchoolSelections$ | async; let i=index" [value] = "SchoolSelection$.epal_id"> {{SchoolSelection$.epal_name}} </option>
</select>
</div>
<button type="submit" class="btn btn-alert" (click)="createReport(reportId, regsel)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Δημιουργία Αναφοράς
</button>
</form>
<!--
<div
class = "loading" *ngIf="
!validCreator && reportId
" >
class = "loading" *ngIf="
(!validCreator && reportId)
" >
</div>
<button type="submit" class="btn btn-default btn-block" (click)="createReport('/ministry/general-report/')" [hidden]="minedu_userName == ''" >
Κατανομή Μαθητών με Βάση τη Σειρά Προτίμησης
</button>
<button type="submit" class="btn btn-default btn-block" (click)="createReport('/ministry/report-completeness/')" [hidden]="minedu_userName == ''" >
Πληρότητα Σχολείων
</button>
<button type="submit" class="btn btn-default btn-block" (click)="createReport('/ministry/report-all-stat/')" [hidden]="minedu_userName == ''" >
-->
<h5><br> >Επιλογή Αναφοράς<br><br></h5>
<!-- btn-block "btn btn-default -->
<div class="col-md-1">
<!--
<button type="button" class="btn btn-alert" (click)="createReport('/ministry/general-report/', regsel)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Κατανομή Μαθητών με Βάση τη Σειρά Προτίμησης
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="createReport('/ministry/report-completeness/', regsel)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Πληρότητα Σχολείων
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="createReport('/ministry/report-all-stat/', regsel)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Μαθητές ανά Τάξη/Τομέα/Ειδικότητα
</button>
<br><br>
-->
<button type="button" class="btn btn-alert" (click)="selectreport(1)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Κατανομή Μαθητών με Βάση τη Σειρά Προτίμησης
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="selectreport(2)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Πληρότητα Σχολείων
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="selectreport(3)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Μαθητές ανά Τάξη/Τομέα/Ειδικότητα
</button>
<br><br>
</div>
<!--
<button type="submit" class="btn btn-default btn-block" (click)="showFilters()" [hidden]="minedu_userName == ''" >
Μαθητές ανά Τάξη/Τομέα/Ειδικότητα
</button>
-->
<div *ngIf="validCreator ">
...
...
@@ -63,6 +135,8 @@ import { API_ENDPOINT } from '../../app.settings';
<div class="d3-chart" *ngIf = "!charIsHidden() && validCreator" #chart>
</div>
<!--<div *ngFor="let generalReports$ of generalReport$ | async; let i=index">-->
`
...
...
@@ -70,11 +144,17 @@ import { API_ENDPOINT } from '../../app.settings';
@
Injectable
()
export
default
class
MinisterReports
implements
OnInit
,
OnDestroy
{
//
public formGroup: FormGroup;
public
formGroup
:
FormGroup
;
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
loginInfoSub
:
Subscription
;
private
generalReport$
:
BehaviorSubject
<
any
>
;
private
RegionSelections$
:
BehaviorSubject
<
any
>
;
private
AdminAreaSelections$
:
BehaviorSubject
<
any
>
;
private
SchoolSelections$
:
BehaviorSubject
<
any
>
;
private
generalReportSub
:
Subscription
;
private
RegionSelectionsSub
:
Subscription
;
private
AdminAreaSelectionsSub
:
Subscription
;
private
SchoolSelectionsSub
:
Subscription
;
private
apiEndPoint
=
API_ENDPOINT
;
private
minedu_userName
:
string
;
private
minedu_userPassword
:
string
;
...
...
@@ -84,6 +164,9 @@ import { API_ENDPOINT } from '../../app.settings';
private
createGraph
:
boolean
;
private
reportId
:
number
;
private
source
:
LocalDataSource
;
private
showAdminList
:
BehaviorSubject
<
boolean
>
;
private
adminAreaSelected
:
number
;
private
schSelected
:
number
;
columnMap
:
Map
<
string
,
TableColumn
>
=
new
Map
<
string
,
TableColumn
>
();
@
Input
()
settings
:
any
;
...
...
@@ -103,23 +186,31 @@ import { API_ENDPOINT } from '../../app.settings';
private
xAxis
:
any
;
private
yAxis
:
any
;
constructor
(
/*private fb: FormBuilder,*/
constructor
(
private
fb
:
FormBuilder
,
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
_hds
:
HelperDataService
,
private
activatedRoute
:
ActivatedRoute
,
private
router
:
Router
)
{
//this.formGroup = this.fb.group({
//});
this
.
formGroup
=
this
.
fb
.
group
({
region
:
[
''
,
[]],
adminarea
:
[
''
,
[]],
schoollist
:
[
''
,
[]],
});
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
this
.
generalReport$
=
new
BehaviorSubject
([{}]);
this
.
RegionSelections$
=
new
BehaviorSubject
([{}]);
this
.
AdminAreaSelections$
=
new
BehaviorSubject
([{}]);
this
.
SchoolSelections$
=
new
BehaviorSubject
([{}]);
this
.
minedu_userName
=
''
;
this
.
validCreator
=
false
;
this
.
createGraph
=
false
;
this
.
reportId
=
0
;
this
.
showAdminList
=
new
BehaviorSubject
(
false
);
this
.
adminAreaSelected
=
0
;
this
.
schSelected
=
0
;
//this.showAdminList = false;
//this.source = new LocalDataSource(this.data);
}
...
...
@@ -128,11 +219,18 @@ import { API_ENDPOINT } from '../../app.settings';
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
this
.
loginInfo$
.
unsubscribe
();
//this.loginInfo$.unsubscribe();
if
(
this
.
generalReportSub
)
this
.
generalReportSub
.
unsubscribe
();
this
.
generalReport$
.
unsubscribe
();
//this.generalReport$.unsubscribe();
if
(
this
.
RegionSelectionsSub
)
this
.
RegionSelectionsSub
.
unsubscribe
();
if
(
this
.
AdminAreaSelectionsSub
)
this
.
AdminAreaSelectionsSub
.
unsubscribe
();
if
(
this
.
SchoolSelectionsSub
)
this
.
SchoolSelectionsSub
.
unsubscribe
();
if
(
this
.
showAdminList
)
this
.
showAdminList
.
unsubscribe
();
}
...
...
@@ -149,7 +247,7 @@ import { API_ENDPOINT } from '../../app.settings';
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
this
.
showFilters
();
...
...
@@ -168,13 +266,20 @@ import { API_ENDPOINT } from '../../app.settings';
}
selectreport
(
repId
)
{
this
.
reportId
=
repId
;
console
.
log
(
"
...
"
);
console
.
log
(
repId
);
}
createReport
(
routePath
)
{
createReport
(
routePath
,
regionSel
)
{
this
.
reportId
=
0
;
//
this.reportId = 0;
this
.
validCreator
=
false
;
this
.
createGraph
=
false
;
/*
if (routePath === "/ministry/general-report/") {
this.reportId = 1;
this.settings = this.reportSchema.genReportSchema;
...
...
@@ -187,8 +292,43 @@ createReport(routePath) {
this.reportId = 3;
this.settings = this.reportSchema.reportAllStatSchema;
}
*/
let
route
;
if
(
routePath
===
1
)
{
route
=
"
/ministry/general-report/
"
;
this
.
settings
=
this
.
reportSchema
.
genReportSchema
;
}
else
if
(
routePath
===
2
)
{
route
=
"
/ministry/report-completeness/
"
;
this
.
settings
=
this
.
reportSchema
.
reportCompletenessSchema
;
}
else
if
(
routePath
===
3
)
{
route
=
"
/ministry/report-all-stat/
"
;
this
.
settings
=
this
.
reportSchema
.
reportAllStatSchema
;
}
let
regSel
=
0
;
//let admSel = 0, schSel = 0;
if
(
regionSel
.
value
!=
0
)
regSel
=
regionSel
.
value
;
//For some reason, template #vars can not work..
/*
if (typeof adminSel !== 'undefined') {
console.log("YES2");
admSel = adminSel.value;
console.log("YES3");
}
if (typeof schoolSel !== 'undefined')
schSel = schoolSel.value;
*/
this
.
generalReportSub
=
this
.
_hds
.
makeReport
(
this
.
minedu_userName
,
this
.
minedu_userPassword
,
routePath
).
subscribe
(
data
=>
{
//this.generalReportSub = this._hds.makeReport(this.minedu_userName, this.minedu_userPassword, routePath, regSel, this.adminAreaSelected, this.schSelected).subscribe(data => {
this
.
generalReportSub
=
this
.
_hds
.
makeReport
(
this
.
minedu_userName
,
this
.
minedu_userPassword
,
route
,
regSel
,
this
.
adminAreaSelected
,
this
.
schSelected
).
subscribe
(
data
=>
{
this
.
generalReport$
.
next
(
data
);
this
.
data
=
data
;
console
.
log
(
"
Let see..
"
);
...
...
@@ -219,6 +359,85 @@ createReport(routePath) {
}
showFilters
()
{
//this.reportId = 3;
this
.
RegionSelectionsSub
=
this
.
_hds
.
getRegions
(
this
.
minedu_userName
,
this
.
minedu_userPassword
).
subscribe
(
data
=>
{
this
.
RegionSelections$
.
next
(
data
);
},
error
=>
{
this
.
RegionSelections$
.
next
([{}]);
console
.
log
(
"
Error Getting RegionSelections
"
);
},
()
=>
console
.
log
(
"
Success Getting RegionSelectionsSub
"
));
}
checkregion
(
regionId
)
{
this
.
adminAreaSelected
=
0
;
this
.
schSelected
=
0
;
this
.
AdminAreaSelectionsSub
=
this
.
_hds
.
getAdminAreas
(
this
.
minedu_userName
,
this
.
minedu_userPassword
,
regionId
.
value
).
subscribe
(
data
=>
{
this
.
AdminAreaSelections$
.
next
(
data
);
},
error
=>
{
this
.
AdminAreaSelections$
.
next
([{}]);
console
.
log
(
"
Error Getting AdminAreaSelections
"
);
},
()
=>
{
console
.
log
(
"
Success Getting AdminAreaSelectionsSub
"
);
this
.
showAdminList
.
next
(
true
);
}
);
this
.
SchoolSelectionsSub
=
this
.
_hds
.
getSchoolsPerRegion
(
this
.
minedu_userName
,
this
.
minedu_userPassword
,
regionId
.
value
).
subscribe
(
data
=>
{
this
.
SchoolSelections$
.
next
(
data
);
},
error
=>
{
this
.
SchoolSelections$
.
next
([{}]);
console
.
log
(
"
Error Getting SchoolSelections
"
);
},
()
=>
{
console
.
log
(
"
Success Getting SchoolSelectionsSub
"
);
this
.
showAdminList
.
next
(
true
);
}
);
}
checkadminarea
(
adminId
)
{
this
.
schSelected
=
0
;
console
.
log
(
"
TI EINAI;
"
)
console
.
log
(
adminId
);
console
.
log
(
adminId
.
value
);
this
.
adminAreaSelected
=
adminId
.
value
;
this
.
SchoolSelectionsSub
=
this
.
_hds
.
getSchoolsPerAdminArea
(
this
.
minedu_userName
,
this
.
minedu_userPassword
,
adminId
.
value
).
subscribe
(
data
=>
{
this
.
SchoolSelections$
.
next
(
data
);
},
error
=>
{
this
.
SchoolSelections$
.
next
([{}]);
console
.
log
(
"
Error Getting SchoolSelections
"
);
},
()
=>
{
console
.
log
(
"
Success Getting SchoolSelectionsSub
"
);
this
.
showAdminList
.
next
(
true
);
}
);
}
checkschool
(
schId
)
{
this
.
schSelected
=
schId
.
value
;
}
onSearch
(
query
:
string
=
''
)
{
...
...
source/containers/globalstyles.css
View file @
c6940e79
...
...
@@ -176,18 +176,18 @@
background-color
:
#fd9665
;
}
.changecolor
.changecolor
{
color
:
red
;
}
.changelistcolor
.changelistcolor
{
color
:
red
!important
;
}
.aastyle
{
color
:
black
!important
;
color
:
black
!important
;
}
.roundedNumber
{
...
...
@@ -223,3 +223,11 @@ overflow-x: scroll;
.d3-chart
.axis
text
{
fill
:
#999
;
}
.btn-lg.round
{
border-radius
:
24px
;
}
.btn.sharp
{
border-radius
:
0
;
}
source/services/helper-data-service.ts
View file @
c6940e79
...
...
@@ -667,7 +667,7 @@ export class HelperDataService implements OnInit, OnDestroy {
}
makeReport
(
username
,
userpassword
,
routepath
)
{
makeReport
(
username
,
userpassword
,
routepath
,
regionsel
,
adminsel
,
schsel
)
{
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
...
...
@@ -676,7 +676,10 @@ export class HelperDataService implements OnInit, OnDestroy {
this
.
createMinistryAuthorizationHeader
(
headers
,
username
,
userpassword
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
`
+
routepath
,
options
)
console
.
log
(
"
Testing..
"
);
console
.
log
(
`
${
AppSettings
.
API_ENDPOINT
}
`
+
routepath
+
regionsel
);
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
`
+
routepath
+
regionsel
+
"
/
"
+
adminsel
+
"
/
"
+
schsel
,
options
)
.
map
(
response
=>
response
.
json
());
}
...
...
@@ -710,7 +713,6 @@ export class HelperDataService implements OnInit, OnDestroy {
console
.
log
(
PerfectureId
,
"
a
"
);
let
PerfectureIdNew
=
PerfectureId
.
toString
();
this
.
loginInfo$
.
getValue
().
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
...
...
@@ -718,7 +720,6 @@ export class HelperDataService implements OnInit, OnDestroy {
console
.
log
(
"
authToken=
"
+
this
.
authToken
);
console
.
log
(
"
authRole=
"
+
this
.
authRole
);
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
...
...
@@ -740,7 +741,6 @@ export class HelperDataService implements OnInit, OnDestroy {
console
.
log
(
"
authToken=
"
+
this
.
authToken
);
console
.
log
(
"
authRole=
"
+
this
.
authRole
);
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
...
...
@@ -750,6 +750,70 @@ export class HelperDataService implements OnInit, OnDestroy {
.
map
(
response
=>
response
.
json
());
}
getRegions
(
username
,
userpassword
)
{
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createMinistryAuthorizationHeader
(
headers
,
username
,
userpassword
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
//return this.http.get(`${AppSettings.API_ENDPOINT}` + routepath , options)
// .map(response => response.json());
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/regionfields/list`
,
options
)
.
map
(
response
=>
response
.
json
());
}
getAdminAreas
(
username
,
userpassword
,
regionid
)
{
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createMinistryAuthorizationHeader
(
headers
,
username
,
userpassword
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
//return this.http.get(`${AppSettings.API_ENDPOINT}` + routepath , options)
// .map(response => response.json());
console
.
log
(
"
Test
"
);
console
.
log
(
`
${
AppSettings
.
API_ENDPOINT
}
/adminfields/list/?region=`
+
regionid
);
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/adminfields/list/?region=`
+
regionid
,
options
)
.
map
(
response
=>
response
.
json
());
}
getSchoolsPerRegion
(
username
,
userpassword
,
regionid
)
{
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createMinistryAuthorizationHeader
(
headers
,
username
,
userpassword
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
console
.
log
(
"
Test2
"
);
console
.
log
(
`
${
AppSettings
.
API_ENDPOINT
}
/schoolfields_per_region/list/?region=`
+
regionid
);
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/schoolfields_per_region/list/?region=`
+
regionid
,
options
)
.
map
(
response
=>
response
.
json
());
}
getSchoolsPerAdminArea
(
username
,
userpassword
,
adminid
)
{
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createMinistryAuthorizationHeader
(
headers
,
username
,
userpassword
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
console
.
log
(
"
Test3
"
);
console
.
log
(
`
${
AppSettings
.
API_ENDPOINT
}
/schoolfields_per_admin/list/?adminarea=`
+
adminid
);
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/schoolfields_per_admin/list/?adminarea=`
+
adminid
,
options
)
.
map
(
response
=>
response
.
json
());
}
...
...
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