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
e1a9594a
Commit
e1a9594a
authored
Mar 28, 2017
by
Open Source Developer
Browse files
pdfapplication
parent
926fddbb
Changes
6
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/epal.routing.yml
View file @
e1a9594a
...
...
@@ -22,6 +22,22 @@ submitedapplications:
_controller
:
'
\Drupal\epal\Controller\SubmitedApplications::getSubmittedApplications'
requirements
:
_user_is_logged_in
:
'
TRUE'
studentapplication
:
path
:
'
/epal/student/{studentId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\SubmitedApplications::getStudentApplications'
requirements
:
_user_is_logged_in
:
'
TRUE'
epalchosen
:
path
:
'
/epal/epalchosen/{studentId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\SubmitedApplications::getEpalChosen'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.application_submit
:
path
:
'
/epal/appsubmit'
options
:
...
...
drupal/modules/epal/src/Controller/SubmitedApplications.php
View file @
e1a9594a
...
...
@@ -30,15 +30,11 @@ class SubmitedApplications extends ControllerBase
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$studentId
=
$request
->
headers
->
get
(
'id'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
id
();
if
(
$studentId
===
""
)
{
$epalStudents
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'epaluser_id'
=>
$userid
));
$i
=
0
;
if
(
$epalStudents
)
{
...
...
@@ -62,9 +58,29 @@ class SubmitedApplications extends ControllerBase
'message'
=>
t
(
"EPAL user not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
getStudentApplications
(
Request
$request
,
$studentId
)
{
$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
();
$studentIdNew
=
intval
(
$studentId
)
;
$epalStudents
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'epaluser_id'
=>
$userid
,
'id'
=>
$studentIdNew
));
$i
=
0
;
...
...
@@ -72,12 +88,16 @@ class SubmitedApplications extends ControllerBase
if
(
$epalStudents
)
{
$list
=
array
();
foreach
(
$epalStudents
as
$object
)
{
$list
[]
=
array
(
'id'
=>
$object
->
id
(),
'name'
=>
$object
->
name
->
value
,
'studentsurname'
=>
$object
->
studentsurname
->
value
);
'studentsurname'
=>
$object
->
studentsurname
->
value
,
'fatherfirstname'
=>
$object
->
fatherfirstname
->
value
,
'fathersurname'
=>
$object
->
fathersurtname
->
value
,
'motherfirstname'
=>
$object
->
motherfirstname
->
value
,
'mothersurname'
=>
$object
->
mothersurname
->
value
,
'birthdate'
=>
$object
->
birthdate
->
value
,
);
$i
++
;
}
...
...
@@ -90,9 +110,51 @@ class SubmitedApplications extends ControllerBase
'message'
=>
t
(
"EPAL user not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
getEpalChosen
(
Request
$request
,
$studentId
)
{
$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
();
$studentIdNew
=
intval
(
$studentId
)
;
$epalChosen
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_epal_chosen'
)
->
loadByProperties
(
array
(
'user_id'
=>
$userid
,
'student_id'
=>
$studentIdNew
));
$i
=
0
;
if
(
$epalChosen
)
{
$list
=
array
();
foreach
(
$epalChosen
as
$object
)
{
$list
[]
=
array
(
'epal_id'
=>
$object
->
epal_id
->
entity
->
get
(
'name'
)
->
value
,
'choice_no'
=>
$object
->
choice_no
->
value
,
);
$i
++
;
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"EPAL chosen not found!!!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
...
...
@@ -104,9 +166,22 @@ class SubmitedApplications extends ControllerBase
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
return
$res
;
}
}
myschool/main.scss
View file @
e1a9594a
...
...
@@ -60,6 +60,23 @@
.main-content
{
.submited
{
table
{
font-family
:
arial
,
sans-serif
;
border-collapse
:
collapse
;
width
:
100%
;
}
td
,
th
{
border
:
1px
solid
#dddddd
;
text-align
:
left
;
padding
:
8px
;
}
tr
:nth-child
(
even
)
{
background-color
:
#dddddd
;
}
}
.btn
{
background-color
:
#fd9665
;
...
...
source/components/student-application-form/submited.aplication.preview.ts
View file @
e1a9594a
...
...
@@ -17,11 +17,19 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
@
Component
({
selector
:
'
submited-preview
'
,
template
:
`
lalalalalal
<div *ngFor="let UserData$ of SubmitedApplic$ | async">
{{UserData$.name}}
<button type="button" (click)="studentpreview(UserData$.id)"> Λεπτομέρειες </button>
</div>
Έχει υποβληθεί αίτηση για εγγραφή στην Επαγγελματική Εκπαίδευση των παρακάτω ατόμων:
<table class = "submited">
<tr>
<th>Όνομα</th>
<th>Επώνυμο</th>
<th></th>
</tr>
<tr *ngFor="let UserData$ of SubmitedApplic$ | async">
<td>{{UserData$.name}} </td>
<td>{{UserData$.studentsurname}} </td>
<td> <button type="button" (click)="studentpreview(UserData$.id)"> <i class="fa fa-eye" aria-hidden="true"></i> </button> </td>
</tr>
`
...
...
source/components/student-application-form/submitedstudent.preview.ts
View file @
e1a9594a
...
...
@@ -12,6 +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
"
...
...
@@ -21,8 +22,20 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
template
:
`
<div id = "target">
<div *ngFor="let StudentDetails$ of SubmitedDetails$ | async">
{{StudentDetails$.name}}
</div>
Όνομα: {{StudentDetails$.name}} <br>
Επώνυμο: {{StudentDetails$.studentsurname}}<br>
Όνομα Πατέρα: {{StudentDetails$.fatherfirstname}}<br>
Επώνυμο Πατέρα:{{StudentDetails$.fathersurname}}<br>
Όνομα Μητέρας: {{StudentDetails$.motherfirstname}}<br>
Επώνυμο Μητέρας:{{StudentDetails$.mothersurname}}<br>
Ημερομηνία Γέννησης: {{StudentDetails$.birthdate}}<br>
</div>
<b>Επιλογές ΕΠΑΛ</b>
<div *ngFor="let epalChoices$ of EpalChosen$ | async">
Σχολείο: {{epalChoices$.epal_id}}
Σειρά Προτίμισης:{{epalChoices$.choice_no}}
</div>
</div>
<button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
`
...
...
@@ -33,6 +46,9 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
private
SubmitedDetails$
:
BehaviorSubject
<
any
>
;
private
SubmitedDetailsSub
:
Subscription
;
private
EpalChosen$
:
BehaviorSubject
<
any
>
;
private
EpalChosenSub
:
Subscription
;
public
StudentId
:
Number
;
constructor
(
private
_hds
:
HelperDataService
,
...
...
@@ -40,12 +56,16 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
private
router
:
Router
)
{
this
.
SubmitedDetails$
=
new
BehaviorSubject
([{}]);
this
.
EpalChosen$
=
new
BehaviorSubject
([{}]);
}
ngOnDestroy
()
{
if
(
this
.
SubmitedDetailsSub
)
this
.
SubmitedDetailsSub
.
unsubscribe
();
if
(
this
.
EpalChosenSub
)
this
.
EpalChosenSub
.
unsubscribe
();
}
...
...
@@ -54,7 +74,7 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
this
.
getApplicationId
();
this
.
SubmitedDetailsSub
=
this
.
_hds
.
getStudentDetails
(
this
.
StudentId
).
subscribe
(
this
.
SubmitedDetails$
);
this
.
EpalChosenSub
=
this
.
_hds
.
getEpalchosen
(
this
.
StudentId
).
subscribe
(
this
.
EpalChosen$
);
}
...
...
source/services/helper-data-service.ts
View file @
e1a9594a
...
...
@@ -352,17 +352,32 @@ transformUserSchema(userlogin:any,oauthtoken:string, oauthrole:string){
getStudentDetails
(
headerid
)
{
let
headerIdNew
=
headerid
.
toString
();
let
headerIdNew
=
headerid
.
toString
();
this
.
loginInfo$
.
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
get
(
0
).
auth_token
;
});
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
"
id
"
:
headerIdNew
});
this
.
createAuthorizationHeader
(
headers
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/subapplic`
,
options
)
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/student/`
+
headerIdNew
,
options
)
.
map
(
response
=>
response
.
json
());
}
getEpalchosen
(
headerid
)
{
let
headerIdNew
=
headerid
.
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/epalchosen/`
+
headerIdNew
,
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