refactor: edit name defineModel

This commit is contained in:
Thanaphon Frappet 2024-10-02 14:04:23 +07:00
parent 882b5fb753
commit d7a99d2ee2
13 changed files with 241 additions and 269 deletions

View file

@ -735,22 +735,24 @@ watch([customerId, inputSearch, currentStatus], async () => {
"
:customer-type="customerType"
v-model:citizen-id="customerBranchFormData.citizenId"
v-model:prefixName="customerBranchFormData.namePrefix"
v-model:firstName="customerBranchFormData.firstName"
v-model:lastName="customerBranchFormData.lastName"
v-model:firstNameEN="customerBranchFormData.firstNameEN"
v-model:lastNameEN="customerBranchFormData.lastNameEN"
v-model:prefix-name="customerBranchFormData.namePrefix"
v-model:first-name="customerBranchFormData.firstName"
v-model:last-name="customerBranchFormData.lastName"
v-model:first-name-en="customerBranchFormData.firstNameEN"
v-model:last-name-en="customerBranchFormData.lastNameEN"
v-model:gender="customerBranchFormData.gender"
v-model:birthDate="customerBranchFormData.birthDate"
v-model:customerName="customerBranchFormData.customerName"
v-model:legalPersonNo="customerBranchFormData.legalPersonNo"
v-model:branchCode="customerBranchFormData.code"
v-model:registerName="customerBranchFormData.registerName"
v-model:registerNameEN="customerBranchFormData.registerNameEN"
v-model:registerDate="customerBranchFormData.registerDate"
v-model:authorizedCapital="customerBranchFormData.authorizedCapital"
v-model:telephoneNo="customerBranchFormData.telephoneNo"
v-model:codeCustomer="customerBranchFormData.codeCustomer"
v-model:birth-date="customerBranchFormData.birthDate"
v-model:customer-name="customerBranchFormData.customerName"
v-model:legal-person-no="customerBranchFormData.legalPersonNo"
v-model:branch-code="customerBranchFormData.code"
v-model:register-name="customerBranchFormData.registerName"
v-model:register-name-en="customerBranchFormData.registerNameEN"
v-model:register-date="customerBranchFormData.registerDate"
v-model:authorized-capital="
customerBranchFormData.authorizedCapital
"
v-model:telephone-no="customerBranchFormData.telephoneNo"
v-model:code-customer="customerBranchFormData.codeCustomer"
/>
<div
class="row q-col-gutter-sm q-mb-sm"
@ -800,9 +802,7 @@ watch([customerId, inputSearch, currentStatus], async () => {
prefix-id="employer-branch"
:readonly="customerBranchFormState.dialogType === 'info'"
v-model:authorized-name="customerBranchFormData.authorizedName"
v-model:authorized-name-e-n="
customerBranchFormData.authorizedNameEN
"
v-model:authorized-name-en="customerBranchFormData.authorizedNameEN"
/>
<div class="row q-col-gutter-sm q-mb-sm" id="employer-branch-address">
<div class="col-12 text-weight-bold text-body1 row items-center">
@ -861,10 +861,10 @@ watch([customerId, inputSearch, currentStatus], async () => {
<EmployerFormContact
class="q-mb-lg"
:readonly="customerBranchFormState.dialogType === 'info'"
v-model:contactName="customerBranchFormData.contactName"
v-model:contact-name="customerBranchFormData.contactName"
v-model:email="customerBranchFormData.email"
v-model:contactTel="customerBranchFormData.contactTel"
v-model:officeTel="customerBranchFormData.officeTel"
v-model:contact-tel="customerBranchFormData.contactTel"
v-model:office-tel="customerBranchFormData.officeTel"
v-model:agent="customerBranchFormData.agent"
/>
</div>

View file

@ -807,7 +807,7 @@ const emptyCreateDialog = ref(false);
<div class="scroll">
<StatCardComponent
v-if="customerStats"
labelI18n
label-i18n
:branch="
customerStats &&
(currentTab === 'employer'
@ -1284,25 +1284,6 @@ const emptyCreateDialog = ref(false);
</q-tooltip>
</q-td>
<q-td v-if="fieldSelected.includes('address')">
{{
locale === 'eng'
? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` ||
'-'
: `${props.row.branch[0].address}, ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo},`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi},`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street},`} ${props.row.branch[0].subDistrict.name}, ${props.row.branch[0].district.name}, ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` ||
'-'
}}
<q-tooltip>
{{
locale === 'eng'
? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` ||
'-'
: `${props.row.branch[0].address}, ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo},`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi},`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street},`} ${props.row.branch[0].subDistrict.name}, ${props.row.branch[0].district.name}, ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` ||
'-'
}}
</q-tooltip>
</q-td>
<q-td v-if="fieldSelected.includes('contactName')">
{{ props.row.branch[0]?.contactName || '-' }}
</q-td>
@ -1444,7 +1425,7 @@ const emptyCreateDialog = ref(false);
<template v-slot:item="props">
<div class="col-12 col-md-6">
<BranchCard
i18nKey="customer.table"
i18n-key="customer.table"
class="surface-1"
:virtual-branch="props.row.virtual"
:id="`branch-card-${props.row.name}`"
@ -1575,7 +1556,7 @@ const emptyCreateDialog = ref(false);
<template v-slot:action>
<KebabAction
:status="props.row.status"
:idName="props.row.name"
:id-name="props.row.name"
@view="
() => {
const { branch, ...payload } = props.row;
@ -2082,19 +2063,23 @@ const emptyCreateDialog = ref(false);
"
:customer-type="customerFormData.customerType"
v-model:registered-branch-id="customerFormData.registeredBranchId"
v-model:customerName="customerNameInfo"
v-model:registerName="
v-model:customer-name="customerNameInfo"
v-model:register-name="
customerFormData.customerBranch[0].registerName
"
v-model:citizenId="customerFormData.customerBranch[0].citizenId"
v-model:legalPersonNo="
v-model:citizen-id="customerFormData.customerBranch[0].citizenId"
v-model:legal-person-no="
customerFormData.customerBranch[0].legalPersonNo
"
v-model:businessType="
v-model:business-type="
customerFormData.customerBranch[0].businessType
"
v-model:jobPosition="customerFormData.customerBranch[0].jobPosition"
v-model:telephoneNo="customerFormData.customerBranch[0].telephoneNo"
v-model:job-position="
customerFormData.customerBranch[0].jobPosition
"
v-model:telephone-no="
customerFormData.customerBranch[0].telephoneNo
"
v-model:branch-options="registerAbleBranchOption"
/>
<div class="row q-col-gutter-sm" id="form-branch-customer-branch">
@ -2554,15 +2539,15 @@ const emptyCreateDialog = ref(false);
title="customerEmployee.form.group.personalInfo"
:readonly="!employeeFormState.isEmployeeEdit"
v-model:open="employeeFormState.dialogModal"
v-model:prefixName="currentFromDataEmployee.namePrefix"
v-model:firstName="currentFromDataEmployee.firstName"
v-model:lastName="currentFromDataEmployee.lastName"
v-model:firstNameEN="currentFromDataEmployee.firstNameEN"
v-model:lastNameEN="currentFromDataEmployee.lastNameEN"
v-model:midName="currentFromDataEmployee.middleName"
v-model:midNameEN="currentFromDataEmployee.middleNameEN"
v-model:prefix-name="currentFromDataEmployee.namePrefix"
v-model:first-name="currentFromDataEmployee.firstName"
v-model:last-name="currentFromDataEmployee.lastName"
v-model:first-name-en="currentFromDataEmployee.firstNameEN"
v-model:last-name-en="currentFromDataEmployee.lastNameEN"
v-model:mid-name="currentFromDataEmployee.middleName"
v-model:mid-name-en="currentFromDataEmployee.middleNameEN"
v-model:gender="currentFromDataEmployee.gender"
v-model:birthDate="currentFromDataEmployee.dateOfBirth"
v-model:birth-date="currentFromDataEmployee.dateOfBirth"
v-model:nationality="currentFromDataEmployee.nationality"
class="q-mb-xl"
/>
@ -2782,14 +2767,14 @@ const emptyCreateDialog = ref(false);
dense
outlined
v-model:current-index="employeeFormState.currentIndex"
v-model:employeeCheckup="currentFromDataEmployee.employeeCheckup"
v-model:checkupTypeOption="
v-model:employee-checkup="currentFromDataEmployee.employeeCheckup"
v-model:checkup-type-option="
optionStore.globalOption.insurancePlace
"
v-model:medicalBenefitOption="
v-model:medical-benefit-option="
optionStore.globalOption.typeInsurance
"
v-model:insuranceCompanyOption="
v-model:insurance-company-option="
optionStore.globalOption.insurancePlace
"
@delete="
@ -2917,7 +2902,7 @@ const emptyCreateDialog = ref(false);
v-model:on-create-data-list="onCreateImageList"
:on-create="customerFormState.dialogModal"
:default-url="customerFormState.defaultCustomerImageUrl"
:hiddenFooter="!customerFormState.isImageEdit"
:hidden-footer="!customerFormState.isImageEdit"
@add-image="
async (v) => {
if (!v) return;
@ -3027,7 +3012,7 @@ const emptyCreateDialog = ref(false);
v-model:data-list="imageList"
v-model:on-create-data-list="onCreateImageList"
:on-create="employeeFormState.dialogModal"
:hiddenFooter="!employeeFormState.isImageEdit"
:hidden-footer="!employeeFormState.isImageEdit"
@add-image="
async (v) => {
if (!v) return;
@ -3116,12 +3101,12 @@ const emptyCreateDialog = ref(false);
? customerFormData.customerBranch[0]?.registerName
: customerNameInfo
"
:badgeLabel="
:badge-label="
customerFormData.customerType === 'CORP'
? $t('customer.employerLegalEntity')
: $t('customer.employerNaturalPerson')
"
:badgeStyle="
:badge-style="
customerFormData.customerType === 'CORP'
? `color: var(--${$q.dark.isActive ? 'violet-10' : 'violet-11'}); background: hsl(var(--${$q.dark.isActive ? 'violet-10-hsl' : 'violet-11-hsl'})/0.15)`
: `color: var(--${$q.dark.isActive ? 'teal-8' : 'teal-10'}); background: hsl(var(--${$q.dark.isActive ? 'teal-8-hsl' : 'teal-10-hsl'})/0.15)`
@ -3171,17 +3156,17 @@ const emptyCreateDialog = ref(false);
v-if="customerFormData.customerBranch !== undefined"
:active="customerFormData.status !== 'INACTIVE'"
hide-fade
useToggle
use-toggle
v-model:toggle-status="customerFormData.status"
:menu="formMenuIcon"
:toggleTitle="$t('status.title')"
:toggle-title="$t('status.title')"
:fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`"
:img="
`${baseUrl}/customer/${customerFormState.editCustomerId}/image/${customerFormData.selectedImage}`.concat(
refreshImageState ? `?ts=${Date.now()}` : '',
) || null
"
:fallbackImg="`/images/customer-${customerFormData.customerType}-avartar-${customerFormData.customerType === 'PERS' ? customerFormData.customerBranch[0]?.gender : 'male'}.png`"
:fallback-img="`/images/customer-${customerFormData.customerType}-avartar-${customerFormData.customerType === 'PERS' ? customerFormData.customerBranch[0]?.gender : 'male'}.png`"
:color="`hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/1)`"
:bg-color="`hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/0.1)`"
:icon="
@ -3315,39 +3300,26 @@ const emptyCreateDialog = ref(false);
"
:customer-type="customerFormData.customerType"
v-model:registered-branch-id="customerFormData.registeredBranchId"
v-model:customerName="customerNameInfo"
v-model:registerName="
v-model:customer-name="customerNameInfo"
v-model:register-name="
customerFormData.customerBranch[0].registerName
"
v-model:citizenId="customerFormData.customerBranch[0].citizenId"
v-model:legalPersonNo="
v-model:citizen-id="customerFormData.customerBranch[0].citizenId"
v-model:legal-person-no="
customerFormData.customerBranch[0].legalPersonNo
"
v-model:businessType="
v-model:business-type="
customerFormData.customerBranch[0].businessType
"
v-model:jobPosition="
v-model:job-position="
customerFormData.customerBranch[0].jobPosition
"
v-model:telephoneNo="
v-model:telephone-no="
customerFormData.customerBranch[0].telephoneNo
"
v-model:branch-options="registerAbleBranchOption"
/>
<!-- <div class="row q-col-gutter-sm q-mb-xl">
<UploadFile
id="form-upload-file-customer"
class="q-mb-xl"
hide-action
:dropdown-list="uploadFileList"
v-model:file="customerFormState.file"
@send-ocr="
(group: any, file: any) => ocrStore.sendOcr({ file })
"
/>
</div> -->
<div class="row q-col-gutter-sm" id="form-branch-customer-branch">
<div
class="col-12 text-weight-bold text-body1 row items-center q-mt-lg"
@ -3465,7 +3437,7 @@ const emptyCreateDialog = ref(false);
"
>
<EmployerFormBranch
prefixId="info"
prefix-id="info"
v-if="!!customerFormState.editCustomerId"
:index="idx"
:hide-action="customerFormData.status === 'INACTIVE'"
@ -3528,7 +3500,7 @@ const emptyCreateDialog = ref(false);
: `${employeeFormState.currentEmployee.firstName} ${employeeFormState.currentEmployee.lastName}`
: '-'
"
:badgeClass="
:badge-class="
currentFromDataEmployee.gender === 'male'
? 'app-bg-male text-white'
: currentFromDataEmployee.gender === 'female'
@ -3794,15 +3766,15 @@ const emptyCreateDialog = ref(false);
separator
title="customerEmployee.form.group.personalInfo"
:readonly="!employeeFormState.isEmployeeEdit"
v-model:prefixName="currentFromDataEmployee.namePrefix"
v-model:firstName="currentFromDataEmployee.firstName"
v-model:lastName="currentFromDataEmployee.lastName"
v-model:firstNameEN="currentFromDataEmployee.firstNameEN"
v-model:lastNameEN="currentFromDataEmployee.lastNameEN"
v-model:midName="currentFromDataEmployee.middleName"
v-model:midNameEN="currentFromDataEmployee.middleNameEN"
v-model:prefix-name="currentFromDataEmployee.namePrefix"
v-model:first-ame="currentFromDataEmployee.firstName"
v-model:last-name="currentFromDataEmployee.lastName"
v-model:first-name-en="currentFromDataEmployee.firstNameEN"
v-model:last-name-en="currentFromDataEmployee.lastNameEN"
v-model:mid-name="currentFromDataEmployee.middleName"
v-model:mid-name-en="currentFromDataEmployee.middleNameEN"
v-model:gender="currentFromDataEmployee.gender"
v-model:birthDate="currentFromDataEmployee.dateOfBirth"
v-model:birth-date="currentFromDataEmployee.dateOfBirth"
v-model:nationality="currentFromDataEmployee.nationality"
class="q-mb-xl"
/>
@ -4034,7 +4006,7 @@ const emptyCreateDialog = ref(false);
v-model:medical-benefit-option="
optionStore.globalOption.typeInsurance
"
v-model:insuranceCompanyOption="
v-model:insurance-company-option="
optionStore.globalOption.insurancePlace
"
@save="

View file

@ -23,8 +23,8 @@ const citizenId = defineModel<string | undefined>('citizenId', {});
const prefixName = defineModel<string | null>('prefixName');
const firstName = defineModel<string>('firstName');
const lastName = defineModel<string>('lastName');
const firstNameEN = defineModel<string>('firstNameEN');
const lastNameEN = defineModel<string>('lastNameEN');
const firstNameEN = defineModel<string>('firstNameEn');
const lastNameEN = defineModel<string>('lastNameEn');
const gender = defineModel<string>('gender');
const birthDate = defineModel<Date | string | null>('birthDate');
@ -33,7 +33,7 @@ const customerName = defineModel<string>('customerName');
const legalPersonNo = defineModel<string | undefined>('legalPersonNo', {});
const branchCode = defineModel<string | undefined>('branchCode', {});
const registerName = defineModel<string | undefined>('registerName', {});
const registerNameEN = defineModel<string | undefined>('registerNameEN', {});
const registerNameEN = defineModel<string | undefined>('registerNameEn', {});
const registerDate = defineModel<string | Date | null>('registerDate');
const authorizedCapital = defineModel<string>('authorizedCapital', {
default: '0',

View file

@ -4,7 +4,7 @@ defineProps<{
prefixId?: string;
}>();
const authorizedName = defineModel<string>('authorizedName');
const authorizedNameEN = defineModel<string>('authorizedNameEN');
const authorizedNameEN = defineModel<string>('authorizedNameEn');
</script>
<template>

View file

@ -6,7 +6,6 @@ import EmployerFormContact from './EmployerFormContact.vue';
import { CustomerCreate } from 'stores/customer/types';
import EmployerFormAbout from './EmployerFormAbout.vue';
import EmployerFormAuthorized from './EmployerFormAuthorized.vue';
import { useCustomerForm } from 'src/pages/03_customer-management/form';
import { waitAll } from 'src/stores/utils';
import {
FormCitizen,
@ -25,7 +24,6 @@ import {
} from 'components/button';
import { UploadFileGroup } from 'src/components/upload-file/';
import { uploadFileListCustomer, columnsAttachment } from '../../constant';
import { group } from 'node:console';
const ocrStore = useOcrStore();
const customerStore = useCustomerStore();
@ -135,22 +133,22 @@ withDefaults(
:readonly="readonly"
:customer-type="customerType"
v-model:citizen-id="item.citizenId"
v-model:prefixName="item.namePrefix"
v-model:firstName="item.firstName"
v-model:lastName="item.lastName"
v-model:firstNameEN="item.firstNameEN"
v-model:lastNameEN="item.lastNameEN"
v-model:prefix-name="item.namePrefix"
v-model:first-name="item.firstName"
v-model:last-name="item.lastName"
v-model:first-name-en="item.firstNameEN"
v-model:last-name-en="item.lastNameEN"
v-model:gender="item.gender"
v-model:birthDate="item.birthDate"
v-model:customerName="item.customerName"
v-model:legalPersonNo="item.legalPersonNo"
v-model:branchCode="item.code"
v-model:registerName="item.registerName"
v-model:registerNameEN="item.registerNameEN"
v-model:registerDate="item.registerDate"
v-model:authorizedCapital="item.authorizedCapital"
v-model:telephoneNo="item.telephoneNo"
v-model:codeCustomer="item.codeCustomer"
v-model:birth-date="item.birthDate"
v-model:customer-name="item.customerName"
v-model:legal-person-no="item.legalPersonNo"
v-model:branch-code="item.code"
v-model:register-name="item.registerName"
v-model:register-name-en="item.registerNameEN"
v-model:register-date="item.registerDate"
v-model:authorized-capital="item.authorizedCapital"
v-model:telephone-no="item.telephoneNo"
v-model:code-customer="item.codeCustomer"
/>
</q-tab-panel>
<q-tab-panel name="business">
@ -163,7 +161,7 @@ withDefaults(
v-model:job-position="item.jobPosition"
v-model:job-description="item.jobDescription"
v-model:pay-date="item.payDate"
v-model:pay-date-e-n="item.payDateEN"
v-model:pay-date-en="item.payDateEN"
v-model:wage-rate="item.wageRate"
v-model:wage-rate-text="item.wageRateText"
/>
@ -173,7 +171,7 @@ withDefaults(
:prefix-id="prefixId || 'employer'"
:readonly="readonly"
v-model:authorized-name="item.authorizedName"
v-model:authorized-name-e-n="item.authorizedNameEN"
v-model:authorized-name-en="item.authorizedNameEN"
/>
</q-tab-panel>
<q-tab-panel name="address">
@ -207,10 +205,10 @@ withDefaults(
<EmployerFormContact
:readonly="readonly"
:prefixId="prefixId"
v-model:contactName="item.contactName"
v-model:contact-name="item.contactName"
v-model:email="item.email"
v-model:contactTel="item.contactTel"
v-model:officeTel="item.officeTel"
v-model:contact-tel="item.contactTel"
v-model:office-tel="item.officeTel"
v-model:agent="item.agent"
/>
</q-tab-panel>

View file

@ -12,7 +12,7 @@ const bussinessType = defineModel<string>('bussinessType');
const jobPosition = defineModel<string>('jobPosition');
const jobDescription = defineModel<string>('jobDescription');
const payDate = defineModel<string>('payDate');
const payDateEN = defineModel<string>('payDateEN');
const payDateEN = defineModel<string>('payDateEn');
const wageRate = defineModel<number | string>('wageRate');
const wageRateText = defineModel<string>('wageRateText');