feat: only validate field on submit only

This commit is contained in:
Methapon2001 2024-07-26 11:05:07 +07:00
parent 10e0d638f5
commit c3ac90429e
26 changed files with 164 additions and 14 deletions

View file

@ -124,6 +124,7 @@ watch(districtId, fetchSubDistrict);
</div>
<div class="col-md-9 col-12 row q-col-gutter-md">
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-${id !== undefined ? `input-address-${id}` : 'input-address'}`"
:dense="dense"
outlined
@ -143,6 +144,7 @@ watch(districtId, fetchSubDistrict);
"
/>
<q-select
lazy-rules="ondemand"
:id="`${prefixId}-${id !== undefined ? `select-province-${id}` : 'select-province'}`"
:dense="dense"
:readonly="readonly || sameWithEmployer"
@ -170,6 +172,7 @@ watch(districtId, fetchSubDistrict);
/>
<q-select
lazy-rules="ondemand"
:id="`${prefixId}-${id !== undefined ? `select-district-${id}` : 'select-district'}`"
:dense="dense"
:readonly="readonly || sameWithEmployer"
@ -196,6 +199,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="subDistrictId = zipCode = null"
/>
<q-select
lazy-rules="ondemand"
:id="`${prefixId}-${id !== undefined ? `select-sub-district-${id}` : 'select-sub-district'}`"
:dense="dense"
:readonly="readonly || sameWithEmployer"
@ -222,6 +226,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="(v: string) => selectSubDistrict(v)"
/>
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-${id !== undefined ? `input-zip-code-${id}` : 'input-zip-code'}`"
:dense="dense"
outlined
@ -239,6 +244,7 @@ watch(districtId, fetchSubDistrict);
</div>
<div class="col-md-9 col-12 row q-col-gutter-md">
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-${id !== undefined ? `input-address-en-${id}` : 'input-address-en'}`"
:dense="dense"
:readonly="readonly || sameWithEmployer"
@ -258,6 +264,7 @@ watch(districtId, fetchSubDistrict);
"
/>
<q-select
lazy-rules="ondemand"
:id="`${prefixId}-${id !== undefined ? `select-province-en-${id}` : 'select-province-en'}`"
hide-bottom-space
:dense="dense"
@ -284,6 +291,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="districtId = subDistrictId = zipCode = null"
/>
<q-select
lazy-rules="ondemand"
:id="`${prefixId}-${id !== undefined ? `select-district-en-${id}` : 'select-district-en'}`"
hide-bottom-space
:dense="dense"
@ -310,6 +318,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="subDistrictId = zipCode = null"
/>
<q-select
lazy-rules="ondemand"
:id="`${prefixId}-${id !== undefined ? `select-sub-district-en-${id}` : 'select-sub-district-en'}`"
hide-bottom-space
:dense="dense"
@ -336,6 +345,7 @@ watch(districtId, fetchSubDistrict);
@update:model-value="(v: string) => selectSubDistrict(v)"
/>
<q-input
lazy-rules="ondemand"
hide-bottom-space
:for="`${prefixId}-${id !== undefined ? `input-zip-code-${id}` : 'input-zip-code'}`"
:dense="dense"

View file

@ -80,6 +80,7 @@ function deleteFile(name: string) {
style="margin-left: 0px; padding-left: 0px"
>
<q-input
lazy-rules="ondemand"
for="input-regis-no"
:dense="dense"
outlined
@ -108,6 +109,7 @@ function deleteFile(name: string) {
</template>
<template #trigger>
<q-input
lazy-rules="ondemand"
for="input-start-date"
:label="$t('formDialogInputStartDate')"
:dense="dense"
@ -170,6 +172,7 @@ function deleteFile(name: string) {
</template>
<template #trigger>
<q-input
lazy-rules="ondemand"
for="input-retire-date"
:label="$t('formDialogInputRetireDate')"
:dense="dense"
@ -213,6 +216,7 @@ function deleteFile(name: string) {
</template>
</VueDatePicker>
<q-select
lazy-rules="ondemand"
id="input-responsible-area"
v-if="userType === 'MESSENGER'"
:dense="dense"
@ -236,6 +240,7 @@ function deleteFile(name: string) {
style="row-gap: 16px"
>
<q-input
lazy-rules="ondemand"
for="input-discount-condition"
:dense="dense"
outlined
@ -252,6 +257,7 @@ function deleteFile(name: string) {
style="margin-left: 0px; padding-left: 0px"
>
<q-select
lazy-rules="ondemand"
id="input-source-nationality"
:dense="dense"
outlined
@ -268,6 +274,7 @@ function deleteFile(name: string) {
:options="userStore.userOption.nationalityOpts"
/>
<q-select
lazy-rules="ondemand"
id="input-import-nationality"
:dense="dense"
outlined
@ -284,6 +291,7 @@ function deleteFile(name: string) {
:options="userStore.userOption.nationalityOpts"
/>
<q-select
lazy-rules="ondemand"
id="select-trainig-place"
:dense="dense"
outlined
@ -300,6 +308,7 @@ function deleteFile(name: string) {
:options="userStore.userOption.trainingPlaceOpts"
/>
<q-input
lazy-rules="ondemand"
for="input-checkpoint"
:dense="dense"
outlined
@ -309,6 +318,7 @@ function deleteFile(name: string) {
v-model="checkpoint"
/>
<q-input
lazy-rules="ondemand"
for="input-checkpoint-en"
:dense="dense"
outlined

View file

@ -40,6 +40,7 @@ onMounted(async () => {
</div>
<div class="col-md-9 col-12 row q-col-gutter-md">
<q-select
lazy-rules="ondemand"
id="select-hq-id"
:dense="dense"
outlined
@ -59,6 +60,7 @@ onMounted(async () => {
@update:model-value="(val: string) => selectHq(val)"
/>
<q-select
lazy-rules="ondemand"
id="select-br-id"
:dense="dense"
outlined
@ -77,6 +79,7 @@ onMounted(async () => {
:options="userStore.userOption.brOpts"
/>
<q-input
lazy-rules="ondemand"
for="input-username"
:dense="dense"
outlined
@ -94,6 +97,7 @@ onMounted(async () => {
]"
/>
<q-select
lazy-rules="ondemand"
id="select-user-type"
:dense="dense"
outlined
@ -123,6 +127,7 @@ onMounted(async () => {
</template>
</q-select>
<q-select
lazy-rules="ondemand"
id="select-user-role"
:dense="dense"
outlined
@ -140,7 +145,7 @@ onMounted(async () => {
:options="userStore.userOption.roleOpts"
:rules="[(val: string) => !!val || $t('formDialogInputUserRoleValidate')]"
/>
<!-- <q-input
<!-- <q-input lazy-rules="ondemand"
id="input-user-code"
:dense="dense"
:outlined="readonly ? false : outlined"

View file

@ -37,6 +37,7 @@ defineProps<{
</div>
<div class="col-md-9 col-12 row q-col-gutter-md">
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-first-name`"
:dense="dense"
outlined
@ -50,6 +51,7 @@ defineProps<{
]"
/>
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-last-name`"
:dense="dense"
outlined
@ -61,6 +63,7 @@ defineProps<{
:rules="[(val: string) => !!val || $t('formDialogInputLastNameValidate')]"
/>
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-first-name-en`"
:dense="dense"
outlined
@ -74,6 +77,7 @@ defineProps<{
]"
/>
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-last-name-en`"
:dense="dense"
outlined
@ -87,6 +91,7 @@ defineProps<{
]"
/>
<q-input
lazy-rules="ondemand"
v-if="!employee"
:for="`${prefixId}-input-telephone`"
:dense="dense"
@ -98,6 +103,7 @@ defineProps<{
mask="##########"
/>
<q-input
lazy-rules="ondemand"
v-if="!employee"
:for="`${prefixId}-input-email`"
:dense="dense"
@ -108,6 +114,7 @@ defineProps<{
v-model="email"
/>
<q-select
lazy-rules="ondemand"
v-if="!employee"
:id="`${prefixId}-select-gender`"
:dense="dense"
@ -146,6 +153,7 @@ defineProps<{
</template>
<template #trigger>
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-birth-date`"
hide-bottom-space
placeholder="DD/MM/YYYY"
@ -186,6 +194,7 @@ defineProps<{
</template>
</VueDatePicker>
<q-input
lazy-rules="ondemand"
:for="`${prefixId}-input-age`"
:dense="dense"
outlined
@ -200,6 +209,7 @@ defineProps<{
"
/>
<q-select
lazy-rules="ondemand"
v-if="employee"
:id="`${prefixId}-select-gender`"
hide-bottom-space
@ -221,6 +231,7 @@ defineProps<{
]"
/>
<q-select
lazy-rules="ondemand"
v-if="employee"
:id="`${prefixId}-select-nationality`"
hide-bottom-space