add actions on events-request-page
This commit is contained in:
parent
b33d30fe40
commit
26235fef49
|
@ -30,6 +30,25 @@
|
|||
</q-icon>
|
||||
</q-td>
|
||||
</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-page>
|
||||
</template>
|
||||
|
@ -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;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue