feat: toggle able edit

This commit is contained in:
Methapon2001 2024-08-05 15:57:05 +07:00
parent f0be0b2147
commit 6e43b504be

View file

@ -229,6 +229,7 @@ function deleteCustomerById(id: string) {
await customerStore.deleteById(id); await customerStore.deleteById(id);
await fetchListCustomer(true); await fetchListCustomer(true);
customerFormState.value.dialogModal = false;
flowStore.rotate(); flowStore.rotate();
}, },
cancel: () => {}, cancel: () => {},
@ -1636,6 +1637,19 @@ function createCustomerForm(customerType: 'CORP' | 'PERS') {
<DialogForm <DialogForm
v-model:modal="customerFormState.dialogModal" v-model:modal="customerFormState.dialogModal"
:title="$t('form.title.create', { name: 'Employer' })" :title="$t('form.title.create', { name: 'Employer' })"
:edit="customerFormState.dialogType === 'edit'"
:isEdit="customerFormState.editReadonly === false"
:undo="
() => (
customerFormStore.resetForm(), (customerFormState.editReadonly = true)
)
"
:deleteData="
() =>
customerFormState.editCustomerId &&
deleteCustomerById(customerFormState.editCustomerId)
"
:editData="() => (customerFormState.editReadonly = false)"
:show=" :show="
async () => async () =>
await fetchListOfOptionBranch().then(() => { await fetchListOfOptionBranch().then(() => {
@ -1732,7 +1746,6 @@ function createCustomerForm(customerType: 'CORP' | 'PERS') {
<!-- label="Save" --> <!-- label="Save" -->
<!-- /> --> <!-- /> -->
</DialogForm> </DialogForm>
<ImageUploadDialog <ImageUploadDialog
ref="dialogCustomerImageUpload" ref="dialogCustomerImageUpload"
v-model:dialog-state="customerFormState.imageDialog" v-model:dialog-state="customerFormState.imageDialog"
@ -1743,7 +1756,7 @@ function createCustomerForm(customerType: 'CORP' | 'PERS') {
!customerFormState.customerImageUrl || !customerFormState.customerImageUrl ||
customerFormState.dialogType === 'edit' customerFormState.dialogType === 'edit'
" "
:fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`" :fallback-url="`/images/customer-${customerFormData.customerType}-avartar.png`"
clear-button clear-button
@save="() => {}" @save="() => {}"
></ImageUploadDialog> ></ImageUploadDialog>