From f8b56fd37e5f980203a082fe7de039fab2f9eee9 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Mon, 31 Mar 2025 15:42:27 +0700 Subject: [PATCH 01/24] refactor: remove unnecessary watch on tab value in CanvasComponent --- src/components/CanvasComponent.vue | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/components/CanvasComponent.vue b/src/components/CanvasComponent.vue index 72e63c4d..66996697 100644 --- a/src/components/CanvasComponent.vue +++ b/src/components/CanvasComponent.vue @@ -93,13 +93,6 @@ function clearUpload() { imgUrl.value = ''; } -watch( - () => tab.value, - async () => { - await initializeSignaturePad(); - }, -); - onMounted(async () => { await initializeSignaturePad(); }); From 2d94d163d2f1d11ae0229fc3252a750f833b7f8d Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 2 Apr 2025 15:35:02 +0700 Subject: [PATCH 02/24] fix: change prefix effect gender and wrong prefix selected --- src/components/02_personnel-management/FormPerson.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/02_personnel-management/FormPerson.vue b/src/components/02_personnel-management/FormPerson.vue index cfc6dff8..5fa321b6 100644 --- a/src/components/02_personnel-management/FormPerson.vue +++ b/src/components/02_personnel-management/FormPerson.vue @@ -55,7 +55,9 @@ let nationalityFilter: ( function matPreFixName() { if (gender.value === 'male') prefixName.value = 'mr'; - if (gender.value === 'female') prefixName.value = 'mrs'; + if (gender.value === 'female' && prefixName.value === 'mr') { + prefixName.value = 'mrs'; + } } onMounted(() => { From c8b4339cf632381fafb222034c63ba9ba424963e Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Thu, 3 Apr 2025 11:05:31 +0700 Subject: [PATCH 03/24] refactor: edit i18n --- src/i18n/tha.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 5ce04f74..f7bf121c 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -780,7 +780,7 @@ export default { branch: 'สาขาที่ออกใบเสนอราคา', branchVirtual: 'จุดรับบริการที่ออกใบเสนอราคา', customer: 'ลูกค้า', - newCustomer: 'แรงงานใหม่', + newCustomer: 'ลูกค้าใหม่', employeeList: 'รายชื่อแรงงาน', employee: 'แรงงาน', employeeName: 'ชื่อ-นามสกุล แรงงาน', From 789502c1b2f9ac9643a8a3572e4c0bce0fb75ce3 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 3 Apr 2025 13:17:10 +0700 Subject: [PATCH 04/24] feat(i18n): add message for existing property name in English and Thai translations --- src/i18n/eng.ts | 1 + src/i18n/tha.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 858e9489..d3ddf4a4 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -1183,6 +1183,7 @@ export default { 'Product with the same name already exists. If you want to create with this name please select another code.', userExists: 'User already exits.', sameNameExists: 'Same name exists.', + samePropertyNameExists: 'Same property name exists.', validateError: 'Validate Error', codeMisMatch: 'Code Mismatch', diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index f7bf121c..5978bb7e 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -1163,6 +1163,7 @@ export default { 'สินค้าที่มีชื่อเดียวกันมีในระบบแล้ว หากคุณต้องการสร้างด้วยชื่อนี้โปรดเลือกรหัสอื่น', userExists: 'ชื่อผู้ใช้นี้มีอยู่ในระบบอยู่แล้ว', sameNameExists: 'ชื่อนี้ถูกใช้ไปแล้ว', + samePropertyNameExists: 'คุณสมบัตินี้มีอยู่ในระบบอยู่แล้ว', validateError: 'เกิดข้อผิดพลาดจากการตรวจสอบ', codeMisMatch: 'รหัสไม่ตรงกัน', From 12ec9146031e62589f678dc77a1f0928d79c0a4d Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 3 Apr 2025 13:18:15 +0700 Subject: [PATCH 05/24] feat(property): assign new property to global option property --- src/pages/04_property-managment/MainPage.vue | 33 ++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/pages/04_property-managment/MainPage.vue b/src/pages/04_property-managment/MainPage.vue index 7bb547cf..aa913f85 100644 --- a/src/pages/04_property-managment/MainPage.vue +++ b/src/pages/04_property-managment/MainPage.vue @@ -14,19 +14,22 @@ import { FloatingActionButton, PaginationComponent } from 'src/components'; import PaginationPageSize from 'src/components/PaginationPageSize.vue'; import PropertyDialog from './PropertyDialog.vue'; import { Property } from 'src/stores/property/types'; -import { dialog } from 'src/stores/utils'; +import { dialog, toCamelCase } from 'src/stores/utils'; import CreateButton from 'src/components/AddButton.vue'; +import useOptionStore from 'stores/options'; -const { t } = useI18n(); +const { t, locale } = useI18n(); const $q = useQuasar(); const navigatorStore = useNavigator(); const propertyStore = useProperty(); +const optionStore = useOptionStore(); const { data: propertyData, page: propertyPage, pageSize: propertyPageSize, pageMax: propertyPageMax, } = storeToRefs(propertyStore); +const { globalOption } = storeToRefs(optionStore); const currPropertyData = ref(); const formProperty = ref({ @@ -146,6 +149,7 @@ async function fetchPropertyList(mobileFetch?: boolean) { function triggerDialog(type: 'add' | 'edit' | 'view') { if (type === 'add') { + resetForm(); pageState.addModal = true; pageState.isDrawerEdit = true; } @@ -271,6 +275,31 @@ async function submit() { }); } await fetchPropertyList($q.screen.xs); + + // assign new property to global option + const propList = propertyData.value.map((v) => { + return { + label: locale.value === 'eng' ? v.nameEN : v.name, + value: toCamelCase(v.nameEN), + type: v.type.type, + }; + }); + + const existingValues = new Set( + globalOption.value.propertiesField.map( + (item: { value: string }) => item.value, + ), + ); + const newProps = propList.filter((prop) => !existingValues.has(prop.value)); + if (newProps) { + globalOption.value.propertiesField.splice( + globalOption.value.propertiesField.length - 4, + 0, + ...newProps, + ); + } + + currPropertyData.value; resetForm(); } From d5d95648b1aa41fc0f68e6c0411cea2871c406c0 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 3 Apr 2025 13:47:07 +0700 Subject: [PATCH 06/24] feat(option): add new option "CUST" to option lists in JSON --- public/option/option.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/option/option.json b/public/option/option.json index bce4fc0a..2d4991aa 100644 --- a/public/option/option.json +++ b/public/option/option.json @@ -154,7 +154,8 @@ { "label": "VS2", "value": "VS2" }, { "label": "WO", "value": "WO" }, { "label": "WP390", "value": "WP390" }, - { "label": "WP44", "value": "WP44" } + { "label": "WP44", "value": "WP44" }, + { "label": "CUST", "value": "CUST" } ], "prefix": [ @@ -1204,7 +1205,8 @@ { "label": "VS2", "value": "VS2" }, { "label": "WO", "value": "WO" }, { "label": "WP390", "value": "WP390" }, - { "label": "WP44", "value": "WP44" } + { "label": "WP44", "value": "WP44" }, + { "label": "CUST", "value": "CUST" } ], "prefix": [ From 18d5c4ff8271c685a2c418637e68cd1094c59c87 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Thu, 3 Apr 2025 18:02:51 +0700 Subject: [PATCH 07/24] refactor: set default data passport --- src/pages/03_customer-management/form.ts | 34 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/pages/03_customer-management/form.ts b/src/pages/03_customer-management/form.ts index 20ad37c0..b2ae9499 100644 --- a/src/pages/03_customer-management/form.ts +++ b/src/pages/03_customer-management/form.ts @@ -1183,7 +1183,19 @@ export const useEmployeeForm = defineStore('form-employee', () => { employeePassport: structuredClone( payload.employeePassport?.length === 0 ? state.value.dialogModal - ? defaultFormData.employeePassport + ? defaultFormData.employeePassport.map((v) => ({ + ...v, + namePrefix: payload.namePrefix, + firstName: payload.firstName, + firstNameEN: payload.firstNameEN, + middleName: payload.middleName, + middleNameEN: payload.middleNameEN, + lastName: payload.lastName, + lastNameEN: payload.lastNameEN, + gender: payload.gender, + nationality: payload.nationality, + birthDate: payload.dateOfBirth, + })) : [] : payload.employeePassport, ), @@ -1325,17 +1337,17 @@ export const useEmployeeForm = defineStore('form-employee', () => { issueDate: new Date(), type: '', expireDate: new Date(), - birthDate: new Date(), + birthDate: currentFromDataEmployee.value.dateOfBirth, workerStatus: '', - nationality: '', - gender: '', - lastNameEN: '', - lastName: '', - middleNameEN: '', - middleName: '', - firstNameEN: '', - firstName: '', - namePrefix: '', + nationality: currentFromDataEmployee.value.nationality, + gender: currentFromDataEmployee.value.gender, + lastNameEN: currentFromDataEmployee.value.lastNameEN, + lastName: currentFromDataEmployee.value.lastName, + middleNameEN: currentFromDataEmployee.value.middleNameEN, + middleName: currentFromDataEmployee.value.middleName, + firstNameEN: currentFromDataEmployee.value.firstNameEN, + firstName: currentFromDataEmployee.value.firstName, + namePrefix: currentFromDataEmployee.value.namePrefix, number: '', }); From 174c30875e9efddef9e5c51873c849b8eba7f02c Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Thu, 3 Apr 2025 18:05:18 +0700 Subject: [PATCH 08/24] fix: edit id upload --- src/pages/03_customer-management/MainPage.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index e0b5a4c9..8d962613 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -2940,7 +2940,7 @@ const emptyCreateDialog = ref(false); class="q-mb-xl" /> -
+
Date: Fri, 4 Apr 2025 10:51:26 +0700 Subject: [PATCH 09/24] feat(address): remove ',' and use addressFormat on BasicInformation(customer employee) --- .../employee/BasicInformation.vue | 52 +++++++++++++++---- src/utils/address.ts | 26 +++++----- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/components/03_customer-management/employee/BasicInformation.vue b/src/components/03_customer-management/employee/BasicInformation.vue index 98b42a12..f51eee79 100644 --- a/src/components/03_customer-management/employee/BasicInformation.vue +++ b/src/components/03_customer-management/employee/BasicInformation.vue @@ -11,6 +11,7 @@ import { } from 'components/button'; import { useI18n } from 'vue-i18n'; import useOptionStore from 'stores/options'; +import { formatAddress } from 'src/utils/address'; const { locale } = useI18n(); @@ -195,9 +196,20 @@ defineEmits<{ {{ $t('general.address') }} {{ - $i18n.locale === 'eng' - ? `${scope.opt.addressEN || ''}, ${scope.opt.mooEN && `${$t('form.moo')} ${scope.opt.mooEN},`} ${scope.opt.soiEN && `${$t('form.soi')} ${scope.opt.soiEN},`} ${scope.opt.streetEN && `${scope.opt.streetEN} Rd,`} ${scope.opt.subDistrict.nameEN || ''}, ${scope.opt.district.nameEN || ''}, ${scope.opt.province.nameEN || ''}` - : `${scope.opt.address || ''}, ${scope.opt.moo && `${$t('form.moo')} ${scope.opt.moo},`} ${scope.opt.soi && `${$t('form.soi')} ${scope.opt.soi},`} ${scope.opt.street && `${$t('form.road')} ${scope.opt.street},`} ${scope.opt.subDistrict.name || ''}, ${scope.opt.district.name || ''}, ${scope.opt.province.name || ''}` + formatAddress({ + address: scope.opt.address, + addressEN: scope.opt.addressEN, + moo: scope.opt.moo, + mooEN: scope.opt.mooEN, + soi: scope.opt.soi, + soiEN: scope.opt.soiEN, + street: scope.opt.street, + streetEN: scope.opt.streetEN, + subDistrict: scope.opt.subDistrict, + district: scope.opt.district, + province: scope.opt.province, + en: $i18n.locale === 'eng', + }) }} {{ scope.opt.subDistrict?.zipCode || '' }} @@ -252,9 +264,20 @@ defineEmits<{ {{ $t('general.address') }} {{ - $i18n.locale === 'eng' - ? `${scope.opt.addressEN || ''}, ${scope.opt.mooEN && `${$t('form.moo')} ${scope.opt.mooEN},`} ${scope.opt.soiEN && `${$t('form.soi')} ${scope.opt.soiEN},`} ${scope.opt.streetEN && `${scope.opt.streetEN} Rd,`} ${scope.opt.subDistrict.nameEN || ''}, ${scope.opt.district.nameEN || ''}, ${scope.opt.province.nameEN || ''}` - : `${scope.opt.address || ''}, ${scope.opt.moo && `${$t('form.moo')} ${scope.opt.moo},`} ${scope.opt.soi && `${$t('form.soi')} ${scope.opt.soi},`} ${scope.opt.street && `${$t('form.road')} ${scope.opt.street},`} ${scope.opt.subDistrict.name || ''}, ${scope.opt.district.name || ''}, ${scope.opt.province.name || ''}` + formatAddress({ + address: scope.opt.address, + addressEN: scope.opt.addressEN, + moo: scope.opt.moo, + mooEN: scope.opt.mooEN, + soi: scope.opt.soi, + soiEN: scope.opt.soiEN, + street: scope.opt.street, + streetEN: scope.opt.streetEN, + subDistrict: scope.opt.subDistrict, + district: scope.opt.district, + province: scope.opt.province, + en: $i18n.locale === 'eng', + }) }} {{ scope.opt.subDistrict?.zipCode || '' }} @@ -262,9 +285,20 @@ defineEmits<{ {{ $t('general.address') }} {{ - $i18n.locale === 'eng' - ? `${scope.opt.addressEN || ''}, ${scope.opt.mooEN && `${$t('form.moo')} ${scope.opt.mooEN},`} ${scope.opt.soiEN && `${$t('form.soi')} ${scope.opt.soiEN},`} ${scope.opt.streetEN && `${scope.opt.streetEN} Rd,`} ${scope.opt.subDistrict.nameEN || ''}, ${scope.opt.district.nameEN || ''}, ${scope.opt.province.nameEN || ''}` - : `${scope.opt.address || ''}, ${scope.opt.moo && `${$t('form.moo')} ${scope.opt.moo},`} ${scope.opt.soi && `${$t('form.soi')} ${scope.opt.soi},`} ${scope.opt.street && `${$t('form.road')} ${scope.opt.street},`} ${scope.opt.subDistrict.name || ''}, ${scope.opt.district.name || ''}, ${scope.opt.province.name || ''}` + formatAddress({ + address: scope.opt.address, + addressEN: scope.opt.addressEN, + moo: scope.opt.moo, + mooEN: scope.opt.mooEN, + soi: scope.opt.soi, + soiEN: scope.opt.soiEN, + street: scope.opt.street, + streetEN: scope.opt.streetEN, + subDistrict: scope.opt.subDistrict, + district: scope.opt.district, + province: scope.opt.province, + en: $i18n.locale === 'eng', + }) }} {{ scope.opt.subDistrict?.zipCode || '' }} diff --git a/src/utils/address.ts b/src/utils/address.ts index a66ac185..2ee2da4b 100644 --- a/src/utils/address.ts +++ b/src/utils/address.ts @@ -19,34 +19,34 @@ export function formatAddress(opt: { let addressParts: string[]; if (opt.en) { // en - addressParts = [`${opt.addressEN},`]; - if (opt.mooEN) addressParts.push(`Moo ${opt.mooEN},`); - if (opt.soiEN) addressParts.push(`Soi ${opt.soiEN},`); + addressParts = [`${opt.addressEN}`]; + if (opt.mooEN) addressParts.push(`Moo ${opt.mooEN}`); + if (opt.soiEN) addressParts.push(`Soi ${opt.soiEN}`); if (opt.streetEN) addressParts.push(`${opt.streetEN} Rd.`); if (opt.subDistrict) { - addressParts.push(`${opt.subDistrict.nameEN} sub-district,`); + addressParts.push(`${opt.subDistrict.nameEN} sub-district`); } - if (opt.district) addressParts.push(`${opt.district.nameEN} district,`); - if (opt.province) addressParts.push(`${opt.province.nameEN},`); + if (opt.district) addressParts.push(`${opt.district.nameEN} distric`); + if (opt.province) addressParts.push(`${opt.province.nameEN}`); } else { // th - addressParts = [`${opt.address},`]; - if (opt.moo) addressParts.push(`หมู่ ${opt.moo},`); - if (opt.soi) addressParts.push(`ซอย ${opt.soi},`); - if (opt.street) addressParts.push(`ถนน${opt.street},`); + addressParts = [`${opt.address}`]; + if (opt.moo) addressParts.push(`หมู่ ${opt.moo}`); + if (opt.soi) addressParts.push(`ซอย ${opt.soi}`); + if (opt.street) addressParts.push(`ถนน${opt.street}`); if (opt.subDistrict) { addressParts.push( - `${opt.province?.id === '10' ? 'แขวง' : 'ตำบล'}${opt.subDistrict.name},`, + `${opt.province?.id === '10' ? 'แขวง' : 'ตำบล'}${opt.subDistrict.name}`, ); } if (opt.district) { addressParts.push( - `${opt.province?.id === '10' ? 'เขต' : 'อำเภอ'}${opt.district.name},`, + `${opt.province?.id === '10' ? 'เขต' : 'อำเภอ'}${opt.district.name}`, ); } - if (opt.province) addressParts.push(`จังหวัด${opt.province.name},`); + if (opt.province) addressParts.push(`จังหวัด${opt.province.name}`); // addressParts.push( // `${opt.province.id === '10' ? t('address.subArea') : t('address.subDistrict')}${opt.subDistrict.name},`, // ); From 6f16964859a0c62b6399701684532e7352a639e7 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 4 Apr 2025 09:46:57 +0700 Subject: [PATCH 10/24] refactor: show option only eng --- .../03_customer-management/FormEmployeePassport.vue | 12 ++++++------ src/stores/options/index.ts | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/03_customer-management/FormEmployeePassport.vue b/src/components/03_customer-management/FormEmployeePassport.vue index 1eb9096d..5fe21b52 100644 --- a/src/components/03_customer-management/FormEmployeePassport.vue +++ b/src/components/03_customer-management/FormEmployeePassport.vue @@ -103,7 +103,7 @@ onMounted(() => { 'label', ); passportIssuingCountryFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption.nationality), + ref(optionStore.rawOption?.eng.nationality), passportIssuingCountryOptions, 'label', ); @@ -121,13 +121,13 @@ onMounted(() => { ); genderFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption?.gender), + ref(optionStore.rawOption?.eng.gender), genderOptions, 'label', ); nationalityFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption?.nationality), + ref(optionStore.rawOption?.eng.nationality), nationalityOptions, 'label', ); @@ -152,7 +152,7 @@ watch( ); passportIssuingCountryFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption.nationality), + ref(optionStore.rawOption?.eng.nationality), passportIssuingCountryOptions, 'label', ); @@ -164,13 +164,13 @@ watch( ); genderFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption?.gender), + ref(optionStore.rawOption?.eng.gender), genderOptions, 'label', ); nationalityFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption?.nationality), + ref(optionStore.rawOption?.eng.nationality), nationalityOptions, 'label', ); diff --git a/src/stores/options/index.ts b/src/stores/options/index.ts index d425389b..469d991f 100644 --- a/src/stores/options/index.ts +++ b/src/stores/options/index.ts @@ -75,6 +75,7 @@ const useOptionStore = defineStore('optionStore', () => { } return { + rawOption, globalOption, mapOption, }; From bc507b7b4c92262c537c8dbe58dc702faeac2b1e Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 4 Apr 2025 09:47:37 +0700 Subject: [PATCH 11/24] refactor: add option type visa --- public/option/option.json | 46 +++++++++++++++++++ .../FormEmployeeVisa.vue | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/public/option/option.json b/public/option/option.json index 2d4991aa..7b9f975f 100644 --- a/public/option/option.json +++ b/public/option/option.json @@ -1,5 +1,28 @@ { "eng": { + "visaType": [ + { + "label": "Non-LA", + "value": "nla" + }, + { + "label": "Non-B", + "value": "nb" + }, + { + "label": "TV.60", + "value": "tv60" + }, + { + "label": "Non-TR", + "value": "ntr" + }, + { + "label": "TV.30", + "value": "tv30" + } + ], + "workerStatus": [ { "label": "Normal", @@ -1051,6 +1074,29 @@ }, "tha": { + "visaType": [ + { + "label": "Non-LA", + "value": "nla" + }, + { + "label": "Non-B", + "value": "nb" + }, + { + "label": "ผผ.60", + "value": "tv60" + }, + { + "label": "Non-TR", + "value": "ntr" + }, + { + "label": "ผผ.30", + "value": "tv30" + } + ], + "workerStatus": [ { "label": "ปกติ", diff --git a/src/components/03_customer-management/FormEmployeeVisa.vue b/src/components/03_customer-management/FormEmployeeVisa.vue index a441ae65..876c7a52 100644 --- a/src/components/03_customer-management/FormEmployeeVisa.vue +++ b/src/components/03_customer-management/FormEmployeeVisa.vue @@ -92,7 +92,7 @@ let workerTypeFilter: ( onMounted(() => { visaTypeFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption?.nationality), + ref(optionStore.globalOption?.visaType), visaTypeOptions, 'label', ); From 68e1abb4cb964309812b34cbfa50045d73df6d48 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 4 Apr 2025 11:08:36 +0700 Subject: [PATCH 12/24] refactor: edit i18n --- .../03_customer-management/FormEmployeeOther.vue | 8 ++++---- src/i18n/eng.ts | 1 + src/i18n/tha.ts | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/03_customer-management/FormEmployeeOther.vue b/src/components/03_customer-management/FormEmployeeOther.vue index 3e9a4a89..f2c32c63 100644 --- a/src/components/03_customer-management/FormEmployeeOther.vue +++ b/src/components/03_customer-management/FormEmployeeOther.vue @@ -106,7 +106,7 @@ const employeeOther = defineModel('employeeOther'); :readonly="readonly || employeeOther.statusSave" hide-bottom-space class="col-md-3 col-6" - :label="$t('form.firstName')" + :label="$t('general.nativeLanguage', { msg: $t('form.firstName') })" :model-value="employeeOther.fatherFirstName" @update:model-value=" (v) => @@ -122,7 +122,7 @@ const employeeOther = defineModel('employeeOther'); :readonly="readonly || employeeOther.statusSave" hide-bottom-space class="col-md-3 col-6" - :label="$t('form.lastName')" + :label="$t('general.nativeLanguage', { msg: $t('form.lastName') })" :model-value="employeeOther.fatherLastName" @update:model-value=" (v) => @@ -177,7 +177,7 @@ const employeeOther = defineModel('employeeOther'); :readonly="readonly || employeeOther.statusSave" hide-bottom-space class="col-md-3 col-6" - :label="$t('form.firstName')" + :label="$t('general.nativeLanguage', { msg: $t('form.firstName') })" :model-value="employeeOther.motherFirstName" @update:model-value=" (v) => @@ -193,7 +193,7 @@ const employeeOther = defineModel('employeeOther'); :readonly="readonly || employeeOther.statusSave" hide-bottom-space class="col-md-3 col-6" - :label="$t('form.lastName')" + :label="$t('general.nativeLanguage', { msg: $t('form.lastName') })" :model-value="employeeOther.motherLastName" @update:model-value=" (v) => diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index d3ddf4a4..ba87cc2d 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -153,6 +153,7 @@ export default { tableOfContent: 'Table of Contents', draw: 'Draw', newUpload: 'New Upload', + nativeLanguage: '{msg} Native Language', }, menu: { diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 5978bb7e..afdcf8f8 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -153,6 +153,7 @@ export default { tableOfContent: 'สารบัญ', draw: 'วาด', newUpload: 'อัปโหลดใหม่', + nativeLanguage: '{msg} ภาษาต้นทาง', }, menu: { From 25b62de13976f24296eacb2242a8e2a53b7215be Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 4 Apr 2025 11:27:51 +0700 Subject: [PATCH 13/24] fix: i18n error --- src/boot/i18n.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/boot/i18n.ts b/src/boot/i18n.ts index 647f3d10..9e2cda0d 100644 --- a/src/boot/i18n.ts +++ b/src/boot/i18n.ts @@ -2,6 +2,7 @@ import { defineBoot } from '#q-app/wrappers'; import { createI18n } from 'vue-i18n'; import messages from 'src/i18n'; +import { Lang } from 'src/utils/ui'; export type MessageLanguages = keyof typeof messages; // Type-define 'eng' as the master schema for the resource @@ -26,7 +27,7 @@ export const i18n = createI18n< MessageLanguages, false >({ - locale: 'en-US', + locale: Lang.Thai, legacy: false, messages, }); From 2511690d547c479df8efdfdaac68a526bd8ff573 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 4 Apr 2025 11:28:41 +0700 Subject: [PATCH 14/24] refactor: handle input require name en --- .../02_personnel-management/FormPerson.vue | 42 +++++++++++++------ src/pages/03_customer-management/MainPage.vue | 2 + 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/components/02_personnel-management/FormPerson.vue b/src/components/02_personnel-management/FormPerson.vue index 5fa321b6..7773b161 100644 --- a/src/components/02_personnel-management/FormPerson.vue +++ b/src/components/02_personnel-management/FormPerson.vue @@ -196,7 +196,11 @@ watch( class="col" :label="$t('personnel.form.firstName')" v-model="firstName" - :rules="[(val: string) => !!val || $t('form.error.required')]" + :rules=" + employee + ? [] + : [(val: string) => !!val || $t('form.error.required')] + " />
@@ -394,11 +410,15 @@ watch( :readonly="readonly" :label="$t('form.birthDate')" :disabled-dates="disabledAfterToday" - :rules="[ - (val: string) => - !!val || - $t('form.error.selectField', { field: $t('form.birthDate') }), - ]" + :rules=" + employee + ? [] + : [ + (val: string) => + !!val || + $t('form.error.selectField', { field: $t('form.birthDate') }), + ] + " />