feat: delete customer + confirm dialog

This commit is contained in:
oat_dev 2024-06-07 14:56:51 +07:00
parent 0501bd1ab8
commit 159d5395e2

View file

@ -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<CustomerCreate>({
@ -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: () => {},
})
"
/>
</div>
</AppBox>