feat: ลบ Branch
This commit is contained in:
parent
e83282aafa
commit
f294a20161
1 changed files with 48 additions and 21 deletions
|
|
@ -319,6 +319,46 @@ function clearForm() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteCustomerById(id: string) {
|
||||||
|
dialog({
|
||||||
|
color: 'negative',
|
||||||
|
icon: 'mdi-alert',
|
||||||
|
title: t('deleteConfirmTitle'),
|
||||||
|
actionText: t('ok'),
|
||||||
|
persistent: true,
|
||||||
|
message: t('deleteConfirmMessage'),
|
||||||
|
action: async () => {
|
||||||
|
await userCustomer.deleteById(id);
|
||||||
|
|
||||||
|
const resultList = await fetchList({ includeBranch: true });
|
||||||
|
|
||||||
|
if (resultList) listCustomer.value = resultList.result;
|
||||||
|
infoDrawer.value = false;
|
||||||
|
},
|
||||||
|
cancel: () => {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteBranchId(id: string) {
|
||||||
|
dialog({
|
||||||
|
color: 'negative',
|
||||||
|
icon: 'mdi-alert',
|
||||||
|
title: t('deleteConfirmTitle'),
|
||||||
|
actionText: t('ok'),
|
||||||
|
persistent: true,
|
||||||
|
message: t('deleteConfirmMessage'),
|
||||||
|
action: async () => {
|
||||||
|
await userCustomer.deleteBranchById(id);
|
||||||
|
|
||||||
|
const result = await fetchListById(currentCustomerId.value);
|
||||||
|
|
||||||
|
if (result) branch.value = result.branch;
|
||||||
|
infoDrawerBranch.value = false;
|
||||||
|
},
|
||||||
|
cancel: () => {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
await create({
|
await create({
|
||||||
...formData.value,
|
...formData.value,
|
||||||
|
|
@ -661,28 +701,12 @@ watch(locale, () => {
|
||||||
"
|
"
|
||||||
@view-card="
|
@view-card="
|
||||||
() => {
|
() => {
|
||||||
|
currentCustomerId = i.id;
|
||||||
assignFormData(i);
|
assignFormData(i);
|
||||||
openDialogInputForm('INFO', i.id);
|
openDialogInputForm('INFO', i.id);
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
@delete-card="
|
@delete-card="deleteCustomerById(i.id)"
|
||||||
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({ includeBranch: true });
|
|
||||||
|
|
||||||
if (resultList) listCustomer = resultList.result;
|
|
||||||
},
|
|
||||||
cancel: () => {},
|
|
||||||
})
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -724,9 +748,6 @@ watch(locale, () => {
|
||||||
@viewDetail="
|
@viewDetail="
|
||||||
(v) => {
|
(v) => {
|
||||||
infoDrawerBranch = true;
|
infoDrawerBranch = true;
|
||||||
|
|
||||||
console.log(v);
|
|
||||||
|
|
||||||
currentCustomerId = v.id;
|
currentCustomerId = v.id;
|
||||||
currentBranchId = v.branch[0].id;
|
currentBranchId = v.branch[0].id;
|
||||||
|
|
||||||
|
|
@ -1134,6 +1155,11 @@ watch(locale, () => {
|
||||||
:editData="() => (infoDrawerEdit = true)"
|
:editData="() => (infoDrawerEdit = true)"
|
||||||
:data="currentCustomer"
|
:data="currentCustomer"
|
||||||
:submit="() => onSubmitEdit(currentCustomerId)"
|
:submit="() => onSubmitEdit(currentCustomerId)"
|
||||||
|
:deleteData="
|
||||||
|
() => {
|
||||||
|
deleteCustomerById(currentCustomerId);
|
||||||
|
}
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #info>
|
<template #info>
|
||||||
<InfoForm>
|
<InfoForm>
|
||||||
|
|
@ -1324,6 +1350,7 @@ watch(locale, () => {
|
||||||
:isEdit="infoDrawerEdit"
|
:isEdit="infoDrawerEdit"
|
||||||
:close="() => onCloseBranch()"
|
:close="() => onCloseBranch()"
|
||||||
:editData="() => (infoDrawerEdit = true)"
|
:editData="() => (infoDrawerEdit = true)"
|
||||||
|
:deleteData="() => deleteBranchId(currentBranchId)"
|
||||||
:data="currentCustomer"
|
:data="currentCustomer"
|
||||||
:submit="
|
:submit="
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue