Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
daf7e47f
Commit
daf7e47f
authored
Jun 12, 2017
by
Χάρης Παπαδόπουλος
Browse files
Merge branch 'component_updates' into 'develop'
Component updates See merge request !154
parents
60323e33
245bf2d6
Changes
13
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/epal.routing.yml
View file @
daf7e47f
...
...
@@ -134,6 +134,14 @@ epal.ministry.log_out_go:
_controller
:
'
\Drupal\epal\Controller\MinistryLogin::logoutGo'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.report_users
:
path
:
'
/ministry/report-users'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::makeReportUsers'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.general_report
:
path
:
'
/ministry/general-report'
options
:
...
...
@@ -207,7 +215,7 @@ epal.ministry.retrievesettings:
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.storesettings
:
path
:
'
/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}/{applicantsResultsDisabled}'
path
:
'
/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}/{applicantsResultsDisabled}
/{secondPeriodEnabled}
'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
...
...
drupal/modules/epal/src/Controller/ApplicationSubmit.php
View file @
daf7e47f
...
...
@@ -131,6 +131,7 @@ class ApplicationSubmit extends ControllerBase
],
Response
::
HTTP_FORBIDDEN
);
}
$second_period
=
$this
->
retrievePeriod
();
$student
=
array
(
'langcode'
=>
'el'
,
...
...
@@ -170,7 +171,9 @@ class ApplicationSubmit extends ControllerBase
'guardian_mothername'
=>
$guardian_mothername_encoded
,
'agreement'
=>
$applicationForm
[
0
][
'disclaimer_checked'
],
'relationtostudent'
=>
$relationtostudent_encoded
,
'telnum'
=>
$telnum_encoded
'telnum'
=>
$telnum_encoded
,
'second_period'
=>
$second_period
,
);
if
((
$errorCode
=
$this
->
validateStudent
(
$student
))
>
0
)
{
...
...
@@ -253,12 +256,28 @@ class ApplicationSubmit extends ControllerBase
return
$res
;
}
private
function
retrievePeriod
()
{
$config_storage
=
$this
->
entityTypeManager
->
getStorage
(
'epal_config'
);
$epalConfigs
=
$config_storage
->
loadByProperties
(
array
(
'name'
=>
'epal_config'
));
$epalConfig
=
reset
(
$epalConfigs
);
if
(
!
$epalConfig
)
return
0
;
else
$secondPeriodEnabled
=
$epalConfig
->
activate_second_period
->
getString
();
return
$secondPeriodEnabled
;
}
/**
*
* @return int error code ελέγχου; 0 εάν ο έλεγχος επιτύχει, μη μηδενικό εάν αποτύχει:
* 1001 δεν επιλέχθηκε το πλαίσιο συμφωνης γνώμης
* 1002 λανθασμένο τελευταίο έτος φοίτησης
* 1003 λανθασμένη ημερομηνία
* 1004-> 1023: λανθασμένα πεδία αίτησης
* 8000 μη αναμενόμενο λάθος
* 8001 δικτυακό λάθος κλήσης υπηρεσίας επιβεβαίωσης στοιχείων
* 8002 τα στοιχεία φοίτησης δεν επικυρώθηκαν
...
...
@@ -281,6 +300,67 @@ class ApplicationSubmit extends ControllerBase
}
$birthdate
=
"
{
$date_parts
[
2
]
}
-
{
$date_parts
[
1
]
}
-
{
$date_parts
[
0
]
}
"
;
if
(
!
$student
[
"name"
])
{
return
1004
;
}
if
(
!
$student
[
"studentsurname"
])
{
return
1005
;
}
if
(
!
$student
[
"fatherfirstname"
])
{
return
1006
;
}
if
(
!
$student
[
"motherfirstname"
])
{
return
1007
;
}
if
(
!
$student
[
"regionaddress"
])
{
return
1008
;
}
if
(
!
$student
[
"regiontk"
])
{
return
1009
;
}
if
(
!
$student
[
"regionarea"
])
{
return
1010
;
}
if
(
!
$student
[
"certificatetype"
])
{
return
1011
;
}
if
(
!
$student
[
"graduation_year"
])
{
return
1012
;
}
if
(
!
$student
[
"currentclass"
]
||
(
$student
[
"currentclass"
]
!==
"1"
&&
$student
[
"currentclass"
]
!==
"2"
&&
$student
[
"currentclass"
]
!==
"3"
&&
$student
[
"currentclass"
]
!==
"4"
)
)
{
return
1013
;
}
if
(
!
$student
[
"relationtostudent"
])
{
return
1014
;
}
if
(
!
$student
[
"telnum"
])
{
return
1015
;
}
if
(
!
$student
[
"guardian_name"
])
{
return
1016
;
}
if
(
!
$student
[
"guardian_surname"
])
{
return
1017
;
}
if
(
!
$student
[
"guardian_fathername"
])
{
return
1018
;
}
if
(
!
$student
[
"guardian_mothername"
])
{
return
1019
;
}
if
(
!
$student
[
"lastschool_registrynumber"
])
{
return
1020
;
}
if
(
!
$student
[
"lastschool_unittypeid"
])
{
return
1021
;
}
if
(
!
$student
[
"lastschool_schoolname"
])
{
return
1022
;
}
if
(
!
$student
[
"lastschool_class"
])
{
return
1023
;
}
// check as per specs:
// - can't check certification prior to 2014, pass through
// - check certification if last passed class is gym
...
...
drupal/modules/epal/src/Controller/MinisterSettings.php
View file @
daf7e47f
...
...
@@ -99,6 +99,7 @@ class MinisterSettings extends ControllerBase {
$directorViewDisabled
=
$epalConfig
->
lock_school_students_view
->
getString
();
$applicantsLoginDisabled
=
$epalConfig
->
lock_application
->
getString
();
$applicantsResultsDisabled
=
$epalConfig
->
lock_results
->
getString
();
$secondPeriodEnabled
=
$epalConfig
->
activate_second_period
->
getString
();
}
$config_storage
->
resetCache
();
...
...
@@ -109,6 +110,7 @@ class MinisterSettings extends ControllerBase {
'directorViewDisabled'
=>
$directorViewDisabled
,
'applicantsLoginDisabled'
=>
$applicantsLoginDisabled
,
'applicantsResultsDisabled'
=>
$applicantsResultsDisabled
,
'secondPeriodEnabled'
=>
$secondPeriodEnabled
,
],
Response
::
HTTP_OK
);
}
//end try
...
...
@@ -125,7 +127,7 @@ class MinisterSettings extends ControllerBase {
}
public
function
storeSettings
(
Request
$request
,
$capacityDisabled
,
$directorViewDisabled
,
$applicantsLoginDisabled
,
$applicantsResultsDisabled
)
{
public
function
storeSettings
(
Request
$request
,
$capacityDisabled
,
$directorViewDisabled
,
$applicantsLoginDisabled
,
$applicantsResultsDisabled
,
$secondPeriodEnabled
)
{
try
{
if
(
!
$request
->
isMethod
(
'GET'
))
{
...
...
@@ -171,6 +173,8 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
$epalConfig
->
set
(
'lock_school_students_view'
,
$directorViewDisabled
);
$epalConfig
->
set
(
'lock_application'
,
$applicantsLoginDisabled
);
$epalConfig
->
set
(
'lock_results'
,
$applicantsResultsDisabled
);
$epalConfig
->
set
(
'activate_second_period'
,
$secondPeriodEnabled
);
$epalConfig
->
save
();
}
$config_storage
->
resetCache
();
...
...
@@ -182,6 +186,7 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
'directorViewDisabled'
=>
$directorViewDisabled
,
'applicantsLoginDisabled'
=>
$applicantsLoginDisabled
,
'applicantsResultsDisabled'
=>
$applicantsResultsDisabled
,
'secondPeriodEnabled'
=>
$secondPeriodEnabled
,
],
Response
::
HTTP_OK
);
}
//end try
...
...
@@ -198,8 +203,6 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
...
...
drupal/modules/epal/src/Controller/PdfCreator.php
View file @
daf7e47f
...
...
@@ -75,18 +75,34 @@ class PDFCreator extends ControllerBase {
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
/*
return $this->respondWithStatus([
'message' => t("User:") . $authToken,
], Response::HTTP_FORBIDDEN);
*/
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//test
/*
return $this->respondWithStatus([
'message' => t("User:") . $authToken,
], Response::HTTP_FORBIDDEN);
*/
//New epal-user validation
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
id
();
$epalStudents
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'epaluser_id'
=>
$userid
));
if
(
!
$epalStudents
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"EPAL User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
//end New User validation
//user role validation
$roles
=
$user
->
getRoles
();
...
...
@@ -531,9 +547,8 @@ private function createSchoolChoices($student) {
$this
->
pdf
->
Cell
(
$width
,
$height
,
$this
->
prepareString
(
'Σειρά προτίμησης'
),
0
,
0
,
'L'
);
$this
->
pdf
->
multiCell
(
$width
,
$height
,
$this
->
prepareString
(
'ΕΠΑΛ επιλογής'
),
0
,
'L'
);
//$this->pdf->Ln();
//$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
/*
$epalSchools = $this->entityTypeManager->getStorage('epal_student_epal_chosen')->loadByProperties(array('student_id'=> $student->id->value));
foreach ($epalSchools as $epalSchool) {
...
...
@@ -545,26 +560,21 @@ private function createSchoolChoices($student) {
$this->pdf->Cell($width, $height, $this->prepareString($epalSchool->choice_no->value), 0, 0, 'C');
$this->pdf->multiCell(4*width, $height, $this->prepareString($epalSchoolName->name->value), 0, 'L');
//$this->pdf->Ln();
}
*/
for
(
$i
=
0
;
$i
<
3
;
$i
++
)
{
$epalSchools
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_epal_chosen'
)
->
loadByProperties
(
array
(
'student_id'
=>
$student
->
id
->
value
,
'choice_no'
=>
$i
+
1
));
if
(
$epalSchools
)
{
$epalSchool
=
reset
(
$epalSchools
);
$epalSchoolNames
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$epalSchool
->
epal_id
->
getString
()));
$epalSchoolName
=
reset
(
$epalSchoolNames
);
//....
/*
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα μαθητή:'), 0, 'L');
$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->name->value), 0, 'L');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->SetXY($x+$width,$y);
$this->pdf->Cell($width, $height, $this->prepareString('Επώνυμο μαθητή:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->studentsurname->value), 0, 'L');
*/
$this
->
pdf
->
SetFont
(
$this
->
fontBold
,
''
,
$this
->
fontSizeRegular
);
$this
->
pdf
->
Cell
(
$width
,
$height
,
$this
->
prepareString
(
$epalSchool
->
choice_no
->
value
),
0
,
0
,
'C'
);
$this
->
pdf
->
multiCell
(
4
*
width
,
$height
,
$this
->
prepareString
(
$epalSchoolName
->
name
->
value
),
0
,
'L'
);
}
}
}
...
...
drupal/modules/epal/src/Controller/ReportsCreator.php
View file @
daf7e47f
...
...
@@ -61,6 +61,71 @@ 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
);
}
//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
);
}
//υπολογισμός αριθμού δηλώσεων
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
));
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
//υπολογισμός αριθμού χρηστών
$sCon
=
$this
->
connection
->
select
(
'epal_users'
,
'eUser'
)
->
fields
(
'eUser'
,
array
(
'id'
));
$numUsers
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
$list
=
array
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων"
,
'numStudents'
=>
$numApplications
));
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
);
}
}
public
function
makegGeneralReport
(
Request
$request
)
{
try
{
...
...
drupal/modules/epal/src/Entity/EpalConfig.php
View file @
daf7e47f
...
...
@@ -280,6 +280,26 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->
setDisplayConfigurable
(
'form'
,
TRUE
)
->
setDisplayConfigurable
(
'view'
,
TRUE
);
$fields
[
'activate_second_period'
]
=
BaseFieldDefinition
::
create
(
'boolean'
)
->
setLabel
(
t
(
'Activate second periods of applications'
))
->
setDescription
(
t
(
'Activate second periods of applications.'
))
->
setSettings
(
array
(
'text_processing'
=>
0
,
))
->
setRequired
(
FALSE
)
->
setDefaultValue
(
FALSE
)
->
setDisplayOptions
(
'view'
,
array
(
'label'
=>
'above'
,
'type'
=>
'boolean'
,
'weight'
=>
-
4
,
))
->
setDisplayOptions
(
'form'
,
array
(
'type'
=>
'boolean'
,
'weight'
=>
-
4
,
))
->
setDisplayConfigurable
(
'form'
,
TRUE
)
->
setDisplayConfigurable
(
'view'
,
TRUE
);
$fields
[
'status'
]
=
BaseFieldDefinition
::
create
(
'boolean'
)
->
setLabel
(
t
(
'Publishing status'
))
->
setDescription
(
t
(
'A boolean indicating whether the Epal config is published.'
))
...
...
source/components/minister/minister-reports.ts
View file @
daf7e47f
...
...
@@ -61,6 +61,13 @@ import { API_ENDPOINT } from '../../app.settings';
<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>
Αριθμός Αιτήσεων / Εγγεγραμμένων Χρηστών
</button>
<br><br>
</div>
<div *ngIf = "minedu_userName != '' && userRole != 'pde' && userRole != 'dide'">
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(1)" >
...
...
@@ -167,6 +174,8 @@ import { API_ENDPOINT } from '../../app.settings';
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
)
...
...
source/components/minister/minister-settings.ts
View file @
daf7e47f
...
...
@@ -96,6 +96,17 @@ import {
</div>
<br>
<div class="row">
<div class="col-md-1 ">
<input type="checkbox" [checked]="secondPeriodEnabled" formControlName="secondPeriodEnabled"
(click)="toggleSecondPeriod()" >
</div>
<div class="col-md-9">
<label for="secondPeriodEnabled">Ενεργοποίηση δεύτερης περιόδου αιτήσεων </label>
</div>
</div>
<br>
<button type="submit" class="btn btn-md pull-right" (click)="storeSettings()" >
Εφαρμογή
</button>
...
...
@@ -122,6 +133,7 @@ import {
private
directorViewDisabled
:
boolean
;
private
applicantsLoginDisabled
:
boolean
;
private
applicantsResultsDisabled
:
boolean
;
private
secondPeriodEnabled
:
boolean
;
private
dataRetrieved
:
number
;
private
minedu_userName
:
string
;
...
...
@@ -137,6 +149,7 @@ import {
directorViewDisabled
:
[
''
,
[]],
applicantsLoginDisabled
:
[
''
,
[]],
applicantsResultsDisabled
:
[
''
,
[]],
secondPeriodEnabled
:
[
''
,
[]],
});
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
...
...
@@ -214,6 +227,7 @@ import {
this
.
directorViewDisabled
=
Boolean
(
Number
(
this
.
settings$
.
value
[
'
directorViewDisabled
'
]));
this
.
applicantsLoginDisabled
=
Boolean
(
Number
(
this
.
settings$
.
value
[
'
applicantsLoginDisabled
'
]));
this
.
applicantsResultsDisabled
=
Boolean
(
Number
(
this
.
settings$
.
value
[
'
applicantsResultsDisabled
'
]));
this
.
secondPeriodEnabled
=
Boolean
(
Number
(
this
.
settings$
.
value
[
'
secondPeriodEnabled
'
]));
this
.
dataRetrieved
=
1
;
}
...
...
@@ -226,7 +240,7 @@ import {
this
.
dataRetrieved
=
-
1
;
this
.
settingsSub
=
this
.
_hds
.
storeAdminSettings
(
this
.
minedu_userName
,
this
.
minedu_userPassword
,
this
.
capacityDisabled
,
this
.
directorViewDisabled
,
this
.
applicantsLoginDisabled
,
this
.
applicantsResultsDisabled
)
this
.
capacityDisabled
,
this
.
directorViewDisabled
,
this
.
applicantsLoginDisabled
,
this
.
applicantsResultsDisabled
,
this
.
secondPeriodEnabled
)
.
subscribe
(
data
=>
{
this
.
settings$
.
next
(
data
);
//this.data = data;
...
...
@@ -282,6 +296,12 @@ import {
}
toggleSecondPeriod
()
{
this
.
secondPeriodEnabled
=
!
this
.
secondPeriodEnabled
;
}
...
...
source/components/minister/report-users.ts
0 → 100644
View file @
daf7e47f
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
{
API_ENDPOINT
}
from
'
../../app.settings
'
;
@
Component
({
selector
:
'
report-users
'
,
template
:
`
<div>
<div
class = "loading" *ngIf="validCreator == 0" >
</div>
<h5> >Επιλογή Φίλτρων <br><br></h5>
<h6> Δεν υπάρχουν διαθέσιμα φίλτρα <br><br><br></h6>
<button type="submit" class="btn btn-alert" (click)="createReport()" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Δημιουργία Αναφοράς
</button>
<button type="submit" class="btn btn-alert pull-right" (click)="navigateBack()" [hidden]="minedu_userName == ''" >
Επιστροφή
</button>
<br><br>
<div *ngIf="validCreator == 1 ">
<input #search class="search" type="text" placeholder="Αναζήτηση..." (keydown.enter)="onSearch(search.value)">
<div class="smart-table-container" reportScroll>
<ng2-smart-table [settings]="settings" [source]="source"></ng2-smart-table>
</div>
</div>
<button type="button" class="alert alert-info pull-right" (click)="export2Csv()" [hidden]="validCreator != 1">
<i class="fa fa-download"></i>
<br>Εξαγωγή σε csv
</button>
</div>
`
})
@
Injectable
()
export
default
class
ReportUsers
implements
OnInit
,
OnDestroy
{
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
loginInfoSub
:
Subscription
;
private
generalReport$
:
BehaviorSubject
<
any
>
;
private
generalReportSub
:
Subscription
;
private
apiEndPoint
=
API_ENDPOINT
;
private
minedu_userName
:
string
;
private
minedu_userPassword
:
string
;
private
distStatus
=
"
READY
"
;
private
data
;
private
validCreator
:
number
;
//private reportId: number;
private
routerSub
:
any
;
private
source
:
LocalDataSource
;
columnMap
:
Map
<
string
,
TableColumn
>
=
new
Map
<
string
,
TableColumn
>
();
@
Input
()
settings
:
any
;
private
reportSchema
=
new
reportsSchema
();
private
csvObj
=
new
csvCreator
();
constructor
(
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
_hds
:
HelperDataService
,
private
activatedRoute
:
ActivatedRoute
,
private
router
:
Router
)
{
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
this
.
generalReport$
=
new
BehaviorSubject
([{}]);
this
.
minedu_userName
=
''
;
this
.
validCreator
=
-
1
;
}
ngOnInit
()
{
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
minedu_userName
=
loginInfoToken
.
minedu_username
;
this
.
minedu_userPassword
=
loginInfoToken
.
minedu_userpassword
;
return
loginInfoToken
;
},
{});
}
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
//this.routerSub = this.activatedRoute.params.subscribe(params => {
//this.reportId = +params['reportId'];
//});
}
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
if
(
this
.
generalReportSub
)
this
.
generalReportSub
.
unsubscribe
();
if
(
this
.
loginInfo$
)
this
.
loginInfo$
.
unsubscribe
();
if
(
this
.
generalReport$
)
this
.
generalReport$
.
unsubscribe
();
}
createReport
()
{
this
.
validCreator
=
0
;
let
route
;
//if (this.reportId === 0) {
route
=
"
/ministry/report-users/
"
;
this
.
settings
=
this
.
reportSchema
.
ReportUsersSchema
;
//}