diff --git a/ayanova/src/components/work-order-item-units.vue b/ayanova/src/components/work-order-item-units.vue index 9c0bbbef..915c6359 100644 --- a/ayanova/src/components/work-order-item-units.vue +++ b/ayanova/src/components/work-order-item-units.vue @@ -401,17 +401,15 @@ export default { "warrantyExpiryDate":"2019-04-12T09:37:52.930923Z", "warrantyTerms":"Shipping parts and service"} */ - this.$nextTick(() => { - this.value.items[this.activeWoItemIndex].units[ - this.activeItemIndex - ].warrantyViz = JSON.stringify(res.data); - }); + this.value.items[this.activeWoItemIndex].units[ + this.activeItemIndex + ].warrantyViz = JSON.stringify(res.data); - // console.log( - // "warrantyviz:", - // this.value.items[this.activeWoItemIndex].units[this.activeItemIndex] - // .warrantyViz - // ); + console.log( + "warrantyviz:", + this.value.items[this.activeWoItemIndex].units[this.activeItemIndex] + .warrantyViz + ); } }, showBulkUnitsDialog() { diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index 0812cdd7..b6ede89b 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -430,14 +430,9 @@ export default { vm.formState.serverError = res.error; window.$gz.form.setErrorBoxErrors(vm); } else { - vm.obj = res.data; - - 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 - //assign opening values - vm.obj.isDirty = false; - vm.obj.items.forEach((z, index) => { + res.data.isDirty = false; + res.data.items.forEach((z, index) => { z.uid = index; z.isDirty = false; z.expenses.forEach((x, index) => { @@ -475,6 +470,7 @@ export default { z.units.forEach((x, index) => { x.uid = index; x.isDirty = false; + x.warrantyViz = null; //locally added field for reactivity, set on demand in UI not by server }); z.outsideServices.forEach((x, index) => { x.uid = index; @@ -482,6 +478,11 @@ export default { }); }); + //insert into vue data + vm.obj = res.data; + 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 + //modify the menu as necessary generateMenu(vm); //update which areas are available to user @@ -1042,6 +1043,7 @@ async function saveUnits(vm, woItemIndex) { } else { //Server will update fields on put or post for most workorder graph objecs so need to update entire object here res.data.isDirty = false; //prime isDirty to detect future edits + res.data.warrantyViz = null; //Add local key so it's reactive in vue vm.obj.items[woItemIndex].units.splice(i, 1, res.data); //vue needs the splice rather than just setting the value in order to trigger reactivity or else the UI won't update } }