From 7ba0f901d02ac2149cf29cc787fdc72b08e2d513 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 2 Jun 2021 18:06:42 +0000 Subject: [PATCH] --- ayanova/src/views/svc-workorder.vue | 46 ++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index b71f5a93..2e7608cf 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -1475,16 +1475,28 @@ async function saveLoans(vm, woItemIndex) { } for (let i = 0; i < vm.obj.items[woItemIndex].loans.length; i++) { - let o = vm.obj.items[woItemIndex].loans[i]; - if (o.isDirty) { - //const isPost = o.id == 0; - let res = await window.$gz.api.upsert(`${API_BASE_URL}items/loans`, o); + if (vm.obj.items[woItemIndex].loans[i].isDirty) { + const o = vm.obj.items[woItemIndex].loans[i]; + const uid = o.uid; + //strip out viz fields before sending + o.isDirty = undefined; + o.uid = undefined; + o.taxCodeViz = undefined; + o.loanUnitViz = undefined; + o.unitOfMeasureViz = undefined; + o.priceViz = undefined; + o.netViz = undefined; + o.taxAViz = undefined; + o.taxBViz = undefined; + o.lineTotalViz = undefined; + + const res = await window.$gz.api.upsert(`${API_BASE_URL}items/loans`, o); if (res.error) { handleSaveError(vm, { error: res.error, itemUid: vm.obj.items[woItemIndex].uid, childKey: "loans", - childUid: o.uid + childUid: uid }); } else { //Server will update fields on put or post for most workorder graph objecs so need to update entire object here @@ -1538,10 +1550,24 @@ async function saveOutsideServices(vm, woItemIndex) { } for (let i = 0; i < vm.obj.items[woItemIndex].outsideServices.length; i++) { - let o = vm.obj.items[woItemIndex].outsideServices[i]; - if (o.isDirty) { - //const isPost = o.id == 0; - let res = await window.$gz.api.upsert( + if (vm.obj.items[woItemIndex].outsideServices[i].isDirty) { + const o = vm.obj.items[woItemIndex].outsideServices[i]; + const uid = o.uid; + //strip out viz fields before sending + o.isDirty = undefined; + o.uid = undefined; + o.unitViz = undefined; + o.vendorSentToViz = undefined; + o.vendorSentViaViz = undefined; + o.taxCodeViz = undefined; + o.costViz = undefined; + o.priceViz = undefined; + o.netViz = undefined; + o.taxAViz = undefined; + o.taxBViz = undefined; + o.lineTotalViz = undefined; + + const res = await window.$gz.api.upsert( `${API_BASE_URL}items/outside-services`, o ); @@ -1550,7 +1576,7 @@ async function saveOutsideServices(vm, woItemIndex) { error: res.error, itemUid: vm.obj.items[woItemIndex].uid, childKey: "outsideServices", - childUid: o.uid + childUid: uid }); } else { //Server will update fields on put or post for most workorder graph objecs so need to update entire object here