refactor: add props branch virtual

This commit is contained in:
Thanaphon Frappet 2024-11-29 10:16:51 +07:00
parent 89f67265b6
commit 3679de69f1
2 changed files with 11 additions and 7 deletions

View file

@ -57,11 +57,12 @@ defineEmits<{
<div class="col-12 row q-col-gutter-sm"> <div class="col-12 row q-col-gutter-sm">
<SelectBranch <SelectBranch
v-model:value="branchId" v-model:value="branchId"
:label="$t('quotation.branch')" :label="$t('quotation.branchVirtual')"
class="col-md-6 col-12" class="col-md-6 col-12"
simple simple
required required
:readonly :readonly
branch-virtual
/> />
<SelectCustomer <SelectCustomer
v-model:value="customerBranchId" v-model:value="customerBranchId"

View file

@ -27,6 +27,7 @@ defineEmits<{
type ExclusiveProps = { type ExclusiveProps = {
selectFirstValue?: boolean; selectFirstValue?: boolean;
branchVirtual?: boolean;
}; };
const props = defineProps<SelectProps<typeof getList> & ExclusiveProps>(); const props = defineProps<SelectProps<typeof getList> & ExclusiveProps>();
@ -80,12 +81,14 @@ function setDefaultValue() {
:option=" :option="
selectOptions.map((v) => { selectOptions.map((v) => {
const ret = { const ret = {
label: ( label:
{ `${branchVirtual ? $t('branch.card.branchVirtual') : ''}` +
['eng']: [v.nameEN, `(${v.code})`].join(' '), (
['tha']: [v.name, `(${v.code})`].join(' '), {
} as const ['eng']: [v.nameEN, `(${v.code})`].join(' '),
)[$i18n.locale], ['tha']: [v.name, `(${v.code})`].join(' '),
} as const
)[$i18n.locale],
value: v.id, value: v.id,
}; };
return ret; return ret;