fix: address

This commit is contained in:
puriphatt 2024-09-24 11:23:16 +07:00
parent ea28bd7e2b
commit 2fd669b573
3 changed files with 13 additions and 17 deletions

View file

@ -67,37 +67,31 @@ const addrOptions = reactive<{
const { t } = useI18n(); 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(`${t('form.moo')} ${moo.value},`);
if (soi.value) addressParts.push(`${t('form.soi')} ${soi.value}`); if (soi.value) addressParts.push(`${t('form.soi')} ${soi.value},`);
if (street.value) addressParts.push(`${t('form.road')} ${street.value}`); if (street.value) addressParts.push(`${t('form.road')} ${street.value},`);
if (subDistrictId.value && sDistrict) { if (subDistrictId.value && sDistrict) {
addressParts.push( addressParts.push(
typeof sDistrict.name === 'string' typeof sDistrict.name === 'string' ? `${sDistrict.name},` : '',
? `${t('form.subDistrict')} ${sDistrict.name}`
: '',
); );
} }
if (districtId.value && district) if (districtId.value && district)
addressParts.push( addressParts.push(
typeof district.name === 'string' typeof district.name === 'string' ? `${district.name},` : '',
? `${t('form.district')} ${district.name}`
: '',
); );
if (provinceId.value && province) { if (provinceId.value && province) {
addressParts.push( addressParts.push(
typeof province.name === 'string' typeof province.name === 'string' ? `${province.name}` : '',
? `${t('form.province')} ${province.name}`
: '',
); );
sDistrict && sDistrict &&
addressParts.push( addressParts.push(

View file

@ -1472,7 +1472,7 @@ watch(currentHq, () => {
locale === 'eng' locale === 'eng'
? `${props.row.addressEN}, ${props.row.mooEN && `${$t('form.moo')} ${props.row.mooEN},`} ${props.row.soiEN && `${$t('form.soi')} ${props.row.soiEN},`} ${props.row.moo && `${props.row.streetEN} Rd,`} ${props.row.subDistrict.nameEN}, ${props.row.district.nameEN}, ${props.row.province.nameEN} ${props.row.subDistrict.zipCode}` || ? `${props.row.addressEN}, ${props.row.mooEN && `${$t('form.moo')} ${props.row.mooEN},`} ${props.row.soiEN && `${$t('form.soi')} ${props.row.soiEN},`} ${props.row.moo && `${props.row.streetEN} Rd,`} ${props.row.subDistrict.nameEN}, ${props.row.district.nameEN}, ${props.row.province.nameEN} ${props.row.subDistrict.zipCode}` ||
'-' '-'
: `${props.row.address} ${props.row.moo && `${$t('form.moo')} ${props.row.moo}`} ${props.row.soi && `${$t('form.soi')} ${props.row.soi}`} ${props.row.street && `${$t('form.road')} ${props.row.street}`} ${$t('form.subDistrict')} ${props.row.subDistrict.name} ${$t('form.district')} ${props.row.district.name} ${$t('form.province')} ${props.row.province.name} ${props.row.subDistrict.zipCode}` || : `${props.row.address} ${props.row.moo && `${$t('form.moo')} ${props.row.moo},`} ${props.row.soi && `${$t('form.soi')} ${props.row.soi},`} ${props.row.street && `${$t('form.road')} ${props.row.street},`} ${props.row.subDistrict.name}, ${props.row.district.name}, ${props.row.province.name} ${props.row.subDistrict.zipCode}` ||
'-' '-'
}} }}
</q-td> </q-td>
@ -1586,8 +1586,10 @@ watch(currentHq, () => {
contactName: props.row.contactName || '-', contactName: props.row.contactName || '-',
branchLabelAddress: branchLabelAddress:
$i18n.locale === 'eng' $i18n.locale === 'eng'
? `${props.row.addressEN} ${props.row.mooEN && `Moo ${props.row.mooEN}`} ${props.row.soiEN && `Soi ${props.row.soiEN}`} ${props.row.streetEN && `${props.row.streetEN} Street`} ${props.row.subDistrict.nameEN} ${props.row.district.nameEN} ${props.row.province.nameEN} ${props.row.subDistrict.zipCode}` ? `${props.row.addressEN}, ${props.row.mooEN && `${$t('form.moo')} ${props.row.mooEN},`} ${props.row.soiEN && `${$t('form.soi')} ${props.row.soiEN},`} ${props.row.moo && `${props.row.streetEN} Rd,`} ${props.row.subDistrict.nameEN}, ${props.row.district.nameEN}, ${props.row.province.nameEN} ${props.row.subDistrict.zipCode}` ||
: `${props.row.address} ${props.row.moo && `หมู่ ${props.row.moo}`} ${props.row.soi && `ซอย ${props.row.soi}`} ${props.row.street && `ถนน ${props.row.street}`} ต.${props.row.subDistrict.name} อ.${props.row.district.name} จ.${props.row.province.name} ${props.row.subDistrict.zipCode}`, '-'
: `${props.row.address} ${props.row.moo && `${$t('form.moo')} ${props.row.moo},`} ${props.row.soi && `${$t('form.soi')} ${props.row.soi},`} ${props.row.street && `${$t('form.road')} ${props.row.street},`} ${props.row.subDistrict.name}, ${props.row.district.name}, ${props.row.province.name} ${props.row.subDistrict.zipCode}` ||
'-',
branchImgUrl: `/branch/${props.row.id}/branch`, branchImgUrl: `/branch/${props.row.id}/branch`,
}" }"
:field-selected="fieldSelected" :field-selected="fieldSelected"

View file

@ -1275,7 +1275,7 @@ const emptyCreateDialog = ref(false);
locale === 'eng' locale === 'eng'
? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` || ? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` ||
'-' '-'
: `${props.row.branch[0].address} ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo}`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi}`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street}`} ${$t('form.subDistrict')} ${props.row.branch[0].subDistrict.name} ${$t('form.district')} ${props.row.branch[0].district.name} ${$t('form.province')} ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` || : `${props.row.branch[0].address}, ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo},`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi},`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street},`} ${props.row.branch[0].subDistrict.name}, ${props.row.branch[0].district.name}, ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` ||
'-' '-'
}} }}
</q-td> </q-td>