fix: do not close on undo

This commit is contained in:
Methapon2001 2024-08-06 14:22:22 +07:00
parent de7346c9f5
commit 74a26a0586

View file

@ -406,7 +406,7 @@ async function editCustomerForm(id: string) {
customerFormState.value.editCustomerId = id; customerFormState.value.editCustomerId = id;
} }
function customerConfirmUnsave() { function customerConfirmUnsave(close = true) {
dialog({ dialog({
color: 'warning', color: 'warning',
icon: 'mdi-alert', icon: 'mdi-alert',
@ -417,15 +417,15 @@ function customerConfirmUnsave() {
action: () => { action: () => {
customerFormStore.resetForm(); customerFormStore.resetForm();
customerFormState.value.editReadonly = true; customerFormState.value.editReadonly = true;
customerFormState.value.dialogModal = false; customerFormState.value.dialogModal = !close;
}, },
cancel: () => {}, cancel: () => {},
}); });
} }
function customerFormUndo() { function customerFormUndo(close = true) {
if (customerFormStore.isFormDataDifferent()) { if (customerFormStore.isFormDataDifferent()) {
return customerConfirmUnsave(); return customerConfirmUnsave(close);
} }
customerFormStore.resetForm(); customerFormStore.resetForm();
customerFormState.value.editReadonly = true; customerFormState.value.editReadonly = true;
@ -1698,8 +1698,8 @@ function createEmployeeForm() {
" "
:edit="customerFormState.dialogType === 'edit'" :edit="customerFormState.dialogType === 'edit'"
:isEdit="customerFormState.editReadonly === false" :isEdit="customerFormState.editReadonly === false"
:undo="() => customerFormUndo()" :undo="() => customerFormUndo(false)"
:deleteData=" :delete-data="
() => () =>
customerFormState.editCustomerId && customerFormState.editCustomerId &&
deleteCustomerById(customerFormState.editCustomerId) deleteCustomerById(customerFormState.editCustomerId)