Add delete functionality with action UI for SMS objects
Introduced a delete method and action handling for SMS objects in `DepartmentNotificationSms`. Enhanced `ObjectsGlobal` and the notifications table with delete icon support and a UI action button for object deletion. These changes improve user interaction and streamline object management.
This commit is contained in:
+16
@@ -9,6 +9,8 @@ const props = defineProps({
|
||||
});
|
||||
import { SessionUser } from "@/components/session/token/SessionUser.vue";
|
||||
import { ref } from 'vue';
|
||||
import ActionSettingsWheelButton from "@/components/displays/buttons/ActionSettingsWheelButton.vue";
|
||||
import ActionSettingsWheelItem from "@/components/displays/buttons/ActionSettingsWheelItem.vue";
|
||||
|
||||
const su_object = SessionUser.objects.department_notification_sms;
|
||||
</script>
|
||||
@@ -22,6 +24,7 @@ const su_object = SessionUser.objects.department_notification_sms;
|
||||
<th>{{su_object.columns.phone_country_code.label}}</th>
|
||||
<th>{{su_object.columns.phone.label}}</th>
|
||||
<th>{{su_object.columns.enabled.label}}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -58,6 +61,19 @@ const su_object = SessionUser.objects.department_notification_sms;
|
||||
return value ? SessionUser.objects.global.language.yes : SessionUser.objects.global.language.no;
|
||||
}"
|
||||
/>
|
||||
<!-- Actions -->
|
||||
<td class="has-text-right">
|
||||
<ActionSettingsWheelButton>
|
||||
<template #actions>
|
||||
<ActionSettingsWheelItem
|
||||
@click="su_object.functions.showDeleteObjectForm(obj.id, loadList)"
|
||||
:icon="SessionUser.objects.global.icons.delete"
|
||||
:label="SessionUser.objects.global.language.delete"
|
||||
template="danger"
|
||||
/>
|
||||
</template>
|
||||
</ActionSettingsWheelButton>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
||||
@@ -54,7 +54,8 @@ export const DepartmentNotificationSms = {
|
||||
creation: {
|
||||
required: true
|
||||
},
|
||||
options: [
|
||||
options: async () => {
|
||||
return [
|
||||
{
|
||||
name: "Danmark (+45)",
|
||||
id: 45
|
||||
@@ -71,7 +72,8 @@ export const DepartmentNotificationSms = {
|
||||
name: "Finland (+358)",
|
||||
id: 358
|
||||
}
|
||||
]
|
||||
];
|
||||
}
|
||||
},
|
||||
phone: {
|
||||
label: "Telefonnummer",
|
||||
@@ -151,7 +153,14 @@ export const DepartmentNotificationSms = {
|
||||
return ObjectsGlobal.get.object(DepartmentNotificationSms.meta.endpoint, id);
|
||||
}
|
||||
},
|
||||
functions: {},
|
||||
delete: async (id) => {
|
||||
return ObjectsGlobal.delete.object(DepartmentNotificationSms.meta.endpoint, id);
|
||||
},
|
||||
functions: {
|
||||
showDeleteObjectForm: (id, onAfterSubmit = null) => {
|
||||
return ObjectsGlobal.showDeleteObjectForm(DepartmentNotificationSms, id, onAfterSubmit);
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Show the create object form
|
||||
* @param onAfterSubmit
|
||||
|
||||
@@ -6,6 +6,9 @@ import {authenticatedRequest, unauthenticatedRequest} from "@/components/session
|
||||
* The Global Objects object, which contains global functions for objects.
|
||||
*/
|
||||
export const ObjectsGlobal = {
|
||||
icons: {
|
||||
delete: 'fas fa-trash',
|
||||
},
|
||||
language: {
|
||||
title: (object) => {
|
||||
return `Opret ${object.meta.labels.single}`;
|
||||
|
||||
Reference in New Issue
Block a user