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

View file

@ -6,6 +6,7 @@ import { formatAddress } from 'src/utils/address';
defineProps<{
data?: CustomerBranch & { customer: Customer };
simple?: boolean;
simpleBranchNo?: boolean;
singleLine?: boolean;
}>();
@ -28,7 +29,20 @@ const optionStore = useOptionStore();
}[$i18n.locale] || '-',
}[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
v-else