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
68594917
Commit
68594917
authored
Mar 23, 2017
by
Open Source Developer
Browse files
transfer
parent
ec3b845d
Changes
6
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/epal.routing.yml
View file @
68594917
...
...
@@ -15,7 +15,7 @@ current_user:
requirements
:
_user_is_logged_in
:
'
TRUE'
submitedapplications
:
path
:
'
/epal/subapplic'
path
:
'
/epal/subapplic
/{$studentid}
'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
...
...
drupal/modules/epal/src/Controller/SubmitedApplications.php
View file @
68594917
...
...
@@ -34,7 +34,7 @@ class SubmitedApplications extends ControllerBase
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
>
$epalUser
->
user_id
->
entity
->
id
();
$userid
=
$epalUser
->
user_id
->
entity
->
id
();
$epalStudents
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'user_id'
=>
$userid
));
$epalStudent
=
reset
(
$epalStudents
);
...
...
@@ -49,7 +49,26 @@ class SubmitedApplications extends ControllerBase
'message'
=>
t
(
"EPAL user not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
if
(
$studentid
){
$StudentSelection
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_epal_chosen'
)
->
loadByProperties
(
array
(
'student_id'
=>
$studentid
,
'user_id'
=>
$userid
));
$StudentSel
=
reset
(
$StudentSelection
);
if
(
$StudentSel
)
{
return
$this
->
respondWithStatus
([
'epal_id'
=>
$epalStudent
->
epal_id
->
entity
->
getEpal_id
(),
],
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"SpecificStudent not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"EPAL user not found"
),
...
...
source/components/student-application-form/submited.aplication.preview.ts
View file @
68594917
...
...
@@ -11,52 +11,56 @@ import {Removetags} from '../../pipes/removehtmltags';
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
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
'
;
@
Component
({
selector
:
'
submited-preview
'
,
template
:
`
<div id = "target">
Έχετε ολοκληρώσει την αίτηση για εγγραφή στην επαγγελπατική εκπαίδευση των παρακάτω ατόμων:
<div *ngFor="let userdata$ of submitedusers$ | async; ">
<br>
<br>
<strong>Στοιχεία υποψηφίου μαθητή: </strong> <br>
<br>
</div>
</div>
<button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
<h5 style="margin-top: 20px; line-height: 2em; ">Έχετε ολοκληρώσει την αίτηση για εγγραφή στην επαγγελπατική εκπαίδευση των παρακάτω ατόμων:</h5>
<div *ngFor="let userdata$ of submitedapplic$ | async; ">
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Μαθητής: {{userdata$.name}}
</li>
</ul>
</div>
<button type="submit" (click)="studentpreview()"> Λεπτομέρειες
</button>
`
})
@
Injectable
()
export
default
class
SubmitedPreview
implements
OnInit
{
public
submitedapplic$
:
any
;
public
submitedusers$
:
any
;
public
html2canvas
:
any
;
private
loginInfo$
:
Observable
<
ILoginInfo
>
;
private
user
:
string
;
private
submitedapplic$
:
BehaviorSubject
<
any
>
;
private
submitedusers$
:
Subscription
;
public
studentid
=
1
;
constructor
(
private
_hds
:
HelperDataService
,
public
http
:
Http
,
private
_ngRedux
:
NgRedux
<
IAppState
>
,)
public
http
:
Http
,
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
activatedRoute
:
ActivatedRoute
,
private
router
:
Router
)
{
this
.
submitedapplic$
=
new
BehaviorSubject
({});
}
ngOnInit
()
{
this
.
submitedusers$
=
this
.
_hds
.
getSubmittedPreviw
(
0
).
subscribe
(
this
.
submitedapplic$
);
console
.
log
(
"
subscription
"
,
this
.
submitedusers$
,
"
behavior
"
,
this
.
submitedapplic$
);
}
...
...
@@ -74,4 +78,12 @@ import { ILoginInfo } from '../../store/logininfo/logininfo.types';
);
}
studentpreview
()
{
console
.
log
(
this
.
studentid
);
this
.
router
.
navigate
([
'
/submited-person
'
,
{
id
:
this
.
studentid
}]);
}
}
\ No newline at end of file
source/components/student-application-form/submitedstudent.preview.ts
0 → 100644
View file @
68594917
import
{
Component
,
OnInit
,
ElementRef
,
ViewChild
}
from
"
@angular/core
"
;
let
jsPDF
=
require
(
'
jspdf
'
);
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
IStudentDataFields
,
IStudentDataField
}
from
'
../../store/studentdatafields
'
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
*
as
html2canvas
from
"
html2canvas
"
import
{
Removetags
}
from
'
../../pipes/removehtmltags
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
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
'
;
@
Component
({
selector
:
'
submited-person
'
,
template
:
`
<h5 style="margin-top: 20px; line-height: 2em; ">Στοιχεία Μαθητή</h5>
<div *ngFor="let userdata$ of submitedapplic$ | async; ">
<ul class="list-group left-side-view" style="margin-bottom: 20px;">
<li class="list-group-item active">
Μαθητής: {{userdata$.name}}
</li>
</ul>
</div>
`
})
@
Injectable
()
export
default
class
SubmitedPerson
implements
OnInit
{
public
html2canvas
:
any
;
private
submitedapplic$
:
BehaviorSubject
<
any
>
;
private
submitedusers$
:
Subscription
;
public
userid
:
number
;
public
authToken
:
string
;
constructor
(
private
_hds
:
HelperDataService
,
public
http
:
Http
,
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
activatedRoute
:
ActivatedRoute
)
{
this
.
submitedapplic$
=
new
BehaviorSubject
({});
}
ngOnInit
()
{
this
.
activatedRoute
.
queryParams
.
subscribe
((
params
:
Params
)
=>
{
if
(
params
)
{
this
.
userid
=
1
;
console
.
log
(
"
userid
"
,
this
.
userid
,
this
.
authToken
);
}
});
this
.
submitedusers$
=
this
.
_hds
.
getSubmittedPreviw
(
this
.
userid
).
subscribe
(
this
.
submitedapplic$
);
console
.
log
(
"
subscription
"
,
this
.
submitedusers$
,
"
behavior
"
,
this
.
submitedapplic$
);
}
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
'
);
}
);
}
}
\ No newline at end of file
source/containers/main.routes.ts
View file @
68594917
...
...
@@ -18,7 +18,7 @@ import ApplicationPreview from '../components/student-application-form/applicati
import
SchoolsOrderSelect
from
'
../components/student-application-form/schools-order-select
'
;
import
ApplicationSubmit
from
'
../components/student-application-form/application.submit
'
;
import
SubmitedPreview
from
'
../components/student-application-form/submited.aplication.preview
'
;
import
SubmitedPerson
from
'
../components/student-application-form/submitedstudent.preview
'
;
export
const
MainRoutes
:
Routes
=
[
{
path
:
''
,
component
:
Home
},
...
...
@@ -34,6 +34,7 @@ export const MainRoutes: Routes = [
{
path
:
'
schools-order-select
'
,
component
:
SchoolsOrderSelect
},
{
path
:
'
application-submit
'
,
component
:
ApplicationSubmit
},
{
path
:
'
submited-preview
'
,
component
:
SubmitedPreview
},
{
path
:
'
submited-person
'
,
component
:
SubmitedPerson
},
];
export
const
MainDeclarations
=
[
...
...
@@ -52,4 +53,5 @@ export const MainDeclarations = [
SchoolsOrderSelect
,
ApplicationSubmit
,
SubmitedPreview
,
SubmitedPerson
];
source/services/helper-data-service.ts
View file @
68594917
...
...
@@ -331,4 +331,21 @@ transformUserSchema(userlogin:any,oauthtoken:string, oauthrole:string){
}
getSubmittedPreviw
(
stud_id
)
{
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/subapplic`
,
options
,
{
params
:{
"
param1
"
:
stud_id
}})
.
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