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