feat: add simple branch no parameter for select customer

This commit is contained in:
Methapon Metanipat 2024-11-13 17:14:40 +07:00
parent 7d71f0498f
commit 5ea09453dc
2 changed files with 18 additions and 2 deletions

View file

@ -31,6 +31,7 @@ defineEmits<{
type ExclusiveProps = { type ExclusiveProps = {
simple?: boolean; simple?: boolean;
simpleBranchNo?: boolean;
}; };
const props = defineProps<SelectProps<typeof getList> & ExclusiveProps>(); const props = defineProps<SelectProps<typeof getList> & ExclusiveProps>();
@ -87,6 +88,7 @@ onMounted(async () => {
v-if="typeof opt === 'object'" v-if="typeof opt === 'object'"
:data="opt" :data="opt"
:simple :simple
:simple-branch-no
single-line single-line
/> />
</template> </template>
@ -110,7 +112,7 @@ onMounted(async () => {
<template #option="{ opt, scope }"> <template #option="{ opt, scope }">
<q-item v-bind="scope.itemProps"> <q-item v-bind="scope.itemProps">
<SelectCustomerItem :data="opt" :simple /> <SelectCustomerItem :data="opt" :simple :simple-branch-no />
</q-item> </q-item>
<q-separator class="q-mx-sm" /> <q-separator class="q-mx-sm" />

View file

@ -6,6 +6,7 @@ import { formatAddress } from 'src/utils/address';
defineProps<{ defineProps<{
data?: CustomerBranch & { customer: Customer }; data?: CustomerBranch & { customer: Customer };
simple?: boolean; simple?: boolean;
simpleBranchNo?: boolean;
singleLine?: boolean; singleLine?: boolean;
}>(); }>();
@ -28,7 +29,20 @@ const optionStore = useOptionStore();
}[$i18n.locale] || '-', }[$i18n.locale] || '-',
}[data.customer.customerType] }[data.customer.customerType]
}} }}
({{ data.code }})
({{
simpleBranchNo
? (
$t(
`branch.form.title.${data.code.endsWith('-00') ? 'branchHQLabel' : 'branchLabel'}`,
) +
' ' +
(!data.code.endsWith('-00')
? String(+data.code.split('-')[1])
: '')
).trim()
: data.code
}})
</div> </div>
<div <div
v-else v-else