This commit is contained in:
2021-05-17 23:58:44 +00:00
parent c19977dd10
commit fdf7791a94
3 changed files with 58 additions and 52 deletions

View File

@@ -348,58 +348,58 @@ export default {
this.value.isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref);
if (ref == "customerId") {
this.value.alertViz = null;
const custId = this.value.customerId;
if (custId != null) {
//------ Alert notes
let res = await window.$gz.api.get(`customer/alert/${custId}`);
if (res.data) {
this.value.alertViz = res.data;
}
//------ Addresses
res = await window.$gz.api.get(`customer/address/${custId}`);
if (res.data) {
//Addresses are considered non-empty if the PostAddress or Address field is not empty
// if (ref == "customerId") {
// this.value.alertViz = null;
// const custId = this.value.customerId;
// if (custId != null) {
// //------ Alert notes
// let res = await window.$gz.api.get(`customer/alert/${custId}`);
// if (res.data) {
// this.value.alertViz = res.data;
// }
// //------ Addresses
// res = await window.$gz.api.get(`customer/address/${custId}`);
// if (res.data) {
// //Addresses are considered non-empty if the PostAddress or Address field is not empty
//Set Billing address
if (
!window.$gz.util.stringIsNullOrEmpty(
res.data.headofficepost.postAddress
)
) {
//Use head office bill to address
this.value.postAddress = res.data.headofficepost.postAddress;
this.value.postCity = res.data.headofficepost.postCity;
this.value.postRegion = res.data.headofficepost.postRegion;
this.value.postCountry = res.data.headofficepost.postCountry;
this.value.postCode = res.data.headofficepost.postCode;
} else {
//Use customer postal address, if it's empty then it's empty
this.value.postAddress = res.data.customerpost.postAddress;
this.value.postCity = res.data.customerpost.postCity;
this.value.postRegion = res.data.customerpost.postRegion;
this.value.postCountry = res.data.customerpost.postCountry;
this.value.postCode = res.data.customerpost.postCode;
}
// //Set Billing address
// if (
// !window.$gz.util.stringIsNullOrEmpty(
// res.data.headofficepost.postAddress
// )
// ) {
// //Use head office bill to address
// this.value.postAddress = res.data.headofficepost.postAddress;
// this.value.postCity = res.data.headofficepost.postCity;
// this.value.postRegion = res.data.headofficepost.postRegion;
// this.value.postCountry = res.data.headofficepost.postCountry;
// this.value.postCode = res.data.headofficepost.postCode;
// } else {
// //Use customer postal address, if it's empty then it's empty
// this.value.postAddress = res.data.customerpost.postAddress;
// this.value.postCity = res.data.customerpost.postCity;
// this.value.postRegion = res.data.customerpost.postRegion;
// this.value.postCountry = res.data.customerpost.postCountry;
// this.value.postCode = res.data.customerpost.postCode;
// }
//Set service address
if (
!window.$gz.util.stringIsNullOrEmpty(
res.data.customerphys.address
)
) {
//Use head office bill to address
this.value.address = res.data.customerphys.address;
this.value.city = res.data.customerphys.city;
this.value.region = res.data.customerphys.region;
this.value.country = res.data.customerphys.country;
this.value.latitude = res.data.customerphys.latitude;
this.value.longitude = res.data.customerphys.longitude;
}
}
}
}
// //Set service address
// if (
// !window.$gz.util.stringIsNullOrEmpty(
// res.data.customerphys.address
// )
// ) {
// //Use head office bill to address
// this.value.address = res.data.customerphys.address;
// this.value.city = res.data.customerphys.city;
// this.value.region = res.data.customerphys.region;
// this.value.country = res.data.customerphys.country;
// this.value.latitude = res.data.customerphys.latitude;
// this.value.longitude = res.data.customerphys.longitude;
// }
// }
// }
// }
}
}
},