feat: business type is now from api
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
This commit is contained in:
parent
30d2126161
commit
577da39cf0
6 changed files with 35 additions and 104 deletions
|
|
@ -27,6 +27,7 @@ defineEmits<{
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
type ExclusiveProps = {
|
type ExclusiveProps = {
|
||||||
|
lang?: string;
|
||||||
codeOnly?: boolean;
|
codeOnly?: boolean;
|
||||||
selectFirstValue?: boolean;
|
selectFirstValue?: boolean;
|
||||||
branchVirtual?: boolean;
|
branchVirtual?: boolean;
|
||||||
|
|
@ -92,7 +93,7 @@ function setDefaultValue() {
|
||||||
>
|
>
|
||||||
<template #selected-item="{ opt }">
|
<template #selected-item="{ opt }">
|
||||||
{{
|
{{
|
||||||
$i18n.locale === 'tha'
|
(lang ?? $i18n.locale) !== 'eng'
|
||||||
? opt.name + ' ' + opt.name
|
? opt.name + ' ' + opt.name
|
||||||
: opt.nameEN + ' ' + opt.nameEN
|
: opt.nameEN + ' ' + opt.nameEN
|
||||||
}}
|
}}
|
||||||
|
|
@ -102,7 +103,7 @@ function setDefaultValue() {
|
||||||
<q-item v-bind="scope.itemProps">
|
<q-item v-bind="scope.itemProps">
|
||||||
<span class="row items-center">
|
<span class="row items-center">
|
||||||
{{
|
{{
|
||||||
$i18n.locale === 'tha'
|
(lang ?? $i18n.locale) !== 'eng'
|
||||||
? opt.name + ' ' + opt.name
|
? opt.name + ' ' + opt.name
|
||||||
: opt.nameEN + ' ' + opt.nameEN
|
: opt.nameEN + ' ' + opt.nameEN
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -1266,24 +1266,15 @@ const emptyCreateDialog = ref(false);
|
||||||
class="ellipsis"
|
class="ellipsis"
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
props.row.branch.length !== 0
|
props.row.branch[0].businessType[
|
||||||
? props.row.branch[0].businessType !== null
|
$i18n.locale === 'eng' ? 'nameEN' : 'name'
|
||||||
? optionStore.mapOption(
|
]
|
||||||
props.row.branch[0].businessType,
|
|
||||||
)
|
|
||||||
: ''
|
|
||||||
: '-'
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
<q-tooltip>
|
<q-tooltip>
|
||||||
{{
|
{{
|
||||||
props.row.branch.length !== 0
|
props.row.branch[0].businessType[
|
||||||
? props.row.branch[0].businessType !== null
|
$i18n.locale === 'eng' ? 'nameEN' : 'name'
|
||||||
? optionStore.mapOption(
|
]
|
||||||
props.row.branch[0].businessType,
|
|
||||||
)
|
|
||||||
: ''
|
|
||||||
: '-'
|
|
||||||
}}
|
}}
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ withDefaults(
|
||||||
outlined
|
outlined
|
||||||
:prefix-id="prefixId || 'employer'"
|
:prefix-id="prefixId || 'employer'"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
v-model:bussiness-type="item.businessType"
|
v-model:business-type-id="item.businessTypeId"
|
||||||
v-model:job-position="item.jobPosition"
|
v-model:job-position="item.jobPosition"
|
||||||
v-model:job-description="item.jobDescription"
|
v-model:job-description="item.jobDescription"
|
||||||
v-model:pay-date="item.payDate"
|
v-model:pay-date="item.payDate"
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,13 @@ import { onMounted, watch } from 'vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import ThaiBahtText from 'thai-baht-text';
|
import ThaiBahtText from 'thai-baht-text';
|
||||||
|
import SelectBusinessType from 'src/components/shared/select/SelectBusinessType.vue';
|
||||||
|
|
||||||
const { locale } = useI18n({ useScope: 'global' });
|
const { locale } = useI18n({ useScope: 'global' });
|
||||||
|
|
||||||
const rawOption = ref();
|
const rawOption = ref();
|
||||||
|
|
||||||
const bussinessType = defineModel<string>('bussinessType');
|
const businessTypeId = defineModel<string>('businessTypeId');
|
||||||
const jobPosition = defineModel<string>('jobPosition');
|
const jobPosition = defineModel<string>('jobPosition');
|
||||||
const jobDescription = defineModel<string>('jobDescription');
|
const jobDescription = defineModel<string>('jobDescription');
|
||||||
const payDate = defineModel<string>('payDate');
|
const payDate = defineModel<string>('payDate');
|
||||||
|
|
@ -40,32 +41,16 @@ defineProps<{
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const resultOption = await fetch('/option/option.json');
|
const resultOption = await fetch('/option/option.json');
|
||||||
rawOption.value = await resultOption.json();
|
rawOption.value = await resultOption.json();
|
||||||
typeBusinessENOption.value = rawOption.value.eng.businessType;
|
|
||||||
jobPositionENOption.value = rawOption.value.eng.position;
|
jobPositionENOption.value = rawOption.value.eng.position;
|
||||||
|
|
||||||
if (locale.value === 'eng') {
|
if (locale.value === 'eng') {
|
||||||
typeBusinessOption.value = rawOption.value.eng.businessType;
|
|
||||||
jobPositionOption.value = rawOption.value.eng.position;
|
jobPositionOption.value = rawOption.value.eng.position;
|
||||||
}
|
}
|
||||||
if (locale.value === 'tha') {
|
if (locale.value === 'tha') {
|
||||||
typeBusinessOption.value = rawOption.value.tha.businessType;
|
|
||||||
jobPositionOption.value = rawOption.value.tha.position;
|
jobPositionOption.value = rawOption.value.tha.position;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch([typeBusinessOption, typeBusinessENOption], () => {
|
|
||||||
typeBusinessFilter = selectFilterOptionRefMod(
|
|
||||||
typeBusinessOption,
|
|
||||||
typeBusinessOptions,
|
|
||||||
'label',
|
|
||||||
);
|
|
||||||
typeBusinessENFilter = selectFilterOptionRefMod(
|
|
||||||
typeBusinessENOption,
|
|
||||||
typeBusinessENOptions,
|
|
||||||
'label',
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => rate.value,
|
() => rate.value,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
|
|
@ -135,69 +120,18 @@ let jobPositionENFilter = selectFilterOptionRefMod(
|
||||||
<span>{{ $t('customerBranch.tab.business') }}</span>
|
<span>{{ $t('customerBranch.tab.business') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-select
|
<SelectBusinessType
|
||||||
outlined
|
|
||||||
clearable
|
|
||||||
use-input
|
|
||||||
fill-input
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
hide-bottom-space
|
|
||||||
:hide-dropdown-icon="readonly"
|
|
||||||
input-debounce="0"
|
|
||||||
option-value="value"
|
|
||||||
option-label="label"
|
|
||||||
v-model="bussinessType"
|
|
||||||
class="col-md-6 col-12"
|
class="col-md-6 col-12"
|
||||||
:dense="dense"
|
v-model:value="businessTypeId"
|
||||||
:readonly="readonly"
|
:readonly
|
||||||
:label="$t('customer.form.businessType')"
|
lang="tha"
|
||||||
:options="typeBusinessOptions"
|
/>
|
||||||
:for="`${prefixId}-select-business-type`"
|
<SelectBusinessType
|
||||||
@filter="typeBusinessFilter"
|
|
||||||
:rules="[(val: string) => !!val || $t('form.error.required')]"
|
|
||||||
>
|
|
||||||
<template v-slot:no-option>
|
|
||||||
<q-item>
|
|
||||||
<q-item-section class="text-grey">
|
|
||||||
{{ $t('general.noData') }}
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</template>
|
|
||||||
</q-select>
|
|
||||||
<q-select
|
|
||||||
:for="`${prefixId}-input-bussiness-type-en`"
|
|
||||||
:id="`${prefixId}-input-bussiness-type-en`"
|
|
||||||
:label="`${$t('customer.form.businessType')} (EN)`"
|
|
||||||
outlined
|
|
||||||
clearable
|
|
||||||
use-input
|
|
||||||
fill-input
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
hide-bottom-space
|
|
||||||
:hide-dropdown-icon="readonly"
|
|
||||||
input-debounce="0"
|
|
||||||
option-value="value"
|
|
||||||
option-label="label"
|
|
||||||
v-model="bussinessType"
|
|
||||||
class="col-md-6 col-12"
|
class="col-md-6 col-12"
|
||||||
:dense="dense"
|
v-model:value="businessTypeId"
|
||||||
:readonly="readonly"
|
lang="eng"
|
||||||
:options="typeBusinessENOptions"
|
:readonly
|
||||||
@filter="typeBusinessENFilter"
|
/>
|
||||||
:rules="[(val: string) => !!val || $t('form.error.required')]"
|
|
||||||
>
|
|
||||||
<template v-slot:no-option>
|
|
||||||
<q-item>
|
|
||||||
<q-item-section class="text-grey">
|
|
||||||
{{ $t('general.noData') }}
|
|
||||||
</q-item-section>
|
|
||||||
</q-item>
|
|
||||||
</template>
|
|
||||||
</q-select>
|
|
||||||
|
|
||||||
<q-select
|
<q-select
|
||||||
outlined
|
outlined
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
[key: string]: (keyof CustomerBranchCreate)[];
|
[key: string]: (keyof CustomerBranchCreate)[];
|
||||||
}>({
|
}>({
|
||||||
main: [],
|
main: [],
|
||||||
business: ['businessType', 'jobPosition'],
|
business: ['businessTypeId', 'jobPosition'],
|
||||||
address: [
|
address: [
|
||||||
'address',
|
'address',
|
||||||
'addressEN',
|
'addressEN',
|
||||||
|
|
@ -181,7 +181,7 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
payDate: v.payDate,
|
payDate: v.payDate,
|
||||||
jobDescription: v.jobDescription,
|
jobDescription: v.jobDescription,
|
||||||
jobPosition: v.jobPosition,
|
jobPosition: v.jobPosition,
|
||||||
businessType: v.businessType,
|
businessTypeId: v.businessTypeId,
|
||||||
employmentOffice: v.employmentOffice,
|
employmentOffice: v.employmentOffice,
|
||||||
employmentOfficeEN: v.employmentOfficeEN,
|
employmentOfficeEN: v.employmentOfficeEN,
|
||||||
telephoneNo: v.telephoneNo,
|
telephoneNo: v.telephoneNo,
|
||||||
|
|
@ -289,8 +289,8 @@ export const useCustomerForm = defineStore('form-customer', () => {
|
||||||
birthDate:
|
birthDate:
|
||||||
currentFormData.value.customerBranch?.at(0)?.birthDate || undefined,
|
currentFormData.value.customerBranch?.at(0)?.birthDate || undefined,
|
||||||
|
|
||||||
businessType:
|
businessTypeId:
|
||||||
currentFormData.value.customerBranch?.at(0)?.businessType || '',
|
currentFormData.value.customerBranch?.at(0)?.businessTypeId || '',
|
||||||
jobPosition:
|
jobPosition:
|
||||||
currentFormData.value.customerBranch?.at(0)?.jobPosition || '',
|
currentFormData.value.customerBranch?.at(0)?.jobPosition || '',
|
||||||
jobDescription:
|
jobDescription:
|
||||||
|
|
@ -538,7 +538,7 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
||||||
gender: '',
|
gender: '',
|
||||||
birthDate: undefined,
|
birthDate: undefined,
|
||||||
|
|
||||||
businessType: '',
|
businessTypeId: '',
|
||||||
jobPosition: '',
|
jobPosition: '',
|
||||||
jobDescription: '',
|
jobDescription: '',
|
||||||
payDate: '',
|
payDate: '',
|
||||||
|
|
@ -619,7 +619,7 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => {
|
||||||
payDateEN: _data.payDateEN,
|
payDateEN: _data.payDateEN,
|
||||||
jobDescription: _data.jobDescription,
|
jobDescription: _data.jobDescription,
|
||||||
jobPosition: _data.jobPosition,
|
jobPosition: _data.jobPosition,
|
||||||
businessType: _data.businessType,
|
businessTypeId: _data.businessTypeId,
|
||||||
employmentOffice: _data.employmentOffice,
|
employmentOffice: _data.employmentOffice,
|
||||||
employmentOfficeEN: _data.employmentOfficeEN,
|
employmentOfficeEN: _data.employmentOfficeEN,
|
||||||
telephoneNo: _data.telephoneNo,
|
telephoneNo: _data.telephoneNo,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,12 @@ export type CustomerBranch = {
|
||||||
payDate: string;
|
payDate: string;
|
||||||
jobDescription: string;
|
jobDescription: string;
|
||||||
jobPosition: string;
|
jobPosition: string;
|
||||||
businessType: string;
|
businessTypeId: string;
|
||||||
|
businessType?: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
nameEN: string;
|
||||||
|
};
|
||||||
agentUserId: string;
|
agentUserId: string;
|
||||||
|
|
||||||
contactName: string;
|
contactName: string;
|
||||||
|
|
@ -107,7 +112,7 @@ export type CustomerBranchCreate = {
|
||||||
telephoneNo?: string;
|
telephoneNo?: string;
|
||||||
gender?: string;
|
gender?: string;
|
||||||
birthDate?: string;
|
birthDate?: string;
|
||||||
businessType: string;
|
businessTypeId: string;
|
||||||
jobPosition: string;
|
jobPosition: string;
|
||||||
jobDescription: string;
|
jobDescription: string;
|
||||||
payDate?: string;
|
payDate?: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue