refactor: handle input require name en
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 9s

This commit is contained in:
Thanaphon Frappet 2025-04-04 11:28:41 +07:00
parent 25b62de139
commit 2511690d54
2 changed files with 32 additions and 12 deletions

View file

@ -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')]
"
/>
<q-input
@ -289,10 +293,22 @@ watch(
class="col"
label="Surname"
v-model="lastNameEN"
:rules="[
(val: string) =>
!val || /^[A-Za-z\s]+$/.test(val) || $t('form.error.letterOnly'),
]"
:rules="
employee
? [
(val: string) => !!val || $t('form.error.required'),
(val: string) =>
!val ||
/^[A-Za-z\s]+$/.test(val) ||
$t('form.error.letterOnly'),
]
: [
(val: string) =>
!val ||
/^[A-Za-z\s]+$/.test(val) ||
$t('form.error.letterOnly'),
]
"
/>
</div>
@ -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') }),
]
"
/>
<q-input
@ -480,7 +500,6 @@ watch(
:hide-dropdown-icon="readonly"
:for="`${prefixId}-select-gender`"
:label="$t('form.gender')"
:rules="[(val: string) => !!val || $t('form.error.required')]"
@filter="genderFilter"
>
<template v-slot:no-option>
@ -513,7 +532,6 @@ watch(
:hide-dropdown-icon="readonly"
:for="`${prefixId}-select-nationality`"
:label="$t('general.nationality')"
:rules="[(val: string) => !!val || $t('form.error.required')]"
@filter="nationalityFilter"
>
<template v-slot:no-option>

View file

@ -2918,6 +2918,7 @@ const emptyCreateDialog = ref(false);
class="q-mb-xl"
/>
<AddressForm
disabledRule
id="form-personal-address"
prefix-id="form-employee"
:readonly="!employeeFormState.isEmployeeEdit"
@ -4871,6 +4872,7 @@ const emptyCreateDialog = ref(false);
<AddressForm
id="drawer-form-personal-address"
employee
disabledRule
v-model:address="currentFromDataEmployee.address"
v-model:address-en="currentFromDataEmployee.addressEN"
v-model:moo="currentFromDataEmployee.moo"