feat: delete customer + confirm dialog
This commit is contained in:
parent
0501bd1ab8
commit
159d5395e2
1 changed files with 20 additions and 0 deletions
|
|
@ -27,6 +27,8 @@ import CustomerInfoComponent from 'src/components/03_customer-management/Custome
|
||||||
import { CustomerCreate, CustomerStats, Customer } from 'stores/customer/types';
|
import { CustomerCreate, CustomerStats, Customer } from 'stores/customer/types';
|
||||||
import { onMounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
import { dialog } from 'src/stores/utils';
|
||||||
|
|
||||||
const userCustomer = useCustomerStore();
|
const userCustomer = useCustomerStore();
|
||||||
const { create, getStatsCustomer, fetchList } = userCustomer;
|
const { create, getStatsCustomer, fetchList } = userCustomer;
|
||||||
const formData = ref<CustomerCreate>({
|
const formData = ref<CustomerCreate>({
|
||||||
|
|
@ -352,6 +354,24 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@view-card="openDialogInputForm"
|
@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>
|
</div>
|
||||||
</AppBox>
|
</AppBox>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue