From 26235fef49d14ddc995d479cd77a7414ea030eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Mon, 1 May 2023 11:00:24 +0200 Subject: [PATCH] add actions on events-request-page --- src/pages/EventRequests.vue | 60 ++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/src/pages/EventRequests.vue b/src/pages/EventRequests.vue index 5e169f0..a0f7a17 100644 --- a/src/pages/EventRequests.vue +++ b/src/pages/EventRequests.vue @@ -30,6 +30,25 @@ + @@ -214,10 +233,43 @@ export default defineComponent({ align: 'right', name: 'actions', classes: dimmed, - field: (row: RowData) => ({ - job: row.job_id, - sender: row.inviter_id === mainStore.currentUser.userid, - }), + field: (row: RowData) => { + const sender = row.inviter_id === mainStore.currentUser.userid; + let actions = []; + const reject = { + icon: 'mdi-delete', + tooltip: 'Einladung löschen', + color: 'negative', + onClick: () => { + void store.rejectInvitation(row.id); + onRequest({ + pagination: pagination.value, + filter: () => [], + getCellValue: () => [], + }); + }, + }; + const accept = { + icon: 'mdi-check', + tooltip: 'Einladung annehmen', + color: 'primary', + onClick: () => { + void store.acceptInvitation(row.id); + onRequest({ + pagination: pagination.value, + filter: () => [], + getCellValue: () => [], + }); + }, + }; + if (sender) { + actions.push(reject); + } else if (row.invitee_id === mainStore.currentUser.userid) { + actions.push(accept); + actions.push({ ...reject, icon: 'mdi-close' }); + } + return actions; + }, }, ];