From 6f16964859a0c62b6399701684532e7352a639e7 Mon Sep 17 00:00:00 2001 From: Thanaphon Frappet Date: Fri, 4 Apr 2025 09:46:57 +0700 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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') }), + ] + " />