feat: rule validate employee

This commit is contained in:
puriphatt 2024-06-11 04:58:59 +00:00
parent 6c54c80289
commit 93697fd8cc
4 changed files with 127 additions and 74 deletions

View file

@ -1,4 +1,6 @@
<script setup lang="ts">
import { ref } from 'vue';
const customerName = defineModel<string>('customerName');
const customerNameEn = defineModel<string>('customerNameEn');
const taxNo = defineModel<string | null | undefined>('taxNo');
@ -10,6 +12,13 @@ const customerBranchId = defineModel<string>('customerBranchId');
const employeeID = defineModel<string>('employeeID');
const nrcNo = defineModel<string>('nrcNo');
const branchOption = ref([
{
label: 'uuu',
value: 'ad87961c-c44f-47ca-8c1e-0ef30c2b16ba',
},
]);
defineProps<{
dense?: boolean;
outlined?: boolean;
@ -72,16 +81,27 @@ defineProps<{
<div v-if="employee" class="col-9 row q-col-gutter-md">
<q-select
id="select-employer-branch"
:dense="dense"
:outlined="!readonly"
:readonly="readonly"
:borderless="readonly"
hide-bottom-space
class="col-3"
:label="$t('formDialogEmployerID')"
:label="$t('formDialogEmployerBranchCode')"
v-model="customerBranchId"
option-label="label"
option-value="value"
emit-value
map-options
:options="branchOption"
:rules="[
(val: string) =>
!!val || $t('selectValidate') + $t('formDialogEmployerBranchCode'),
]"
/>
<q-input
for="input-employeeID"
:dense="dense"
:outlined="!readonly"
:readonly="true"
@ -90,9 +110,9 @@ defineProps<{
class="col-3"
:label="$t('formDialogEmployeeID')"
v-model="employeeID"
for="input-employeeID"
/>
<q-input
for="input-nrcNo"
:dense="dense"
:outlined="!readonly"
:readonly="readonly"
@ -101,6 +121,10 @@ defineProps<{
class="col-6"
:label="$t('formDialogEmployeeNRCNo')"
v-model="nrcNo"
:rules="[
(val: string) =>
!!val || $t('inputValidate') + $t('formDialogEmployeeNRCNo'),
]"
/>
</div>