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
1131f9c0
Commit
1131f9c0
authored
Mar 30, 2017
by
Open Source Developer
Browse files
transf
parent
9744fe16
Changes
5
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/epal.routing.yml
View file @
1131f9c0
...
...
@@ -82,3 +82,11 @@ epal.allocation:
_controller
:
'
\Drupal\epal\Controller\Distribution::createDistribution'
requirements
:
_access
:
'
TRUE'
sectorperschool
:
path
:
'
/epal/sectorperSchool/{epalId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getSectorsPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/epal/src/Controller/DirectorView.php
0 → 100644
View file @
1131f9c0
<?php
namespace
Drupal\epal\Controller
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Drupal\Core\Controller\ControllerBase
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
class
DirectorView
extends
ControllerBase
{
protected
$entityTypeManager
;
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
)
{
$this
->
entityTypeManager
=
$entityTypeManager
;
}
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'entity_type.manager'
)
);
}
public
function
getSectorsPerSchool
(
Request
$request
,
$epalId
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
user_id
->
entity
->
id
();
$epalIdNew
=
intval
(
$epalId
);
$sectorPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$epalIdNew
));
$i
=
0
;
if
(
$sectorPerSchool
)
{
$list
=
array
();
foreach
(
$sectorPerSchool
as
$object
)
{
$list
[]
=
array
(
'sector_id'
=>
$object
->
sector_id
->
entity
->
get
(
'name'
)
->
value
,
'id'
=>
$object
->
sector_id
->
entity
->
id
()
);
$i
++
;
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"School not found!!!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
return
$res
;
}
}
source/components/director/director-view.ts
View file @
1131f9c0
...
...
@@ -8,6 +8,7 @@ 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
{
FormBuilder
,
FormGroup
,
...
...
@@ -18,30 +19,24 @@ import {
@
Component
({
selector
:
'
director-view
'
,
template
:
`
<form [formGroup]="formGroup">
<div class="form-group" style= "margin-top: 50px; margin-bottom: 100px;">
<div class="form-group" >
<label for="name">Τάξη</label><br/>
<select class="form-control" formControlName="
name
" (change)="verifyclass()">
<option value="
Α' Λυκείου"
>Α' Λυκείου</option>
<option value="
Β' Λυκείου"
>Β' Λυκείου</option>
<option value="
Γ' Λυκείου"
>Γ' Λυκείου</option>
<select class="form-control" formControlName="
taxi
" (change)="verifyclass()">
<option value="
1"
>Α' Λυκείου</option>
<option value="
2"
>Β' Λυκείου</option>
<option value="
3"
>Γ' Λυκείου</option>
</select>
<div>
<div class="form-group" style= "margin-top: 50px; margin-bottom: 100px;">
<label for="name1">Τάξη1</label><br/>
<select class="form-control" formControlName="name1" (change)="verifyclass()">
<option value="Α' Λυκείου">Α' Λυκείου</option>
<option value="Β' Λυκείου">Β' Λυκείου</option>
<option value="Γ' Λυκείου">Γ' Λυκείου</option>
<div>
<div class="form-group" *ngIf="(StudentSelected$ | async).size > 0" >
<label for="tomeas">Τομέας</label><br/>
<select #cblst [(ngModel)]="tomeas" [ngModelOptions]="{standalone: true}" (change)="verifyclass(cblst)" >
<option *ngFor="let SectorSelection$ of StudentSelected$ | async" [ngValue]="SectorSelection$.id">{{SectorSelection$.sector_id}}</option>
</select>
<div>
<div>
`
})
...
...
@@ -51,6 +46,9 @@ import {
private
StudentSelected$
:
BehaviorSubject
<
any
>
;
private
StudentSelectedSub
:
Subscription
;
public
bClassEnabled
:
boolean
;
public
gClassEnabled
:
boolean
;
private
SchoolId
=
12
;
constructor
(
private
fb
:
FormBuilder
,
private
_hds
:
HelperDataService
,
...
...
@@ -59,8 +57,8 @@ import {
{
this
.
StudentSelected$
=
new
BehaviorSubject
([{}]);
this
.
formGroup
=
this
.
fb
.
group
({
name
:[],
name1
:[]
taxi
:[],
});
}
...
...
@@ -73,15 +71,30 @@ import {
ngOnInit
()
{
this
.
bClassEnabled
=
false
;
this
.
bClassEnabled
=
false
;
this
.
gClassEnabled
=
false
;
this
.
StudentSelectedSub
=
this
.
_hds
.
getSectorPerSchool
(
this
.
SchoolId
).
subscribe
(
this
.
StudentSelected$
);
console
.
log
(
this
.
StudentSelected$
);
}
verifyclass
()
{
this
.
bClassEnabled
=
true
;
if
(
this
.
formGroup
.
value
.
taxi
===
"
1
"
)
{
this
.
bClassEnabled
=
false
;
this
.
gClassEnabled
=
false
;
}
else
if
(
this
.
formGroup
.
value
.
taxi
===
"
2
"
)
{
this
.
bClassEnabled
=
true
;
this
.
gClassEnabled
=
false
;
}
else
if
(
this
.
formGroup
.
value
.
taxi
===
"
3
"
)
{
this
.
bClassEnabled
=
true
;
this
.
gClassEnabled
=
true
;
}
}
...
...
source/components/student-application-form/submitedstudent.preview.ts
View file @
1131f9c0
...
...
@@ -12,7 +12,7 @@ import { IAppState } from '../../store/store';
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
*
as
html2canvas
from
"
html2canvas
"
...
...
@@ -87,7 +87,13 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
createPdf
()
{
html2canvas
(
document
.
getElementById
(
"
target
"
)).
then
(
function
(
canvas
)
{
var
img
=
canvas
.
toDataURL
();
var
doc
=
new
jsPDF
(
'
p
'
,
'
mm
'
);
doc
.
addImage
(
img
,
'
PNG
'
,
10
,
10
);
doc
.
save
(
'
applications.pdf
'
);
});
}
...
...
source/services/helper-data-service.ts
View file @
1131f9c0
...
...
@@ -458,5 +458,22 @@ transformUserSchema(userlogin:any,oauthtoken:string, oauthrole:string){
}
getSectorPerSchool
(
SchoolId
)
{
let
SchoolIdNew
=
SchoolId
.
toString
();
this
.
loginInfo$
.
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
get
(
0
).
auth_token
;
});
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createAuthorizationHeader
(
headers
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/sectorperSchool/`
+
SchoolIdNew
,
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