refactor: handle adress bangkok
This commit is contained in:
parent
58fc722c41
commit
fb1c0e9590
1 changed files with 22 additions and 9 deletions
|
|
@ -75,29 +75,36 @@ const { t } = useI18n();
|
||||||
const fullAddress = computed(() => {
|
const fullAddress = computed(() => {
|
||||||
const addressParts = [`${address.value},`];
|
const addressParts = [`${address.value},`];
|
||||||
const province = provinceOptions.value.find((v) => v.id === provinceId.value);
|
const province = provinceOptions.value.find((v) => v.id === provinceId.value);
|
||||||
|
|
||||||
const district = districtOptions.value.find((v) => v.id === districtId.value);
|
const district = districtOptions.value.find((v) => v.id === districtId.value);
|
||||||
const sDistrict = subDistrictOptions.value.find(
|
const sDistrict = subDistrictOptions.value.find(
|
||||||
(v) => v.id === subDistrictId.value,
|
(v) => v.id === subDistrictId.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (moo.value) addressParts.push(`${t('form.moo')} ${moo.value},`);
|
if (moo.value) addressParts.push(`หมู่ ${moo.value},`);
|
||||||
if (soi.value) addressParts.push(`${t('form.soi')} ${soi.value},`);
|
if (soi.value) addressParts.push(`ซอย ${soi.value},`);
|
||||||
if (street.value) addressParts.push(`${t('form.road')} ${street.value},`);
|
if (street.value) addressParts.push(`ถนน ${street.value},`);
|
||||||
|
|
||||||
if (subDistrictId.value && sDistrict) {
|
if (subDistrictId.value && sDistrict) {
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
typeof sDistrict.name === 'string' ? `${sDistrict.name},` : '',
|
typeof sDistrict.name === 'string'
|
||||||
|
? `${!!province && province.id === '10' ? t('addressBangkok.subdistrict') : t('address.subdistrict')} ${sDistrict.name},`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (districtId.value && district)
|
if (districtId.value && district)
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
typeof district.name === 'string' ? `${district.name},` : '',
|
typeof district.name === 'string'
|
||||||
|
? `${!!province && province.id === '10' ? t('addressBangkok.district') : t('address.district')} ${district.name},`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (provinceId.value && province) {
|
if (provinceId.value && province) {
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
typeof province.name === 'string' ? `${province.name}` : '',
|
typeof province.name === 'string'
|
||||||
|
? ` ${!!province && province.id === '10' ? t('addressBangkok.province') : t('address.province')} ${province.name}`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
sDistrict &&
|
sDistrict &&
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
|
|
@ -122,18 +129,24 @@ const fullAddressEN = computed(() => {
|
||||||
|
|
||||||
if (subDistrictId.value && sDistrict) {
|
if (subDistrictId.value && sDistrict) {
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
typeof sDistrict.nameEN === 'string' ? `${sDistrict.nameEN},` : '',
|
typeof sDistrict.nameEN === 'string'
|
||||||
|
? `${sDistrict.nameEN} ${t('addressEn.subdistrict')},`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (districtId.value && district)
|
if (districtId.value && district)
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
typeof district.nameEN === 'string' ? `${district.nameEN},` : '',
|
typeof district.nameEN === 'string'
|
||||||
|
? `${district.nameEN} ${t('addressEn.district')}`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (provinceId.value && province) {
|
if (provinceId.value && province) {
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
typeof province.nameEN === 'string' ? `${province.nameEN}` : '',
|
typeof province.nameEN === 'string'
|
||||||
|
? `${province.nameEN} ${t('addressEn.province')}`
|
||||||
|
: '',
|
||||||
);
|
);
|
||||||
sDistrict &&
|
sDistrict &&
|
||||||
addressParts.push(
|
addressParts.push(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue