fix: ตรวจสอบ input

This commit is contained in:
Net 2024-07-10 12:42:00 +07:00
parent 96107502ac
commit 6e27e51bba

View file

@ -1,4 +1,5 @@
<script setup lang="ts">
import { getRole } from 'src/services/keycloak';
import { CustomerBranch } from 'src/stores/customer/types';
import { onMounted, ref } from 'vue';
@ -41,6 +42,8 @@ defineEmits<{
onMounted(async () => {
if(!!props.optionsBranch) {
registeredBranchId.value = props.optionsBranch[0].id ;
@ -73,7 +76,15 @@ onMounted(async () => {
option-value="id"
v-model="registeredBranchId"
:options="optionsBranch"
:rules="[(val) => !!val]"
:rules="[
(val) => {
const roles = getRole() || [];
const isSpecialRole = ['admin', 'system', 'head_of_admin'].some(role => roles.includes(role));
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
}
]"
clearable
/>
<q-input