add actions on events-request-page

This commit is contained in:
Tim Gröger 2023-05-01 11:00:24 +02:00
parent b33d30fe40
commit 26235fef49
1 changed files with 56 additions and 4 deletions

View File

@ -30,6 +30,25 @@
</q-icon> </q-icon>
</q-td> </q-td>
</template> </template>
<template #body-cell-actions="props">
<q-td :props="props">
<!-- <q-btn v-for="action in props.value" :key="action.icon" :icon="action.icon" dense /> -->
<div class="row justify-end">
<div v-for="action in props.value" :key="action.icon">
<q-btn
class="q-mx-xs"
:icon="action.icon"
dense
@click="action.onClick"
round
:color="action.color"
>
<q-tooltip>{{ action.tooltip }}</q-tooltip>
</q-btn>
</div>
</div>
</q-td>
</template>
</q-table> </q-table>
</q-page> </q-page>
</template> </template>
@ -214,10 +233,43 @@ export default defineComponent({
align: 'right', align: 'right',
name: 'actions', name: 'actions',
classes: dimmed, classes: dimmed,
field: (row: RowData) => ({ field: (row: RowData) => {
job: row.job_id, const sender = row.inviter_id === mainStore.currentUser.userid;
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;
},
}, },
]; ];