fix(01): remove sub branch submit abbreviation dialog

This commit is contained in:
puriphatt 2024-08-14 13:10:47 +07:00
parent ab0abac873
commit a53fad7aeb

View file

@ -534,41 +534,46 @@ async function onSubmit() {
}
if (formType.value === 'create') {
dialog({
color: 'info',
icon: 'mdi-message-processing-outline',
message: t('form.info.cantChange', {
field: t('formDialogHqAbbreviation'),
name: formData.value.code,
}),
actionText: t('agree'),
persistent: true,
title: t('form.warning.title'),
cancel: () => {},
action: async () => {
if (formTypeBranch.value === 'subBranch') {
const currentRecord = branchData.value.result.find(
(x) => x.id === formData.value.headOfficeId,
);
const createBranch = async () => {
await branchStore.create(
{
...formData.value,
qrCodeImage: profileFile.value,
imageUrl: profileFileImg.value,
},
formBankBook.value,
);
formData.value.headOfficeId = currentRecord?.id;
formData.value.code = formData.value.code?.slice(0, -6);
delete formData.value['codeHeadOffice'];
}
await branchStore.fetchList({ pageSize: 99999 });
modal.value = false;
};
await branchStore.create(
{
...formData.value,
qrCodeImage: profileFile.value,
imageUrl: profileFileImg.value,
},
formBankBook.value,
);
if (formTypeBranch.value === 'subBranch') {
const currentRecord = branchData.value.result.find(
(x) => x.id === formData.value.headOfficeId,
);
await branchStore.fetchList({ pageSize: 99999 });
modal.value = false;
},
});
formData.value.headOfficeId = currentRecord?.id;
formData.value.code = formData.value.code?.slice(0, -6);
delete formData.value['codeHeadOffice'];
await createBranch();
} else {
dialog({
color: 'info',
icon: 'mdi-message-processing-outline',
message: t('form.info.cantChange', {
field: t('formDialogHqAbbreviation'),
name: formData.value.code,
}),
actionText: t('agree'),
persistent: true,
title: t('form.warning.title'),
cancel: () => {},
action: async () => {
await createBranch();
},
});
}
}
const _stats = await branchStore.stats();
@ -852,10 +857,11 @@ watch(currentHq, () => {
@edit="
(v) => {
if (v.isHeadOffice) {
triggerEdit('form', v.id, 'headOffice', v.code);
triggerEdit('drawer', v.id, 'headOffice', v.code);
} else {
triggerEdit('form', v.id, 'subBranch');
triggerEdit('drawer', v.id, 'subBranch');
}
formType = 'edit';
}
"
@delete="
@ -1237,15 +1243,14 @@ watch(currentHq, () => {
'headOffice',
props.row.code,
);
formType = 'edit';
} else {
await triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
formType = 'edit';
}
formType = 'edit';
}
"
>
@ -1449,15 +1454,14 @@ watch(currentHq, () => {
'headOffice',
props.row.code,
);
formType = 'edit';
} else {
await triggerEdit(
'drawer',
props.row.id,
'subBranch',
);
formType = 'edit';
}
formType = 'edit';
}
"
>
@ -1999,12 +2003,11 @@ watch(currentHq, () => {
'headOffice',
currentNode.code,
);
formType = 'edit';
} else {
currentNode &&
triggerEdit('drawer', currentNode.id, 'subBranch');
formType = 'edit';
}
formType = 'edit';
}
"
>