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

@@ -345,17 +345,22 @@ CURRENTLY DOING: labors
todo: address setting - rather than setting it *at* the client automatically shouldn't it set at the server automatically?
this would remove some weight from the client and with a forcefullrefresh system in place that will help with this as well.
todo: customer change is fetching both address and alert notes at the same time
since server detects change anyway couldn't that be part of the refresh?? or is that too much?
todo: since a contract change is resulting in refresh no need to retun the full object, just a flag that says refresh maybe??
todo: check contract expiry for applying!!
todo: Test back end correctly sets contract on new wo and correctly sets response time (complete by date) on NEW workorder
todo: remove contract control entirely from code
todo:
todo: Server new wo auto contract resolution code,
if NEW record and contractid already set then use that otherwise find effective one and set (only way it's set automatically)
todo: alert notes should show the object name and type above the notes for quick clarity
todo: replicate labor save code at front and back to the other contracted objects

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;
// }
// }
// }
// }
}
}
},

View File

@@ -663,6 +663,7 @@ async function saveHeader(vm) {
//update any server changed fields
vm.obj.concurrency = res.data.concurrency;
vm.obj.isDirty = false;
vm.obj.alertViz = res.data.alertViz;
vm.obj.contractId = res.data.contractId; //may or may not have changed at server, this will ensure entire ui gets updated if it has as all prices may have changed and other stuff
// //this sets 'o' to all values in assigned *except* the ones itemized with removedKey which is a fake key and just used for this trick to work