refactor: add contact information fields to agency forms and update data models
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 12s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 12s
This commit is contained in:
parent
3efe8e19f4
commit
1a8be5ac34
3 changed files with 167 additions and 9 deletions
|
|
@ -14,6 +14,9 @@ defineProps<{
|
||||||
const group = defineModel('group', { default: '' });
|
const group = defineModel('group', { default: '' });
|
||||||
const name = defineModel('name', { default: '' });
|
const name = defineModel('name', { default: '' });
|
||||||
const nameEn = defineModel('nameEn', { default: '' });
|
const nameEn = defineModel('nameEn', { default: '' });
|
||||||
|
const contactName = defineModel('contactName', { default: '' });
|
||||||
|
const email = defineModel('email', { default: '' });
|
||||||
|
const contactTel = defineModel('contactTel', { default: '' });
|
||||||
|
|
||||||
type Options = { label: string; value: string };
|
type Options = { label: string; value: string };
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -35,7 +38,7 @@ type Options = { label: string; value: string };
|
||||||
|
|
||||||
<div class="col-12 row q-col-gutter-sm">
|
<div class="col-12 row q-col-gutter-sm">
|
||||||
<SelectInput
|
<SelectInput
|
||||||
:class="{ col: $q.screen.lt.md }"
|
class="col"
|
||||||
:disable="!readonly && onDrawer"
|
:disable="!readonly && onDrawer"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
for="input-agencies-code"
|
for="input-agencies-code"
|
||||||
|
|
@ -62,7 +65,7 @@ type Options = { label: string; value: string };
|
||||||
outlined
|
outlined
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-md col-12"
|
class="col-md-4 col-12"
|
||||||
:label="$t('agencies.name')"
|
:label="$t('agencies.name')"
|
||||||
v-model="name"
|
v-model="name"
|
||||||
:rules="[(val: string) => !!val || $t('form.error.required')]"
|
:rules="[(val: string) => !!val || $t('form.error.required')]"
|
||||||
|
|
@ -73,10 +76,78 @@ type Options = { label: string; value: string };
|
||||||
outlined
|
outlined
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-md col-12"
|
class="col-md-4 col-12"
|
||||||
:label="'Agencies Name'"
|
:label="'Agencies Name'"
|
||||||
v-model="nameEn"
|
v-model="nameEn"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<q-input
|
||||||
|
for="input-agencies-contact-name"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
:readonly="readonly"
|
||||||
|
hide-bottom-space
|
||||||
|
class="col-md-4 col-12"
|
||||||
|
:label="$t('agencies.contactName')"
|
||||||
|
:model-value="readonly ? contactName || '-' : contactName"
|
||||||
|
@update:model-value="
|
||||||
|
(v) => (typeof v === 'string' ? (contactName = v) : '')
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
for="input-agencies-email"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
hide-bottom-space
|
||||||
|
:readonly="readonly"
|
||||||
|
:label="$t('form.email')"
|
||||||
|
:rules="
|
||||||
|
readonly
|
||||||
|
? undefined
|
||||||
|
: [
|
||||||
|
(v: string) =>
|
||||||
|
!v ||
|
||||||
|
/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/g.test(v) ||
|
||||||
|
$t('form.error.invalid'),
|
||||||
|
]
|
||||||
|
"
|
||||||
|
class="col-md-4 col-12"
|
||||||
|
:model-value="readonly ? email || '-' : email"
|
||||||
|
@update:model-value="(v) => (typeof v === 'string' ? (email = v) : '')"
|
||||||
|
@clear="email = ''"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<q-icon
|
||||||
|
size="xs"
|
||||||
|
name="mdi-email-outline"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
<q-input
|
||||||
|
for="input-agencies-contact-tel"
|
||||||
|
id="input-agencies-contact-tel"
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
:readonly="readonly"
|
||||||
|
hide-bottom-space
|
||||||
|
class="col-md-4 col-12"
|
||||||
|
:label="$t('form.telephone')"
|
||||||
|
:model-value="readonly ? contactTel || '-' : contactTel"
|
||||||
|
@update:model-value="
|
||||||
|
(v) => (typeof v === 'string' ? (contactTel = v) : '')
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<q-icon
|
||||||
|
size="xs"
|
||||||
|
name="mdi-phone-outline"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import DrawerInfo from 'src/components/DrawerInfo.vue';
|
||||||
import DialogForm from 'src/components/DialogForm.vue';
|
import DialogForm from 'src/components/DialogForm.vue';
|
||||||
import ProfileBanner from 'src/components/ProfileBanner.vue';
|
import ProfileBanner from 'src/components/ProfileBanner.vue';
|
||||||
import SideMenu from 'src/components/SideMenu.vue';
|
import SideMenu from 'src/components/SideMenu.vue';
|
||||||
|
import FormBank from 'src/components/01_branch-management/FormBank.vue';
|
||||||
import FormBasicInfoAgencies from 'src/components/07_agencies-management/FormBasicInfoAgencies.vue';
|
import FormBasicInfoAgencies from 'src/components/07_agencies-management/FormBasicInfoAgencies.vue';
|
||||||
import {
|
import {
|
||||||
UndoButton,
|
UndoButton,
|
||||||
|
|
@ -19,6 +20,7 @@ import {
|
||||||
} from 'src/components/button';
|
} from 'src/components/button';
|
||||||
import AddressForm from 'src/components/form/AddressForm.vue';
|
import AddressForm from 'src/components/form/AddressForm.vue';
|
||||||
import ImageUploadDialog from 'src/components/ImageUploadDialog.vue';
|
import ImageUploadDialog from 'src/components/ImageUploadDialog.vue';
|
||||||
|
import { BankBook } from 'src/stores/branch/types';
|
||||||
|
|
||||||
const institutionStore = useInstitution();
|
const institutionStore = useInstitution();
|
||||||
|
|
||||||
|
|
@ -73,6 +75,9 @@ const data = defineModel<InstitutionPayload>('data', {
|
||||||
group: '',
|
group: '',
|
||||||
name: '',
|
name: '',
|
||||||
nameEN: '',
|
nameEN: '',
|
||||||
|
contactName: '',
|
||||||
|
contactEmail: '',
|
||||||
|
contactTel: '',
|
||||||
code: '',
|
code: '',
|
||||||
addressEN: '',
|
addressEN: '',
|
||||||
address: '',
|
address: '',
|
||||||
|
|
@ -88,6 +93,19 @@ const data = defineModel<InstitutionPayload>('data', {
|
||||||
selectedImage: '',
|
selectedImage: '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const formBankBook = defineModel<BankBook[]>('formBankBook', {
|
||||||
|
default: [
|
||||||
|
{
|
||||||
|
bankName: '',
|
||||||
|
accountNumber: '',
|
||||||
|
bankBranch: '',
|
||||||
|
accountName: '',
|
||||||
|
accountType: '',
|
||||||
|
currentlyUse: true,
|
||||||
|
bankUrl: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
function viewImage() {
|
function viewImage() {
|
||||||
imageState.imageDialog = true;
|
imageState.imageDialog = true;
|
||||||
|
|
@ -237,11 +255,15 @@ watch(
|
||||||
:menu="[
|
:menu="[
|
||||||
{
|
{
|
||||||
name: $t('form.field.basicInformation'),
|
name: $t('form.field.basicInformation'),
|
||||||
anchor: 'agencies-basic-info',
|
anchor: 'agencies-form-basic-info',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: $t('general.address'),
|
name: $t('general.address'),
|
||||||
anchor: 'agencies-address-info',
|
anchor: 'agencies-form-address-info',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: $t('agencies.bankInfo'),
|
||||||
|
anchor: 'agencies-form-bank-info',
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
background="transparent"
|
background="transparent"
|
||||||
|
|
@ -275,14 +297,17 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FormBasicInfoAgencies
|
<FormBasicInfoAgencies
|
||||||
id="agencies-basic-info"
|
id="agencies-form-basic-info"
|
||||||
class="q-mb-xl"
|
class="q-mb-xl"
|
||||||
v-model:group="data.group"
|
v-model:group="data.group"
|
||||||
v-model:name="data.name"
|
v-model:name="data.name"
|
||||||
v-model:name-en="data.nameEN"
|
v-model:name-en="data.nameEN"
|
||||||
|
v-model:contact-name="data.contactName"
|
||||||
|
v-model:email="data.contactEmail"
|
||||||
|
v-model:contact-tel="data.contactTel"
|
||||||
/>
|
/>
|
||||||
<AddressForm
|
<AddressForm
|
||||||
id="agencies-address-info"
|
id="agencies-form-address-info"
|
||||||
dense
|
dense
|
||||||
:prefix-id="''"
|
:prefix-id="''"
|
||||||
v-model:address="data.address"
|
v-model:address="data.address"
|
||||||
|
|
@ -297,6 +322,14 @@ watch(
|
||||||
v-model:district-id="data.districtId"
|
v-model:district-id="data.districtId"
|
||||||
v-model:sub-district-id="data.subDistrictId"
|
v-model:sub-district-id="data.subDistrictId"
|
||||||
/>
|
/>
|
||||||
|
<FormBank
|
||||||
|
id="agencies-form-bank-info"
|
||||||
|
title="agencies.bankInfo"
|
||||||
|
class="q-pt-xl"
|
||||||
|
dense
|
||||||
|
single
|
||||||
|
v-model:bank-book-list="formBankBook"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DialogForm>
|
</DialogForm>
|
||||||
|
|
@ -427,13 +460,17 @@ watch(
|
||||||
name: $t('general.address'),
|
name: $t('general.address'),
|
||||||
anchor: 'agencies-address-info',
|
anchor: 'agencies-address-info',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: $t('agencies.bankInfo'),
|
||||||
|
anchor: 'agencies-bank-info',
|
||||||
|
},
|
||||||
]"
|
]"
|
||||||
background="transparent"
|
background="transparent"
|
||||||
:active="{
|
:active="{
|
||||||
background: 'hsla(var(--blue-6-hsl) / .2)',
|
background: 'hsla(var(--blue-6-hsl) / .2)',
|
||||||
foreground: 'var(--blue-6)',
|
foreground: 'var(--blue-6)',
|
||||||
}"
|
}"
|
||||||
scroll-element="#agencies-form-content"
|
scroll-element="#agencies-view-content"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -444,7 +481,7 @@ watch(
|
||||||
'q-py-md q-pr-md ': $q.screen.gt.sm,
|
'q-py-md q-pr-md ': $q.screen.gt.sm,
|
||||||
'q-pa-sm': !$q.screen.gt.sm,
|
'q-pa-sm': !$q.screen.gt.sm,
|
||||||
}"
|
}"
|
||||||
id="user-form-content"
|
id="agencies-view-content"
|
||||||
style="height: 100%; max-height: 100; overflow-y: auto"
|
style="height: 100%; max-height: 100; overflow-y: auto"
|
||||||
>
|
>
|
||||||
<FormBasicInfoAgencies
|
<FormBasicInfoAgencies
|
||||||
|
|
@ -455,6 +492,9 @@ watch(
|
||||||
v-model:group="data.group"
|
v-model:group="data.group"
|
||||||
v-model:name="data.name"
|
v-model:name="data.name"
|
||||||
v-model:name-en="data.nameEN"
|
v-model:name-en="data.nameEN"
|
||||||
|
v-model:contact-name="data.contactName"
|
||||||
|
v-model:email="data.contactEmail"
|
||||||
|
v-model:contact-tel="data.contactTel"
|
||||||
/>
|
/>
|
||||||
<AddressForm
|
<AddressForm
|
||||||
id="agencies-address-info"
|
id="agencies-address-info"
|
||||||
|
|
@ -473,6 +513,15 @@ watch(
|
||||||
v-model:district-id="data.districtId"
|
v-model:district-id="data.districtId"
|
||||||
v-model:sub-district-id="data.subDistrictId"
|
v-model:sub-district-id="data.subDistrictId"
|
||||||
/>
|
/>
|
||||||
|
<FormBank
|
||||||
|
id="agencies-bank-info"
|
||||||
|
title="agencies.bankInfo"
|
||||||
|
class="q-pt-xl"
|
||||||
|
dense
|
||||||
|
single
|
||||||
|
:readonly
|
||||||
|
v-model:bank-book-list="formBankBook"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,9 @@ const blankFormData: InstitutionPayload = {
|
||||||
code: '',
|
code: '',
|
||||||
name: '',
|
name: '',
|
||||||
nameEN: '',
|
nameEN: '',
|
||||||
|
contactName: '',
|
||||||
|
contactEmail: '',
|
||||||
|
contactTel: '',
|
||||||
addressEN: '',
|
addressEN: '',
|
||||||
address: '',
|
address: '',
|
||||||
soi: '',
|
soi: '',
|
||||||
|
|
@ -98,6 +101,16 @@ const blankFormData: InstitutionPayload = {
|
||||||
provinceId: '',
|
provinceId: '',
|
||||||
selectedImage: '',
|
selectedImage: '',
|
||||||
status: 'CREATED',
|
status: 'CREATED',
|
||||||
|
bank: [
|
||||||
|
{
|
||||||
|
bankName: '',
|
||||||
|
accountNumber: '',
|
||||||
|
bankBranch: '',
|
||||||
|
accountName: '',
|
||||||
|
accountType: '',
|
||||||
|
currentlyUse: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all');
|
const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all');
|
||||||
|
|
@ -160,6 +173,19 @@ function assignFormData(data: Institution) {
|
||||||
provinceId: data.provinceId,
|
provinceId: data.provinceId,
|
||||||
selectedImage: data.selectedImage,
|
selectedImage: data.selectedImage,
|
||||||
status: data.status,
|
status: data.status,
|
||||||
|
contactEmail: data.contactEmail,
|
||||||
|
contactName: data.contactName,
|
||||||
|
contactTel: data.contactTel,
|
||||||
|
bank: [
|
||||||
|
{
|
||||||
|
bankName: data.bank[0]?.bankName,
|
||||||
|
accountNumber: data.bank[0]?.accountNumber,
|
||||||
|
bankBranch: data.bank[0]?.bankBranch,
|
||||||
|
accountName: data.bank[0]?.accountName,
|
||||||
|
accountType: data.bank[0]?.accountType,
|
||||||
|
currentlyUse: data.bank[0]?.currentlyUse,
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,6 +195,9 @@ async function submit(opt?: { selectedImage: string }) {
|
||||||
code: formData.value.code,
|
code: formData.value.code,
|
||||||
name: formData.value.name,
|
name: formData.value.name,
|
||||||
nameEN: formData.value.nameEN,
|
nameEN: formData.value.nameEN,
|
||||||
|
contactName: formData.value.contactName,
|
||||||
|
contactEmail: formData.value.contactEmail,
|
||||||
|
contactTel: formData.value.contactTel,
|
||||||
addressEN: formData.value.addressEN,
|
addressEN: formData.value.addressEN,
|
||||||
address: formData.value.address,
|
address: formData.value.address,
|
||||||
soi: formData.value.soi,
|
soi: formData.value.soi,
|
||||||
|
|
@ -181,6 +210,14 @@ async function submit(opt?: { selectedImage: string }) {
|
||||||
districtId: formData.value.districtId,
|
districtId: formData.value.districtId,
|
||||||
provinceId: formData.value.provinceId,
|
provinceId: formData.value.provinceId,
|
||||||
status: formData.value.status,
|
status: formData.value.status,
|
||||||
|
bank: formData.value.bank.map((v) => ({
|
||||||
|
bankName: v.bankName,
|
||||||
|
accountNumber: v.accountNumber,
|
||||||
|
bankBranch: v.bankBranch,
|
||||||
|
accountName: v.accountName,
|
||||||
|
accountType: v.accountType,
|
||||||
|
currentlyUse: v.currentlyUse,
|
||||||
|
})),
|
||||||
};
|
};
|
||||||
if (
|
if (
|
||||||
(pageState.isDrawerEdit && currAgenciesData.value?.id) ||
|
(pageState.isDrawerEdit && currAgenciesData.value?.id) ||
|
||||||
|
|
@ -922,6 +959,7 @@ watch(
|
||||||
v-model="pageState.addModal"
|
v-model="pageState.addModal"
|
||||||
v-model:drawer-model="pageState.viewDrawer"
|
v-model:drawer-model="pageState.viewDrawer"
|
||||||
v-model:data="formData"
|
v-model:data="formData"
|
||||||
|
v-model:form-bank-book="formData.bank"
|
||||||
v-model:on-create-image-list="onCreateImageList"
|
v-model:on-create-image-list="onCreateImageList"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue