feat/fix: new component(select input/zone, quoCard)

This commit is contained in:
puriphatt 2024-09-23 15:03:54 +07:00
parent 08068137af
commit c04039d8a7
7 changed files with 332 additions and 37 deletions

View file

@ -76,18 +76,28 @@ const fullAddress = computed(() => {
if (moo.value) addressParts.push(`${t('form.moo')} ${moo.value}`);
if (soi.value) addressParts.push(`${t('form.soi')} ${soi.value}`);
if (street.value) addressParts.push(`${t('form.street')} ${street.value}`);
if (street.value) addressParts.push(`${t('form.road')} ${street.value}`);
if (subDistrictId.value && sDistrict) {
addressParts.push(typeof sDistrict.name === 'string' ? sDistrict.name : '');
addressParts.push(
typeof sDistrict.name === 'string'
? `${t('form.subDistrict')} ${sDistrict.name}`
: '',
);
}
if (districtId.value && district)
addressParts.push(typeof district.name === 'string' ? district.name : '');
addressParts.push(
typeof district.name === 'string'
? `${t('form.district')} ${district.name}`
: '',
);
if (provinceId.value && province) {
addressParts.push(
typeof province.name === 'string' ? `${province.name}` : '',
typeof province.name === 'string'
? `${t('form.province')} ${province.name}`
: '',
);
sDistrict &&
addressParts.push(
@ -99,26 +109,26 @@ const fullAddress = computed(() => {
});
const fullAddressEN = computed(() => {
const addressParts = [addressEN.value];
const addressParts = [`${addressEN.value},`];
const province = provinceOptions.value.find((v) => v.id === provinceId.value);
const district = districtOptions.value.find((v) => v.id === districtId.value);
const sDistrict = subDistrictOptions.value.find(
(v) => v.id === subDistrictId.value,
);
if (mooEN.value) addressParts.push(`Moo ${mooEN.value}`);
if (soiEN.value) addressParts.push(`Soi ${soiEN.value}`);
if (streetEN.value) addressParts.push(`${streetEN.value} Street`);
if (mooEN.value) addressParts.push(`Moo ${mooEN.value},`);
if (soiEN.value) addressParts.push(`Soi ${soiEN.value},`);
if (streetEN.value) addressParts.push(`${streetEN.value} Rd.`);
if (subDistrictId.value && sDistrict) {
addressParts.push(
typeof sDistrict.nameEN === 'string' ? sDistrict.nameEN : '',
typeof sDistrict.nameEN === 'string' ? `${sDistrict.nameEN},` : '',
);
}
if (districtId.value && district)
addressParts.push(
typeof district.nameEN === 'string' ? district.nameEN : '',
typeof district.nameEN === 'string' ? `${district.nameEN},` : '',
);
if (provinceId.value && province) {
@ -397,7 +407,7 @@ watch(districtId, fetchSubDistrict);
class="col-md-3 col-6"
:model-value="readonly ? street || '-' : street"
:dense="dense"
:label="$t('form.street')"
:label="$t('form.road')"
:readonly="readonly || sameWithEmployer"
:for="`${prefixId}-${indexId !== undefined ? `input-street-${indexId}` : 'input-street'}`"
@update:model-value="
@ -552,7 +562,13 @@ watch(districtId, fetchSubDistrict);
outlined
hide-bottom-space
class="col-12"
:model-value="address ? fullAddress : ''"
:model-value="
address
? $i18n.locale === 'eng'
? fullAddressEN
: fullAddress
: ''
"
:dense="dense"
:label="$t('form.fullAddress')"
readonly
@ -635,7 +651,7 @@ watch(districtId, fetchSubDistrict);
class="col-md-3 col-6"
:model-value="readonly ? streetEN || '-' : streetEN"
:dense="dense"
label="Street"
label="Road"
:readonly="readonly || sameWithEmployer"
:for="`${prefixId}-${indexId !== undefined ? `input-street-${indexId}` : 'input-street'}`"
@update:model-value="