From 159d5395e24d50ee0c042b093bfb1353bddf2288 Mon Sep 17 00:00:00 2001 From: oat_dev Date: Fri, 7 Jun 2024 14:56:51 +0700 Subject: [PATCH] feat: delete customer + confirm dialog --- src/pages/03_customer-management/MainPage.vue | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index 2d2f1f44..a6099b5d 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -27,6 +27,8 @@ import CustomerInfoComponent from 'src/components/03_customer-management/Custome import { CustomerCreate, CustomerStats, Customer } from 'stores/customer/types'; import { onMounted } from 'vue'; +import { dialog } from 'src/stores/utils'; + const userCustomer = useCustomerStore(); const { create, getStatsCustomer, fetchList } = userCustomer; const formData = ref({ @@ -352,6 +354,24 @@ onMounted(async () => { } " @view-card="openDialogInputForm" + @delete-card=" + dialog({ + color: 'negative', + icon: 'mdi-alert', + title: $t('deleteConfirmTitle'), + actionText: $t('ok'), + persistent: true, + message: $t('deleteConfirmMessage'), + action: async () => { + await userCustomer.deleteById(i.id); + + const resultList = await fetchList(); + + if (resultList) listCustomer = resultList; + }, + cancel: () => {}, + }) + " />