refactor: employee mid name and prefix

This commit is contained in:
puriphatt 2024-08-27 15:03:56 +07:00
parent c3c98c1980
commit cf97ffd8de
4 changed files with 40 additions and 14 deletions

View file

@ -11,15 +11,15 @@ const optionStore = useOptionStore();
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 telephoneNo = defineModel<string>('telephoneNo');
const email = defineModel<string>('email');
const gender = defineModel<string>('gender');
const birthDate = defineModel<Date | string | null>('birthDate');
const nationality = defineModel<string>('nationality');
const midName = defineModel<string | null>('midName');
const midNameEn = defineModel<string | null>('midNameEn');
const midNameEN = defineModel<string | null>('midNameEN');
defineProps<{
dense?: boolean;
@ -154,7 +154,7 @@ watch(
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-first-name`"
:for="`${prefixId}-input-mid-name`"
:dense="dense"
outlined
:readonly="readonly"
@ -216,21 +216,20 @@ watch(
v-model="firstNameEN"
:rules="[(val: string) => !!val || $t('form.error.required')]"
/>
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-first-name-en`"
:for="`${prefixId}-input-mid-name-en`"
:dense="dense"
outlined
:readonly="readonly"
hide-bottom-space
class="col-md-3 col-6"
:label="$t('personnel.form.middleNameEN')"
:model-value="readonly ? midNameEn || '-' : midNameEn"
:model-value="readonly ? midNameEN || '-' : midNameEN"
@update:model-value="
(v) => (typeof v === 'string' ? (midNameEn = v) : '')
(v) => (typeof v === 'string' ? (midNameEN = v) : '')
"
@clear="midNameEn = ''"
@clear="midNameEN = ''"
/>
<q-input
lazy-rules="ondemand"