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
44cf211d
Commit
44cf211d
authored
Jun 12, 2017
by
Χάρης Παπαδόπουλος
Browse files
WIP: implementing application deletion
parent
569c2ae6
Changes
4
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/src/Controller/SubmitedApplications.php
View file @
44cf211d
...
...
@@ -44,6 +44,31 @@ class SubmitedApplications extends ControllerBase
);
}
public
function
deleteApplication
(
Request
$request
)
{
$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
));
$epalStudent
=
reset
(
$epalStudents
);
if
(
$epalStudent
)
{
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'EPAL user not found'
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
'User not found'
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
getSubmittedApplications
(
Request
$request
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
...
...
source/components/student-application-form/submited.aplication.preview.ts
View file @
44cf211d
...
...
@@ -29,7 +29,8 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
<div *ngIf="(SubmitedApplic$ | async).length > 0" class="row list-group-item" style="margin: 0px 2px 0px 2px; background-color: #ccc;">
<div class="col-md-6" style="font-size: 1em; font-weight: bold;">Επώνυμο</div>
<div class="col-md-6" style="font-size: 1em; font-weight: bold;">Όνομα</div>
<div class="col-md-5" style="font-size: 1em; font-weight: bold;">Όνομα</div>
<div class="col-md-1" style="font-size: 1em; font-weight: bold;"> </div>
</div>
<div *ngIf="(SubmitedApplic$ | async).length > 0">
...
...
@@ -40,7 +41,8 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
[class.selectedappout]="userActive === UserData$.id"
*ngFor="let UserData$ of SubmitedApplic$ | async; let i=index; let isOdd=odd; let isEven=even" >
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;">{{UserData$.studentsurname}}</div>
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;">{{UserData$.name}}</div>
<div class="col-md-5" style="font-size: 0.8em; font-weight: bold;">{{UserData$.name}}</div>
<div class="col-md-1" style="font-size: 1em; font-weight: bold;"><i class="fa fa-trash isclickable" (click)="deleteApplication(UserData$.id)"></i></div>
<div style="width: 100%">
<div *ngFor="let StudentDetails$ of SubmitedDetails$ | async" [hidden]="UserData$.id !== userActive" style="margin: 10px 10px 10px 10px;">
...
...
@@ -276,4 +278,8 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
}
deleteApplication
(
appId
:
number
)
:
void
{
}
}
source/services/helper-data-service.ts
View file @
44cf211d
...
...
@@ -154,6 +154,31 @@ export class HelperDataService implements OnInit, OnDestroy {
});
}
deleteApplication
(
appId
)
{
this
.
loginInfo$
.
getValue
().
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
});
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createAuthorizationHeader
(
headers
);
// let options = new RequestOptions({ headers: headers, withCredentials: true });
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
http
.
post
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/application/delete`
,
{
applicationId
:
appId
},
options
)
.
map
(
response
=>
response
.
json
())
.
subscribe
(
data
=>
{
resolve
(
<
any
>
data
);
},
error
=>
{
console
.
log
(
"
Error Removing Application
"
);
reject
(
"
Error Removing Application
"
);
},
()
=>
console
.
log
(
"
Removing Application
"
));
});
}
getCourseFields
()
{
this
.
loginInfo$
.
getValue
().
forEach
(
loginInfoToken
=>
{
...
...
tsconfig.json
View file @
44cf211d
...
...
@@ -10,7 +10,7 @@
"sourceMap"
:
false
,
"inlineSourceMap"
:
false
,
"module"
:
"commonjs"
,
"target"
:
"
es6
"
"target"
:
"
ES5
"
},
"exclude"
:
[
...
...
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