refactor: handle name prefix

This commit is contained in:
Thanaphon Frappet 2024-11-04 15:38:04 +07:00
parent c4305730b0
commit 3f414b156a

View file

@ -7,11 +7,13 @@ import SelectInput from '../shared/SelectInput.vue';
import { QSelect } from 'quasar';
import { Branch } from 'src/stores/branch/types';
import { CustomerBranch } from 'src/stores/customer/types';
import useOptionStore from 'stores/options';
const { locale } = useI18n({ useScope: 'global' });
const branchStore = useBranchStore();
const customerStore = useCustomerStore();
const optionStore = useOptionStore();
const branchId = defineModel<string>('branchId');
const customerBranchId = defineModel<string>('customerBranchId');
const agentPrice = defineModel<boolean>('agentPrice');
@ -81,6 +83,7 @@ async function init(val: string, type: 'branch' | 'customer') {
label: v.registerName || `${v.firstName} ${v.lastName}` || '-',
labelEN:
v.registerNameEN || `${v.firstNameEN} ${v.lastNameEN}` || '-',
namePrefix: v.namePrefix,
}),
);
}
@ -163,6 +166,10 @@ onMounted(async () => {
<q-item clickable v-bind="scope.itemProps">
<q-item-section>
{{
optionStore.mapOption(scope.opt.namePrefix) ||
$t('general.company')
}}
{{ locale === 'eng' ? scope.opt.labelEN : scope.opt.label }}
</q-item-section>
</q-item>