From d3ed4724c3c4df6cf61a227d82ee6633844360b9 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 2 Jun 2021 00:02:16 +0000 Subject: [PATCH] --- .../work-order-item-scheduled-users.vue | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/ayanova/src/components/work-order-item-scheduled-users.vue b/ayanova/src/components/work-order-item-scheduled-users.vue index 860a3f30..8904abe3 100644 --- a/ayanova/src/components/work-order-item-scheduled-users.vue +++ b/ayanova/src/components/work-order-item-scheduled-users.vue @@ -396,22 +396,24 @@ export default { ].id == 0; //Auto calculate dates / quantities / global defaults + const dStart = this.value.items[this.activeWoItemIndex].scheduledUsers[ + this.activeItemIndex + ].startDate; + const dStop = this.value.items[this.activeWoItemIndex].scheduledUsers[ + this.activeItemIndex + ].stopDate; if (ref.includes("startDate")) { - this.handleStartDateChange(isNew); + this.handleStartDateChange(isNew, dStart, dStop); } if (ref.includes("stopDate")) { - this.handleStopDateChange(isNew); + this.handleStopDateChange(isNew, dStart, dStop); } if (ref.includes("estimatedQuantity")) { - this.handleEstimatedQuantityChange(isNew); + this.handleEstimatedQuantityChange(isNew, dStart, dStop); } } }, - handleStartDateChange: function(isNew) { - const dStart = this.value.items[this.activeWoItemIndex].scheduledUsers[ - this.activeItemIndex - ].startDate; - + handleStartDateChange: function(isNew, dStart, dStop) { if (isNew) { // (ONLY IF GLOBAL DEFAULT QTY) enter start date when stop date is null then it will add global default to start and set stop and qty // (ONLY IF GLOBAL DEFAULT QTY) enter stop date when start date is null then it will back calc and set start and qty based on global default @@ -424,25 +426,19 @@ export default { } let d = window.$gz.locale.addMinutesToUTC8601String(dStart); } else { - const dStop = this.value.items[this.activeWoItemIndex].scheduledUsers[ - this.activeItemIndex - ].stopDate; // Existing // update quantity when dates change or update stop date when quantity changes to match // no consideration for global default, once it's made that shit doesn't apply - console.log( - "existing record - DIFF HOURS IS:", - window.$gz.locale.diffHoursFromUTC8601String(dStart, dStop) + this.value.items[this.activeWoItemIndex].scheduledUsers[ + this.activeItemIndex + ].estimatedQuantity = window.$gz.locale.diffHoursFromUTC8601String( + dStart, + dStop ); } }, - handleStopDateChange: function(isNew) { - let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ - this.activeItemIndex - ].stopDate; - console.log("Stop date value is now", val); - }, - handleEstimatedQuantityChange: function(isNew) { + handleStopDateChange: function(isNew, dStart, dStop) {}, + handleEstimatedQuantityChange: function(isNew, dStart, dStop) { let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ this.activeItemIndex ].estimatedQuantity;