refactor: update customer form dialog

This commit is contained in:
Methapon2001 2024-08-08 10:33:29 +07:00
parent 8cca5f7e7d
commit ba90a6534e

View file

@ -52,6 +52,7 @@ import FormEmployeeOther from 'src/components/03_customer-management/FormEmploye
import useOptionStore from 'src/stores/options'; import useOptionStore from 'src/stores/options';
import { DialogContainer, DialogHeader } from 'src/components/dialog'; import { DialogContainer, DialogHeader } from 'src/components/dialog';
const { t, locale } = useI18n(); const { t, locale } = useI18n();
const $q = useQuasar(); const $q = useQuasar();
const route = useRoute(); const route = useRoute();
@ -1787,20 +1788,28 @@ watch(
> >
<template #header> <template #header>
<DialogHeader <DialogHeader
:title="$t(`form.title.create`, { name: $t('customer.employer') })" :title="
$t(`form.title.${customerFormState.dialogType}`, {
name: $t('customer.employer'),
})
"
> >
<!-- <template #title-after>{{ customerFormState.editCustomerId }}</template> --> <template
v-if="
customerFormState.dialogType !== 'create' &&
customerFormState.editCustomerCode
"
#title-after
>
{{ customerFormState.editCustomerCode }}
</template>
</DialogHeader> </DialogHeader>
</template> </template>
<div class="q-px-lg q-pt-lg surface-2"> <div class="q-px-lg q-pt-lg surface-2">
<ProfileBanner <ProfileBanner
active active
v-model:cover-url="customerFormState.customerImageUrl" hide-fade
:hide-fade="
customerFormState.customerImageUrl === '' ||
customerFormState.customerImageUrl === null
"
:fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`" :fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`"
:img=" :img="
customerFormState.customerImageUrl || customerFormState.customerImageUrl ||
@ -1871,13 +1880,17 @@ watch(
<EmployerFormBasicInfo <EmployerFormBasicInfo
class="q-mb-xl" class="q-mb-xl"
:readonly=" :readonly="
customerFormState.dialogType === 'edit' && (customerFormState.dialogType === 'edit' &&
customerFormState.readonly === true customerFormState.readonly === true) ||
customerFormState.dialogType === 'info'
" "
:action-disabled="customerFormState.branchIndex !== -1" :action-disabled="customerFormState.branchIndex !== -1"
id="form-basic-info-customer" id="form-basic-info-customer"
:create="customerFormState.dialogType === 'create'" :create="customerFormState.dialogType === 'create'"
@edit="customerFormState.readonly = false" @edit="
(customerFormState.dialogType = 'edit'),
(customerFormState.readonly = false)
"
@cancel="() => customerFormUndo(false)" @cancel="() => customerFormUndo(false)"
@delete=" @delete="
customerFormState.editCustomerId && customerFormState.editCustomerId &&
@ -2264,11 +2277,7 @@ watch(
clear-button clear-button
@save=" @save="
async (v) => { async (v) => {
if ( if (v && customerFormState.editCustomerId) {
v &&
customerFormState.dialogType === 'edit' &&
customerFormState.editCustomerId
) {
await customerStore.setImage(customerFormState.editCustomerId, v); await customerStore.setImage(customerFormState.editCustomerId, v);
await fetchListCustomer(); await fetchListCustomer();
customerFormState.imageDialog = false; customerFormState.imageDialog = false;