feat: auto select current branch

This commit is contained in:
Methapon2001 2024-07-10 13:21:32 +07:00
parent dcefa3de02
commit 2dac800fad
5 changed files with 81 additions and 66 deletions

View file

@ -39,27 +39,13 @@ const props = defineProps<{
defineEmits<{
(e: 'filterOwnerBranch', val: string, update: void): void;
}>();
onMounted(async () => {
if(!!props.optionsBranch) {
registeredBranchId.value = props.optionsBranch[0].id ;
}
});
</script>
<template>
<div class="col-3 app-text-muted">
{{ $t(`formDialogTitleInformation`) }}
</div>
<div v-if="!employee" class="col-9 row q-col-gutter-md">
<q-select
id="input-source-nationality"
:dense="dense"
@ -76,15 +62,16 @@ onMounted(async () => {
option-value="id"
v-model="registeredBranchId"
:options="optionsBranch"
:rules="[
(val) => {
const roles = getRole() || [];
const isSpecialRole = ['admin', 'system', 'head_of_admin'].some(role => roles.includes(role));
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
}
]"
clearable
:rules="[
(val) => {
const roles = getRole() || [];
const isSpecialRole = ['admin', 'system', 'head_of_admin'].some(
(role) => roles.includes(role),
);
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
},
]"
clearable
/>
<q-input
@ -110,7 +97,7 @@ clearable
class="col-6"
:label="$t('taxNo')"
v-model="taxNo"
:rules="[
:rules="[
(val) =>
(val && val.length === 13 && /[0-9]+/.test(val)) ||
$t('formDialogInputTaxNoValidate'),