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
fe7a8d64
Commit
fe7a8d64
authored
Apr 25, 2017
by
Νίκος Κατσαούνος
Browse files
added ministerView component, added ministerReports component
parent
52fe44e2
Changes
8
Hide whitespace changes
Inline
Side-by-side
source/app.settings.ts
View file @
fe7a8d64
export
const
API_ENDPOINT
=
'
http://eduslim2.minedu.gov.gr/drupal
'
;
export
const
API_ENDPOINT
=
'
http://eduslim2.minedu.gov.gr/drupal
-8.2.6
'
;
// export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
// export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
export
class
AppSettings
{
export
class
AppSettings
{
public
static
get
API_ENDPOINT
():
string
{
public
static
get
API_ENDPOINT
():
string
{
return
'
http://eduslim2.minedu.gov.gr/drupal
'
;
return
'
http://eduslim2.minedu.gov.gr/drupal
-8.2.6
'
;
// return 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
// return 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
}
}
}
}
source/components/minister/minister-reports.ts
0 → 100644
View file @
fe7a8d64
import
{
Component
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
}
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
{
LOGININFO_INITIAL_STATE
}
from
'
../../store/logininfo/logininfo.initial-state
'
;
import
{
FormBuilder
,
FormGroup
,
FormControl
,
FormArray
,
Validators
,
}
from
'
@angular/forms
'
;
import
{
API_ENDPOINT
}
from
'
../../app.settings
'
;
@
Component
({
selector
:
'
minister-reports
'
,
template
:
`
<div>
<form [formGroup]="formGroup" #form>
<!--<button type="submit" class="btn-primary btn-md" (click)="form.submit()" >-->
<button type="submit" class="btn btn-default btn-block" (click)="reportGeneral()" >
Συγκεντρωτικά Αποτελέσματα Κατανομής
</button>
<div *ngFor="let generalReports$ of generalReport$ | async; let i=index">
<div *ngIf="showMessage">
<br>
Αριθμός Αιτήσεων: {{generalReports$.num_applications}}<br>
Αριθμός μαθητών που τοποθετήθηκαν στην πρώτη τους προτίμηση: {{generalReports$.numchoice1}}<br>
Αριθμός μαθητών που τοποθετήθηκαν στη δεύτερή τους προτίμηση: {{generalReports$.numchoice2}}<br>
Αριθμός μαθητών που τοποθετήθηκαν στην τρίτη τους προτίμηση: {{generalReports$.numchoice3}}<br>
Αριθμός μαθητών που δεν τοποθετήθηκαν σε καμμία τους προτίμηση: {{generalReports$.num_noallocated}}<br>
</div>
</div>
</form>
</div>
`
})
@
Injectable
()
export
default
class
MinisterReports
implements
OnInit
,
OnDestroy
{
public
formGroup
:
FormGroup
;
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
:
string
;
private
showMessage
:
boolean
;
constructor
(
private
fb
:
FormBuilder
,
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
_hds
:
HelperDataService
,
private
activatedRoute
:
ActivatedRoute
,
private
router
:
Router
)
{
this
.
formGroup
=
this
.
fb
.
group
({
});
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
this
.
generalReport$
=
new
BehaviorSubject
([{}]);
this
.
showMessage
=
false
;
}
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
this
.
loginInfo$
.
unsubscribe
();
if
(
this
.
generalReportSub
)
this
.
generalReportSub
.
unsubscribe
();
this
.
generalReport$
.
unsubscribe
();
}
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$
);
}
reportGeneral
()
{
this
.
generalReportSub
=
this
.
_hds
.
makeGeneralReport
(
this
.
minedu_userName
,
this
.
minedu_userPassword
).
subscribe
(
data
=>
{
this
.
generalReport$
.
next
(
data
);
this
.
data
=
data
;
},
error
=>
{
this
.
generalReport$
.
next
([{}]);
console
.
log
(
"
Error Getting generalReport
"
);
},
()
=>
{
console
.
log
(
"
Getting generalReport
"
);
/*this.numChoice1 = this.data['numchoice1'];
console.log(this.numChoice1);*/
this
.
showMessage
=
true
;
}
)
}
}
source/components/minister/minister-view.ts
View file @
fe7a8d64
...
@@ -2,13 +2,15 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/cor
...
@@ -2,13 +2,15 @@ import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/cor
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
LOGININFO_INITIAL_STATE
}
from
'
../../store/logininfo/logininfo.initial-state
'
;
import
{
import
{
FormBuilder
,
FormBuilder
,
...
@@ -24,9 +26,27 @@ import { API_ENDPOINT } from '../../app.settings';
...
@@ -24,9 +26,27 @@ import { API_ENDPOINT } from '../../app.settings';
selector
:
'
minister-view
'
,
selector
:
'
minister-view
'
,
template
:
`
template
:
`
<div>
<div
class = "loading" *ngIf=" distStatus === 'STARTED'" >
</div>
<div class="alert alert-info" *ngIf="distStatus === 'STARTED'">
Παρακαλώ περιμένετε...Η εκτέλεση της κατανομής ενδέχεται να διαρκέσει μερικά λεπτά. Παρακαλώ μην εκτελείται οποιαδήποτε ενέργεια μετακίνησης στον φυλλομετρητή σας, μέχρι να ολοκληρωθεί η κατανομή.
</div>
<div class="alert alert-info" *ngIf="distStatus === 'FINISHED'">
Η κατανομή ολοκληρώθηκε με επιτυχία!
</div>
<div class="alert alert-info" *ngIf="distStatus === 'ERROR'">
Αποτυχία κατανομής!
</div>
<div>
<!--
<form [formGroup]="formGroup" method = "POST" action="{{apiEndPoint}}/epal/distribution" #form>
<form [formGroup]="formGroup" method = "POST" action="{{apiEndPoint}}/epal/distribution" #form>
<button type="submit" class="btn-primary btn-md" (click)="form.submit()" [disabled]="true">
-->
<form [formGroup]="formGroup" #form>
<!--<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>-->
<!--<button type="submit" class="btn-primary btn-md" (click)="form.submit()" >-->
<button type="submit" class="btn-primary btn-md" *ngIf="(loginInfo$ | async).size !== 0" (click)="runDistribution()" >
Εκτέλεση Κατανομής Μαθητών
Εκτέλεση Κατανομής Μαθητών
</button>
</button>
</form>
</form>
...
@@ -38,9 +58,17 @@ import { API_ENDPOINT } from '../../app.settings';
...
@@ -38,9 +58,17 @@ import { API_ENDPOINT } from '../../app.settings';
@
Injectable
()
export
default
class
MinisterView
implements
OnInit
,
OnDestroy
{
@
Injectable
()
export
default
class
MinisterView
implements
OnInit
,
OnDestroy
{
public
formGroup
:
FormGroup
;
public
formGroup
:
FormGroup
;
//private loginInfo$: Observable<ILoginInfo>;
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
loginInfoSub
:
Subscription
;
private
apiEndPoint
=
API_ENDPOINT
;
private
apiEndPoint
=
API_ENDPOINT
;
private
minedu_userName
:
string
;
private
minedu_userPassword
:
string
;
private
distStatus
=
"
READY
"
;
constructor
(
private
fb
:
FormBuilder
,
constructor
(
private
fb
:
FormBuilder
,
// private _ata: LoginInfoActions,
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
_hds
:
HelperDataService
,
private
_hds
:
HelperDataService
,
private
activatedRoute
:
ActivatedRoute
,
private
activatedRoute
:
ActivatedRoute
,
private
router
:
Router
)
{
private
router
:
Router
)
{
...
@@ -49,21 +77,44 @@ import { API_ENDPOINT } from '../../app.settings';
...
@@ -49,21 +77,44 @@ import { API_ENDPOINT } from '../../app.settings';
});
});
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
}
}
ngOnDestroy
()
{
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
this
.
loginInfo$
.
unsubscribe
();
}
}
ngOnInit
()
{
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$
);
}
}
runDistribution
()
{
runDistribution
()
{
this
.
distStatus
=
"
STARTED
"
;
this
.
_hds
.
makeDistribution
(
this
.
minedu_userName
,
this
.
minedu_userPassword
)
.
catch
(
err
=>
{
console
.
log
(
err
);
this
.
distStatus
=
"
ERROR
"
;
})
.
then
(
msg
=>
{
console
.
log
(
"
KATANOMH TELEIOSE
"
);
if
(
this
.
distStatus
!==
"
ERROR
"
)
this
.
distStatus
=
"
FINISHED
"
;
});
}
}
...
...
source/components/ministry.home.ts
View file @
fe7a8d64
import
{
Router
,
Params
}
from
'
@angular/router
'
;
import
{
Router
,
Params
}
from
'
@angular/router
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
import
{
OnInit
,
Component
}
from
'
@angular/core
'
;
import
{
LoginInfoActions
}
from
'
../actions/logininfo.actions
'
;
import
{
LoginInfoActions
}
from
'
../actions/logininfo.actions
'
;
import
{
ILoginInfo
}
from
'
../store/logininfo/logininfo.types
'
;
import
{
ILoginInfo
}
from
'
../store/logininfo/logininfo.types
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
...
@@ -36,16 +36,20 @@ import { API_ENDPOINT } from '../app.settings';
...
@@ -36,16 +36,20 @@ import { API_ENDPOINT } from '../app.settings';
<div class="alert alert-danger" *ngIf="userDataGroup.get('minedu_userpassword').touched && userDataGroup.get('minedu_userpassword').hasError('required')">
<div class="alert alert-danger" *ngIf="userDataGroup.get('minedu_userpassword').touched && userDataGroup.get('minedu_userpassword').hasError('required')">
Το πεδίο δεν μπορεί να αφεθεί κενό!
Το πεδίο δεν μπορεί να αφεθεί κενό!
</div>
</div>
<div class="alert alert-danger" *ngIf="!validLogin">
Λάθος όνομα χρήστη / κωδικός. Παρακαλώ προσπαθήστε ξανά.
</div>
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>
<div class="row" style="min-height: 300px; margin-top: 100px;">
<div class="row" style="min-height: 300px; margin-top: 100px;">
<!--<div *ngIf="!mineduUsername" class="col-md-8 offset-md-4">-->
<div
*ngIf="!mineduUsername"
class="col-md-8 offset-md-4">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-lg" (click)="submitCredentials()" [disabled]="userDataGroup.invalid">
<button type="submit" class="btn-primary btn-lg" (click)="submitCredentials()" [disabled]="userDataGroup.invalid">
Είσοδος<span class="glyphicon glyphicon-menu-right"></span>
Είσοδος<span class="glyphicon glyphicon-menu-right"></span>
</button>
</button>
</div>
</div>
</div>
</div>
</form>
</form>
</div>
</div>
`
`
...
@@ -55,7 +59,9 @@ export default class MinistryHome implements OnInit {
...
@@ -55,7 +59,9 @@ export default class MinistryHome implements OnInit {
public
userDataGroup
:
FormGroup
;
public
userDataGroup
:
FormGroup
;
private
authRole
:
string
;
private
authRole
:
string
;
private
mineduUsername
:
string
;
private
mineduUsername
:
string
;
private
mineduPassword
:
string
;
//private mineduPassword: string;
//private cuName: string;
private
validLogin
:
boolean
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
private
apiEndPoint
=
API_ENDPOINT
;
private
apiEndPoint
=
API_ENDPOINT
;
...
@@ -68,12 +74,16 @@ export default class MinistryHome implements OnInit {
...
@@ -68,12 +74,16 @@ export default class MinistryHome implements OnInit {
)
{
)
{
this
.
mineduUsername
=
''
;
this
.
mineduUsername
=
''
;
this
.
mineduPassword
=
''
;
//
this.mineduPassword = '';
this
.
authRole
=
''
;
this
.
authRole
=
''
;
//this.cuName = '';
this
.
validLogin
=
true
;
this
.
userDataGroup
=
this
.
fb
.
group
({
this
.
userDataGroup
=
this
.
fb
.
group
({
minedu_username
:
[
'
minedu01
'
,
[
Validators
.
required
]],
minedu_username
:
[
'
minedu01
'
,
[
Validators
.
required
]],
minedu_userpassword
:
[
'
12345678
'
,
[
Validators
.
required
]],
minedu_userpassword
:
[
'
12345678
'
,
[
Validators
.
required
]],
cu_name
:
[
''
],
auth_role
:
[
''
],
});
});
};
};
...
@@ -82,7 +92,7 @@ export default class MinistryHome implements OnInit {
...
@@ -82,7 +92,7 @@ export default class MinistryHome implements OnInit {
if
(
state
.
loginInfo
.
size
>
0
)
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
mineduUsername
=
loginInfoToken
.
minedu_username
;
this
.
mineduUsername
=
loginInfoToken
.
minedu_username
;
this
.
mineduPassword
=
loginInfoToken
.
minedu_userpassword
;
//
this.mineduPassword = loginInfoToken.minedu_userpassword;
if
(
this
.
mineduUsername
&&
this
.
mineduUsername
.
length
>
0
)
if
(
this
.
mineduUsername
&&
this
.
mineduUsername
.
length
>
0
)
this
.
router
.
navigate
([
'
/ministry/minister-view
'
]);
this
.
router
.
navigate
([
'
/ministry/minister-view
'
]);
return
loginInfoToken
;
return
loginInfoToken
;
...
@@ -96,11 +106,15 @@ export default class MinistryHome implements OnInit {
...
@@ -96,11 +106,15 @@ export default class MinistryHome implements OnInit {
submitCredentials
()
{
submitCredentials
()
{
let
success
=
true
;
let
success
=
true
;
this
.
_hds
.
sendMinisrtyCredentials
(
this
.
userDataGroup
.
value
[
'
minedu_username
'
],
this
.
userDataGroup
.
value
[
'
minedu_userpassword
'
])
this
.
_hds
.
sendMinisrtyCredentials
(
this
.
userDataGroup
.
value
[
'
minedu_username
'
],
this
.
userDataGroup
.
value
[
'
minedu_userpassword
'
])
.
catch
(
err
=>
{
console
.
log
(
err
);
success
=
false
;})
.
catch
(
err
=>
{
console
.
log
(
err
);
success
=
false
;
this
.
validLogin
=
false
;
})
.
then
(
msg
=>
{
.
then
(
msg
=>
{
if
(
success
)
{
if
(
success
)
{
this
.
authRole
=
'
supervisor
'
;
this
.
authRole
=
'
supervisor
'
;
this
.
_hds
.
setMineduCurrentUser
(
this
.
userDataGroup
.
value
[
'
minedu_username
'
],
this
.
userDataGroup
.
value
[
'
minedu_userpassword
'
],
this
.
authRole
);
console
.
log
(
"
MPHKA
"
);
console
.
log
(
"
MPHKA
"
);
this
.
validLogin
=
true
;
this
.
userDataGroup
.
value
[
'
cu_name
'
]
=
this
.
userDataGroup
.
value
[
'
minedu_username
'
];
this
.
userDataGroup
.
value
[
'
auth_role
'
]
=
'
supervisor
'
;
this
.
_ata
.
saveMinEduloginInfo
([
this
.
userDataGroup
.
value
]);
this
.
_ata
.
saveMinEduloginInfo
([
this
.
userDataGroup
.
value
]);
}
}
});
});
...
...
source/components/navbar/navbar.component.html
View file @
fe7a8d64
...
@@ -20,25 +20,37 @@
...
@@ -20,25 +20,37 @@
</button>
</button>
</div>
</div>
</ul>
</ul>
<ul
class=
"navbar-nav"
>
<ul
class=
"navbar-nav"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
[ngClass]=
"{active: path=='submited-preview'}"
>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
[ngClass]=
"{active: path=='submited-preview'}"
>
<li
*ngIf=
"authRole=='student'"
class=
"nav-item"
>
<li
*ngIf=
"authRole=='student'"
class=
"nav-item"
>
<a
class=
"nav-link"
[routerLink]=
"['/submited-preview']"
[routerLinkActive]=
"['active']"
><b>
Υποβληθείσες αιτήσεις
</b></a>
<a
class=
"nav-link"
[routerLink]=
"['/submited-preview']"
[routerLinkActive]=
"['active']"
><b>
Υποβληθείσες αιτήσεις
</b></a>
</li>
</li>
</div>
</div>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
[ngClass]=
"{active: path=='submited-preview'}"
>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
[ngClass]=
"{active: path=='submited-preview'}"
>
<li
*ngIf=
"authRole=='director'"
class=
"nav-item"
>
<li
*ngIf=
"authRole=='director'"
class=
"nav-item"
>
<a
class=
"nav-link"
[routerLink]=
"['/school/director-view']"
[routerLinkActive]=
"['active']"
><b>
Επιλεχθέντες Μαθητές
</b></a>
<a
class=
"nav-link"
[routerLink]=
"['/school/director-view']"
[routerLinkActive]=
"['active']"
><b>
Επιλεχθέντες Μαθητές
</b></a>
</li>
</li>
</div>
</div>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
[ngClass]=
"{active: path=='submited-preview'}"
>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
[ngClass]=
"{active: path=='submited-preview'}"
>
<li
*ngIf=
"authRole=='director'"
class=
"nav-item"
>
<li
*ngIf=
"authRole=='director'"
class=
"nav-item"
>
<a
class=
"nav-link"
[routerLink]=
"['/school/director-classcapacity']"
[routerLinkActive]=
"['active']"
><b>
Δυναμική Σχολείου
</b></a>
<a
class=
"nav-link"
[routerLink]=
"['/school/director-classcapacity']"
[routerLinkActive]=
"['active']"
><b>
Δυναμική Σχολείου
</b></a>
</li>
</li>
</div>
</div>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
>
<li
*ngIf=
"authRole=='supervisor'"
class=
"nav-item"
>
<a
class=
"nav-link"
[routerLink]=
"['/ministry/minister-view']"
[routerLinkActive]=
"['active']"
><b>
Κατανομή
</b></a>
</li>
</div>
<div
*ngIf=
"(loginInfo$ | async).size > 0"
class=
"nav-item"
>
<li
*ngIf=
"authRole=='supervisor'"
class=
"nav-item"
>
<a
class=
"nav-link"
[routerLink]=
"['/ministry/minister-reports']"
[routerLinkActive]=
"['active']"
><b>
Αναφορές
</b></a>
</li>
</div>
</div>
</ul>
</div>
</ul>
</div>
</div>
</div>
</div>
...
@@ -46,7 +58,3 @@
...
@@ -46,7 +58,3 @@
</nav>
</nav>
</div>
</div>
</div>
</div>
\ No newline at end of file
source/components/navbar/navbar.component.ts
View file @
fe7a8d64
...
@@ -67,6 +67,9 @@ import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial
...
@@ -67,6 +67,9 @@ import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial
else
if
(
this
.
authRole
===
'
student
'
)
{
else
if
(
this
.
authRole
===
'
student
'
)
{
this
.
router
.
navigate
([
''
]);
this
.
router
.
navigate
([
''
]);
}
}
else
if
(
this
.
authRole
===
'
supervisor
'
)
{
this
.
router
.
navigate
([
'
/ministry
'
]);
}
this
.
authToken
=
''
;
this
.
authToken
=
''
;
this
.
authRole
=
''
;
this
.
authRole
=
''
;
});
});
...
...
source/containers/main.routes.ts
View file @
fe7a8d64
...
@@ -24,6 +24,7 @@ import SubmitedPerson from '../components/student-application-form/submitedstude
...
@@ -24,6 +24,7 @@ import SubmitedPerson from '../components/student-application-form/submitedstude
import
DirectorView
from
'
../components/director/director-view
'
;
import
DirectorView
from
'
../components/director/director-view
'
;
import
DirectorClassCapacity
from
'
../components/director/director-classcapacity
'
;
import
DirectorClassCapacity
from
'
../components/director/director-classcapacity
'
;
import
MinisterView
from
'
../components/minister/minister-view
'
;
import
MinisterView
from
'
../components/minister/minister-view
'
;
import
MinisterReports
from
'
../components/minister/minister-reports
'
;
import
SchoolAuthGuard
from
'
../guards/school.auth.guard
'
;
import
SchoolAuthGuard
from
'
../guards/school.auth.guard
'
;
import
StudentAuthGuard
from
'
../guards/student.auth.guard
'
;
import
StudentAuthGuard
from
'
../guards/student.auth.guard
'
;
...
@@ -47,6 +48,7 @@ export const MainRoutes: Routes = [
...
@@ -47,6 +48,7 @@ export const MainRoutes: Routes = [
{
path
:
'
school/director-view
'
,
component
:
DirectorView
,
canActivate
:
[
SchoolAuthGuard
]
},
{
path
:
'
school/director-view
'
,
component
:
DirectorView
,
canActivate
:
[
SchoolAuthGuard
]
},
{
path
:
'
school/director-classcapacity
'
,
component
:
DirectorClassCapacity
,
canActivate
:
[
SchoolAuthGuard
]
},
{
path
:
'
school/director-classcapacity
'
,
component
:
DirectorClassCapacity
,
canActivate
:
[
SchoolAuthGuard
]
},
{
path
:
'
ministry/minister-view
'
,
component
:
MinisterView
},
{
path
:
'
ministry/minister-view
'
,
component
:
MinisterView
},
{
path
:
'
ministry/minister-reports
'
,
component
:
MinisterReports
},
];
];
export
const
MainDeclarations
=
[
export
const
MainDeclarations
=
[
...
@@ -70,5 +72,6 @@ export const MainDeclarations = [
...
@@ -70,5 +72,6 @@ export const MainDeclarations = [
SubmitedPerson
,
SubmitedPerson
,
DirectorView
,
DirectorView
,
DirectorClassCapacity
,
DirectorClassCapacity
,
MinisterView
MinisterView
,
MinisterReports
];
];
source/services/helper-data-service.ts
View file @
fe7a8d64
...
@@ -21,6 +21,8 @@ export class HelperDataService implements OnInit, OnDestroy {
...
@@ -21,6 +21,8 @@ export class HelperDataService implements OnInit, OnDestroy {
private
authToken
:
string
;
private
authToken
:
string
;
private
authRole
:
string
;
private
authRole
:
string
;
private
minedu_userName
:
string
;
private
minedu_userPassword
:
string
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
private
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
constructor
(
constructor
(
...
@@ -36,11 +38,14 @@ export class HelperDataService implements OnInit, OnDestroy {
...
@@ -36,11 +38,14 @@ export class HelperDataService implements OnInit, OnDestroy {
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
//this.minedu_userName = loginInfoToken.minedu_username;
//this.minedu_userPassword = loginInfoToken.minedu_userpassword;
return
loginInfoToken
;
return
loginInfoToken
;
},
{});
},
{});
}
}
return
state
.
loginInfo
;
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
}).
subscribe
(
this
.
loginInfo$
);
}
}
ngOnDestroy
()
{
ngOnDestroy
()
{
...
@@ -360,6 +365,9 @@ export class HelperDataService implements OnInit, OnDestroy {
...
@@ -360,6 +365,9 @@ export class HelperDataService implements OnInit, OnDestroy {
this
.
authToken
=
oauthtoken
;
this
.
authToken
=
oauthtoken
;
this
.
authRole
=
oauthrole
;
this
.
authRole
=
oauthrole
;
//console.log("MIPOS");
let
headers
=
new
Headers
({
let
headers
=
new
Headers
({
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
...
@@ -387,6 +395,12 @@ export class HelperDataService implements OnInit, OnDestroy {
...
@@ -387,6 +395,12 @@ export class HelperDataService implements OnInit, OnDestroy {
});
});
}
}
setMineduCurrentUser
(
minedu_username
,
minedu_pwd
,
role
)
{
this
.
minedu_userName
=
minedu_username
;