This commit is contained in:
@@ -339,7 +339,9 @@ todo: many biz objects are not using new PUT methodology
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
CURRENTLY DOING: WorkOrderItemTravel
|
CURRENTLY DOING: bugbug: saving header only (setting onsite for example) is triggering a full fetch of entire workorder every time...WTF, supposed to be just a few fields that cause that
|
||||||
|
|
||||||
|
Next: WorkOrderItemTravel
|
||||||
|
|
||||||
ORDER: Travel, tasks, parts, loans, units, outside service
|
ORDER: Travel, tasks, parts, loans, units, outside service
|
||||||
|
|
||||||
@@ -353,6 +355,7 @@ todo: "DispatchFull" and "DispatchLimited" roles MUST be renamed to "ServiceFull
|
|||||||
Rename at both ends and all translations and docs as well.
|
Rename at both ends and all translations and docs as well.
|
||||||
|
|
||||||
todo: strip all *viz fields from object before sending over the wire from client to server
|
todo: strip all *viz fields from object before sending over the wire from client to server
|
||||||
|
Setting their value to undefined stops them being sent so do that, but remember they then need to be updated on the return record
|
||||||
|
|
||||||
|
|
||||||
TODO: test new from scratch wo regularly
|
TODO: test new from scratch wo regularly
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ export default {
|
|||||||
window.$gz.form.setErrorBoxErrors(vm);
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
} else {
|
} else {
|
||||||
vm.obj = res.data;
|
vm.obj = res.data;
|
||||||
|
|
||||||
vm.lastGetContractId = vm.obj.contractId; //preserve for triggering full update if something changes it later
|
vm.lastGetContractId = vm.obj.contractId; //preserve for triggering full update if something changes it later
|
||||||
vm.lastGetCustomerId = vm.obj.customerId; //preserve for triggering full update if something changes it later
|
vm.lastGetCustomerId = vm.obj.customerId; //preserve for triggering full update if something changes it later
|
||||||
|
|
||||||
@@ -527,8 +528,8 @@ export default {
|
|||||||
//check if full refresh is necessary
|
//check if full refresh is necessary
|
||||||
|
|
||||||
if (
|
if (
|
||||||
vm.obj.contractId != vm.obj.lastGetContractId ||
|
vm.obj.contractId != vm.lastGetContractId ||
|
||||||
vm.obj.customerId != vm.obj.lastGetCustomerId
|
vm.obj.customerId != vm.lastGetCustomerId
|
||||||
) {
|
) {
|
||||||
//there may be others which is why I'm doing it this way with the extra variable
|
//there may be others which is why I'm doing it this way with the extra variable
|
||||||
forceFullRefresh = true;
|
forceFullRefresh = true;
|
||||||
@@ -654,35 +655,28 @@ async function saveHeader(vm) {
|
|||||||
//https://stackoverflow.com/a/58206483/8939
|
//https://stackoverflow.com/a/58206483/8939
|
||||||
const { items: removedKey1, states: removedKey2, ...headerOnly } = vm.obj;
|
const { items: removedKey1, states: removedKey2, ...headerOnly } = vm.obj;
|
||||||
|
|
||||||
|
//remove *Viz keys so they don't generate traffic
|
||||||
|
headerOnly.alertViz = undefined;
|
||||||
|
headerOnly.projectViz = undefined;
|
||||||
|
headerOnly.contractViz = undefined;
|
||||||
|
headerOnly.customerViz = undefined;
|
||||||
|
|
||||||
let res = await window.$gz.api.upsert(`${API_BASE_URL}`, headerOnly);
|
let res = await window.$gz.api.upsert(`${API_BASE_URL}`, headerOnly);
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
//if (isPost) { //NO IDEA WHY THIS WAS HERE< NEEDS REVISIT PROBABLY
|
|
||||||
handleSaveError(vm, { fatal: true, error: res.error });
|
handleSaveError(vm, { fatal: true, error: res.error });
|
||||||
// }else
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
|
||||||
} else {
|
} else {
|
||||||
//update any server changed fields
|
//update any server changed fields
|
||||||
vm.obj.concurrency = res.data.concurrency;
|
vm.obj.concurrency = res.data.concurrency;
|
||||||
vm.obj.isDirty = false;
|
vm.obj.isDirty = false;
|
||||||
vm.obj.alertViz = res.data.alertViz;
|
|
||||||
vm.obj.customerId = res.data.customerId;
|
vm.obj.customerId = res.data.customerId;
|
||||||
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
|
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
|
//repopulate *viz fields from return value
|
||||||
// //as undefined won't
|
vm.obj.alertViz = res.data.alertViz;
|
||||||
// console.log("Header save, return data is: ", res.data);
|
vm.obj.projectViz = res.data.projectViz;
|
||||||
// //copy return data into a variable called 'o' but exclude states and items keys
|
vm.obj.contractViz = res.data.contractViz;
|
||||||
// const { states: removedKey1, items: removedKey2, ...o } = res.data;
|
vm.obj.customerViz = res.data.customerViz;
|
||||||
|
|
||||||
// console.log("Header save, o is: ", o);
|
|
||||||
|
|
||||||
// //now we can set the header to o safely without wiping the child collections
|
|
||||||
// //this will only copy the existing properties in o to vm.obj
|
|
||||||
// Object.assign(vm.obj, o);
|
|
||||||
|
|
||||||
// console.log("Header save, vm.obj is: ", vm.obj);
|
|
||||||
|
|
||||||
if (isPost) {
|
if (isPost) {
|
||||||
vm.obj.id = res.data.id;
|
vm.obj.id = res.data.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user