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
1585bcda
Commit
1585bcda
authored
Jun 16, 2017
by
Χάρης Παπαδόπουλος
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'reports-check1' into 'develop'
Review reports 0,1 See merge request !186
parents
744c333c
4b643102
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
295 additions
and
365 deletions
+295
-365
drupal/modules/epal/epal.routing.yml
drupal/modules/epal/epal.routing.yml
+1
-1
drupal/modules/epal/src/Controller/ReportsCreator.php
drupal/modules/epal/src/Controller/ReportsCreator.php
+168
-164
source/components/minister/minister-reports.ts
source/components/minister/minister-reports.ts
+32
-61
source/components/minister/report-general.ts
source/components/minister/report-general.ts
+55
-94
source/components/minister/report-users.ts
source/components/minister/report-users.ts
+38
-44
source/containers/main.routes.ts
source/containers/main.routes.ts
+1
-1
No files found.
drupal/modules/epal/epal.routing.yml
View file @
1585bcda
...
...
@@ -147,7 +147,7 @@ epal.ministry.general_report:
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::make
g
GeneralReport'
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::makeGeneralReport'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.report-completeness
:
...
...
drupal/modules/epal/src/Controller/ReportsCreator.php
View file @
1585bcda
...
...
@@ -60,180 +60,189 @@ class ReportsCreator extends ControllerBase {
);
}
public
function
makeReportUsers
(
Request
$request
)
{
try
{
if
(
!
$request
->
isMethod
(
'GET'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
public
function
makeReportUsers
(
Request
$request
)
{
try
{
if
(
!
$request
->
isMethod
(
'GET'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
//user validation
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//user role validation
$roles
=
$user
->
getRoles
();
$validRole
=
false
;
foreach
(
$roles
as
$role
)
if
(
$role
===
"ministry"
)
{
$validRole
=
true
;
break
;
}
if
(
!
$validRole
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
$list
=
array
();
//υπολογισμός αριθμού αιτήσεων
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
));
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων (συνολικά)"
,
'numStudents'
=>
$numApplications
));
//υπολογισμός αριθμού αιτήσεων ανά τάξη
for
(
$i
=
1
;
$i
<=
4
;
$i
++
)
{
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.currentclass'
,
strval
(
$i
)
,
'='
);
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων για "
.
$i
.
"η Τάξη"
,
'numStudents'
=>
$numApplications
));
}
//user validation
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//υπολογισμός αριθμού αιτήσεων για δεύτερη περίοδο
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.second_period'
,
1
,
'='
);
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων B' περιόδου"
,
'numStudents'
=>
$numApplications
));
//υπολογισμός αριθμού χρηστών
$sCon
=
$this
->
connection
->
select
(
'epal_users'
,
'eUser'
)
->
fields
(
'eUser'
,
array
(
'id'
));
$numUsers
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Εγγεγραμένων Χρηστών με ρόλο Αιτούντα"
,
'numStudents'
=>
$numUsers
));
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
//end try
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"An unexpected problem occured during makegGeneralReport Method"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
//user role validation
$roles
=
$user
->
getRoles
();
$validRole
=
false
;
foreach
(
$roles
as
$role
)
if
(
$role
===
"ministry"
)
{
$validRole
=
true
;
break
;
}
if
(
!
$validRole
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
$list
=
array
();
//υπολογισμός αριθμού αιτήσεων
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
));
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων (συνολικά)"
,
'numStudents'
=>
$numApplications
));
//υπολογισμός αριθμού αιτήσεων ανά τάξη
$classes
=
[
1
=>
'Α'
,
2
=>
'Β'
,
3
=>
'Γ'
,
4
=>
'Δ'
];
foreach
(
$classes
as
$i
=>
$label
)
{
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.currentclass'
,
strval
(
$i
)
,
'='
);
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων για
{
$label
}
Τάξη"
,
'numStudents'
=>
$numApplications
));
}
//υπολογισμός αριθμού αιτήσεων για δεύτερη περίοδο
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.second_period'
,
1
,
'='
);
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων B' περιόδου"
,
'numStudents'
=>
$numApplications
));
//υπολογισμός αριθμού χρηστών
$sCon
=
$this
->
connection
->
select
(
'epal_users'
,
'eUser'
)
->
fields
(
'eUser'
,
array
(
'id'
));
$numUsers
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Εγγεγραμένων Χρηστών με ρόλο Αιτούντα"
,
'numStudents'
=>
$numUsers
));
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
//end try
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"An unexpected problem occured during report"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
}
}
public
function
makegGeneralReport
(
Request
$request
)
{
try
{
if
(
!
$request
->
isMethod
(
'GET'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
//user validation
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
public
function
makeGeneralReport
(
Request
$request
)
{
//user role validation
$roles
=
$user
->
getRoles
();
$validRole
=
false
;
foreach
(
$roles
as
$role
)
if
(
$role
===
"ministry"
)
{
$validRole
=
true
;
break
;
}
if
(
!
$validRole
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//υπολογισμός αριθμού δηλώσεων
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
));
$numTotal
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
//υπολογισμός αριθμού δηλώσεων που ικανοποιήθηκαν στην i προτίμηση
$numData
=
array
();
for
(
$i
=
0
;
$i
<
3
;
$i
++
)
{
$sCon
=
$this
->
connection
->
select
(
'epal_student_class'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
,
'distribution_id'
))
->
condition
(
'eStudent.distribution_id'
,
$i
+
1
,
'='
)
->
condition
(
'eStudent.finalized'
,
1
,
'='
);
array_push
(
$numData
,
$sCon
->
countQuery
()
->
execute
()
->
fetchField
());
}
// υπολογισμός αριθμού δηλώσεων που ΔΕΝ ικανοποιήθηκαν
//Σημείωση: υπολογισμός με queries στη βάση
$sCon
=
$this
->
connection
->
select
(
'epal_student_class'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'student_id'
));
$epalStudents
=
$sCon
->
execute
()
->
fetchAll
(
\
PDO
::
FETCH_OBJ
);
$studentIds
=
array
();
foreach
(
$epalStudents
as
$epalStudent
)
array_push
(
$studentIds
,
$epalStudent
->
student_id
);
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.id'
,
$studentIds
,
'NOT IN'
);
$numNoAllocated
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
//υπολογισμός αριθμού δηλώσεων που τοποθετήθηκαν προσωρινά σε ολιγομελή τμήματα
$numInSmallClasses
=
0
;
$sCon
=
$this
->
connection
->
select
(
'epal_student_class'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.finalized'
,
0
,
'='
);
$numInSmallClasses
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
$list
=
array
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Δηλώσεων Προτίμησης"
,
'numStudents'
=>
$numTotal
));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν στην πρώτη τους προτίμηση"
,
'numStudents'
=>
$numData
[
0
]));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν στην δεύτερή τους προτίμηση"
,
'numStudents'
=>
$numData
[
1
]));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν στην τρίτη τους προτίμηση"
,
'numStudents'
=>
$numData
[
2
]));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός μαθητών που δεν τοποθετήθηκαν σε καμμία τους προτίμηση"
,
'numStudents'
=>
$numNoAllocated
));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν προσωρινά σε ολιγομελή τμήματα"
,
'numStudents'
=>
$numInSmallClasses
));
try
{
if
(
!
$request
->
isMethod
(
'GET'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
//end try
//user validation
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
//user role validation
$roles
=
$user
->
getRoles
();
$validRole
=
false
;
foreach
(
$roles
as
$role
)
if
(
$role
===
"ministry"
)
{
$validRole
=
true
;
break
;
}
if
(
!
$validRole
)
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"An unexpected problem occured during makegGeneralReport Method"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//υπολογισμός αριθμού δηλώσεων
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
));
$numTotal
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
//υπολογισμός αριθμού δηλώσεων που ικανοποιήθηκαν στην i προτίμηση
$numData
=
array
();
for
(
$i
=
0
;
$i
<
3
;
$i
++
)
{
$sCon
=
$this
->
connection
->
select
(
'epal_student_class'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
,
'distribution_id'
))
->
condition
(
'eStudent.distribution_id'
,
$i
+
1
,
'='
)
->
condition
(
'eStudent.finalized'
,
1
,
'='
);
array_push
(
$numData
,
$sCon
->
countQuery
()
->
execute
()
->
fetchField
());
}
// υπολογισμός αριθμού δηλώσεων που ΔΕΝ ικανοποιήθηκαν
/*
$sCon = $this->connection
->select('epal_student_class', 'eStudent')
->fields('eStudent', array('student_id'));
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$studentIds = array();
foreach ($epalStudents as $epalStudent)
array_push($studentIds, $epalStudent->student_id);
$sCon = $this->connection
->select('epal_student', 'eStudent')
->fields('eStudent', array('id'))
->condition('eStudent.id', $studentIds, 'NOT IN');
$numNoAllocated = $sCon->countQuery()->execute()->fetchField();
*/
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'epalStudent'
);
$sCon
->
leftJoin
(
'epal_student_class'
,
'eStudent'
,
'eStudent.student_id = epalStudent.id'
);
$sCon
->
fields
(
'eStudent'
,
array
(
'student_id'
))
->
fields
(
'epalStudent'
,
array
(
'id'
))
->
isNull
(
'eStudent.student_id'
);
$numNoAllocated
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
//υπολογισμός αριθμού δηλώσεων που τοποθετήθηκαν προσωρινά σε ολιγομελή τμήματα
$numInSmallClasses
=
0
;
$sCon
=
$this
->
connection
->
select
(
'epal_student_class'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.finalized'
,
0
,
'='
);
$numInSmallClasses
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
$list
=
array
(
array
(
'name'
=>
"Αριθμός Δηλώσεων Προτίμησης"
,
'numStudents'
=>
$numTotal
),
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν στην πρώτη τους προτίμηση"
,
'numStudents'
=>
$numData
[
0
]),
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν στην δεύτερή τους προτίμηση"
,
'numStudents'
=>
$numData
[
1
]),
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν στην τρίτη τους προτίμηση"
,
'numStudents'
=>
$numData
[
2
]),
array
(
'name'
=>
"Αριθμός μαθητών που δεν τοποθετήθηκαν σε καμμία τους προτίμηση"
,
'numStudents'
=>
$numNoAllocated
),
array
(
'name'
=>
"Αριθμός μαθητών που τοποθετήθηκαν προσωρινά σε ολιγομελή τμήματα"
,
'numStudents'
=>
$numInSmallClasses
)
);
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
//end try
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"An unexpected problem occured during report"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
}
}
public
function
makeReportCompleteness
(
Request
$request
,
$regionId
,
$adminId
,
$schId
)
{
...
...
@@ -1048,14 +1057,9 @@ class ReportsCreator extends ControllerBase {
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
return
$res
;
}
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
return
$res
;
}
}
source/components/minister/minister-reports.ts
View file @
1585bcda
import
{
Component
,
OnInit
,
OnDestroy
}
from
"
@angular/core
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
AppSettings
}
from
"
../../app.settings
"
;
import
{
HelperDataService
}
from
"
../../services/helper-data-service
"
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
LOGININFO_INITIAL_STATE
}
from
'
../../store/logininfo/logininfo.initial-state
'
;
import
{
MINISTRY_ROLE
,
PDE_ROLE
,
DIDE_ROLE
}
from
'
../../constants
'
;
import
{
Http
,
Headers
,
RequestOptions
}
from
"
@angular/http
"
;
import
{
NgRedux
,
select
}
from
"
ng2-redux
"
;
import
{
IAppState
}
from
"
../../store/store
"
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
"
@angular/router
"
;
import
{
BehaviorSubject
,
Subscription
}
from
"
rxjs/Rx
"
;
import
{
ILoginInfo
}
from
"
../../store/logininfo/logininfo.types
"
;
import
{
LOGININFO_INITIAL_STATE
}
from
"
../../store/logininfo/logininfo.initial-state
"
;
import
{
MINISTRY_ROLE
,
PDE_ROLE
,
DIDE_ROLE
}
from
"
../../constants
"
;
import
{
FormBuilder
,
...
...
@@ -18,13 +18,13 @@ import {
FormControl
,
FormArray
,
Validators
,
}
from
'
@angular/forms
'
;
}
from
"
@angular/forms
"
;
import
{
API_ENDPOINT
}
from
'
../../app.settings
'
;
import
{
API_ENDPOINT
}
from
"
../../app.settings
"
;
@
Component
({
selector
:
'
minister-reports
'
,
//encapsulation: ViewEncapsulation.None,
selector
:
"
minister-reports
"
,
//
encapsulation: ViewEncapsulation.None,
template
:
`
...
...
@@ -35,34 +35,6 @@ import { API_ENDPOINT } from '../../app.settings';
<div class="col-md-1">
<!--
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(1)" [hidden]="minedu_userName == '' || userRole == 'pde' || userRole == 'dide'" >
<i class="fa fa-file-text"></i>
Κατανομή Μαθητών με Βάση τη Σειρά Προτίμησης
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(2)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Συνολική Πληρότητα σχολικών μονάδων ΕΠΑΛ ανά τάξη
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(3)" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Αριθμός Μαθητών και Πληρότητα σχολικών μονάδων ΕΠΑΛ
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(4)" [hidden]="minedu_userName == '' || userRole == 'pde' || userRole == 'dide' " >
<i class="fa fa-file-text"></i>
Σχολικές μονάδες που δεν έχουν δηλώσει Χωρητικότητα τμημάτων
</button>
<br><br>
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(5)" [hidden]="minedu_userName == '' || userRole == 'pde' || userRole == 'dide' " >
<i class="fa fa-file-text"></i>
Ολιγομελή τμήματα (Προσωρινά τοποθετημένοι μαθητές)
</button>
<br><br>
</div>
-->
<div *ngIf = "minedu_userName != '' && userRole != 'pde' && userRole != 'dide'">
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(0)" >
<i class="fa fa-file-text"></i>
...
...
@@ -131,13 +103,13 @@ import { API_ENDPOINT } from '../../app.settings';
private
router
:
Router
)
{
this
.
formGroup
=
this
.
fb
.
group
({
region
:
[
''
,
[]],
adminarea
:
[
''
,
[]],
schoollist
:
[
''
,
[]],
region
:
[
""
,
[]],
adminarea
:
[
""
,
[]],
schoollist
:
[
""
,
[]],
});
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
this
.
minedu_userName
=
''
;
this
.
minedu_userName
=
""
;
this
.
userRole
=
MINISTRY_ROLE
;
}
...
...
@@ -149,7 +121,7 @@ import { API_ENDPOINT } from '../../app.settings';
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
minedu_userName
=
loginInfoToken
.
minedu_username
;
this
.
minedu_userPassword
=
loginInfoToken
.
minedu_userpassword
;
if
(
loginInfoToken
.
auth_role
==
PDE_ROLE
||
loginInfoToken
.
auth_role
==
DIDE_ROLE
)
{
if
(
loginInfoToken
.
auth_role
==
=
PDE_ROLE
||
loginInfoToken
.
auth_role
=
==
DIDE_ROLE
)
{
this
.
userRole
=
loginInfoToken
.
auth_role
;
this
.
minedu_userName
=
loginInfoToken
.
auth_token
;
this
.
minedu_userPassword
=
loginInfoToken
.
auth_token
;
...
...
@@ -163,25 +135,24 @@ import { API_ENDPOINT } from '../../app.settings';
}
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
if
(
this
.
loginInfoSub
)
{
this
.
loginInfoSub
.
unsubscribe
();
if
(
this
.
loginInfo$
)
}
if
(
this
.
loginInfo$
)
{
this
.
loginInfo$
.
unsubscribe
();
}
}
nav_to_reportpath
(
repId
)
{
if
(
repId
==
0
)
this
.
router
.
navigate
([
'
/ministry/report-users
'
,
repId
]);
if
(
repId
==
1
)
this
.
router
.
navigate
([
'
/ministry/report-general
'
,
repId
]);
else
if
(
repId
==
2
||
repId
==
3
||
repId
==
5
)
this
.
router
.
navigate
([
'
/ministry/report-all-stat
'
,
repId
]);
else
if
(
repId
==
4
)
this
.
router
.
navigate
([
'
/ministry/report-no-capacity
'
,
repId
]);
if
(
repId
===
0
)
{
this
.
router
.
navigate
([
"
/ministry/report-users
"
,
repId
]);
}
else
if
(
repId
===
1
)
{
this
.
router
.
navigate
([
"
/ministry/report-general
"
]);
}
else
if
(
repId
===
2
||
repId
===
3
||
repId
===
5
)
{
this
.
router
.
navigate
([
"
/ministry/report-all-stat
"
,
repId
]);
}
else
if
(
repId
===
4
)
{
this
.
router
.
navigate
([
"
/ministry/report-no-capacity
"
,
repId
]);
}
}
}
source/components/minister/report-general.ts
View file @
1585bcda
import
{
Component
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
,
Input
}
from
"
@angular/core
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
Ng2SmartTableModule
,
LocalDataSource
}
from
'
ng2-smart-table
'
;
import
{
reportsSchema
,
TableColumn
}
from
'
./reports-schema
'
;
import
{
LOGININFO_INITIAL_STATE
}
from
'
../../store/logininfo/logininfo.initial-state
'
;
import
{
csvCreator
}
from
'
./csv-creator
'
;
import
{
chartCreator
}
from
'
./chart-creator
'
;
import
{
AppSettings
}
from
"
../../app.settings
"
;
import
{
HelperDataService
}
from
"
../../services/helper-data-service
"
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
"
@angular/http
"
;
import
{
NgRedux
,
select
}
from
"
ng2-redux
"
;
import
{
IAppState
}
from
"
../../store/store
"
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
"
@angular/router
"
;
import
{
BehaviorSubject
,
Subscription
}
from
"
rxjs/Rx
"
;
import
{
ILoginInfo
}
from
"
../../store/logininfo/logininfo.types
"
;
import
{
Ng2SmartTableModule
,
LocalDataSource
}
from
"
ng2-smart-table
"
;
import
{
reportsSchema
,
TableColumn
}
from
"
./reports-schema
"
;
import
{
LOGININFO_INITIAL_STATE
}
from
"
../../store/logininfo/logininfo.initial-state
"
;
import
{
csvCreator
}
from
"
./csv-creator
"
;
import
{
chartCreator
}
from
"
./chart-creator
"
;
import
{
FormBuilder
,
...
...
@@ -21,13 +21,12 @@ import {
FormControl
,
FormArray
,
Validators
,
}
from
'
@angular/forms
'
;
}
from
"
@angular/forms
"
;
import
{
API_ENDPOINT
}
from
'
../../app.settings
'
;
import
{
API_ENDPOINT
}
from
"
../../app.settings
"
;
@
Component
({
selector
:
'
report-general
'
,
selector
:
"
report-general
"
,
template
:
`
<div>
...
...
@@ -40,7 +39,7 @@ import { API_ENDPOINT } from '../../app.settings';
<h5> >Επιλογή Φίλτρων <br><br></h5>
<h6> Δεν υπάρχουν διαθέσιμα φίλτρα <br><br><br></h6>
<button type="submit" class="btn btn-alert" (click)="createReport(
regsel
)" [hidden]="minedu_userName == ''" >
<button type="submit" class="btn btn-alert" (click)="createReport()" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Δημιουργία Αναφοράς
</button>
...
...
@@ -89,8 +88,6 @@ import { API_ENDPOINT } from '../../app.settings';
private
data
;
private
validCreator
:
number
;
private
createGraph
:
boolean
;
private
reportId
:
number
;
private
routerSub
:
any
;
private
source
:
LocalDataSource
;
columnMap
:
Map
<
string
,
TableColumn
>
=
new
Map
<
string
,
TableColumn
>
();
...
...
@@ -99,7 +96,7 @@ import { API_ENDPOINT } from '../../app.settings';
private
csvObj
=
new
csvCreator
();
private
chartObj
=
new
chartCreator
();
@
ViewChild
(
'
chart
'
)
public
chartContainer
:
ElementRef
;
@
ViewChild
(
"
chart
"
)
public
chartContainer
:
ElementRef
;
private
d3data
:
Array
<
any
>
;
...
...
@@ -110,14 +107,14 @@ import { API_ENDPOINT } from '../../app.settings';
private
router
:
Router
)
{
this
.
formGroup
=
this
.
fb
.
group
({
region
:
[
''
,
[]],
adminarea
:
[
''
,
[]],
schoollist
:
[
''
,
[]],
region
:
[
""
,
[]],
adminarea
:
[
""
,
[]],
schoollist
:
[
""
,
[]],