refactor: delete Branch
This commit is contained in:
parent
23d2ade763
commit
ef9aeb930a
1 changed files with 27 additions and 1 deletions
|
|
@ -182,6 +182,7 @@ const {
|
|||
editBranchById,
|
||||
fetchListCustomeBranch,
|
||||
fetchListCustomeBranchById,
|
||||
deleteBranchById,
|
||||
} = userCustomer;
|
||||
const flowStore = useFlowStore();
|
||||
const employeeStore = useEmployeeStore();
|
||||
|
|
@ -1041,6 +1042,25 @@ async function onSubmitEmployee(
|
|||
});
|
||||
}
|
||||
|
||||
async function deleteByIdBranch(id: string, indexTab: number) {
|
||||
dialog({
|
||||
color: 'info',
|
||||
icon: 'mdi-alert',
|
||||
title: t('saveConfirmTitle'),
|
||||
actionText: t('ok'),
|
||||
persistent: true,
|
||||
message: t('saveConfirmMessage'),
|
||||
action: async () => {
|
||||
await deleteBranchById(id);
|
||||
|
||||
formData.value.customerBranch?.splice(indexTab, 1);
|
||||
|
||||
flowStore.rotate();
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
}
|
||||
|
||||
async function onSubmitBasicInformation() {
|
||||
if (selectorLabel.value === 'EMPLOYER') {
|
||||
dialog({
|
||||
|
|
@ -1085,10 +1105,15 @@ async function onSubmitCustomerBranch(opt: { isClearForm: boolean }) {
|
|||
formData.value.customerBranch !== undefined &&
|
||||
formData.value.customerBranch[indexTab.value] !== undefined
|
||||
) {
|
||||
await createBranch({
|
||||
const res = await createBranch({
|
||||
...formData.value.customerBranch[indexTab.value],
|
||||
customerId: currentCustomerId.value,
|
||||
});
|
||||
|
||||
if (res) {
|
||||
formData.value.customerBranch[indexTab.value].id = res.id;
|
||||
formData.value.customerBranch[indexTab.value].statusSave = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
cancel: () => {},
|
||||
|
|
@ -3285,6 +3310,7 @@ watch(isMainPage, () => {
|
|||
v-model:customer-branch="formData.customerBranch"
|
||||
v-model:tab-index="indexTab"
|
||||
@save="() => onSubmitCustomerBranch({ isClearForm: false })"
|
||||
@remove="(indexTab, id) => deleteByIdBranch(id, indexTab)"
|
||||
>
|
||||
<template #address>
|
||||
<FormAddress
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue