diff --git a/ayanova/src/components/work-order-item-scheduled-users.vue b/ayanova/src/components/work-order-item-scheduled-users.vue index b92c6e55..5be0432a 100644 --- a/ayanova/src/components/work-order-item-scheduled-users.vue +++ b/ayanova/src/components/work-order-item-scheduled-users.vue @@ -390,39 +390,43 @@ export default { this.activeItemIndex ].isDirty = true; window.$gz.form.fieldValueChanged(this.pvm, ref); + const isNew = + this.value.items[this.activeWoItemIndex].scheduledUsers[ + this.activeItemIndex + ].id == 0; //Auto calculate dates / quantities / global defaults if (ref.includes("startDate")) { - this.handleStartDateChange(); + this.handleStartDateChange(isNew); } if (ref.includes("stopDate")) { - this.handleStopDateChange(); + this.handleStopDateChange(isNew); } if (ref.includes("estimatedQuantity")) { - this.handleEstimatedQuantityChange(); + this.handleEstimatedQuantityChange(isNew); } } }, - handleStartDateChange: function() { - let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ + handleStartDateChange: function(isNew) { + const dt = this.value.items[this.activeWoItemIndex].scheduledUsers[ this.activeItemIndex ].startDate; - console.log("Start date value is now", val); - let d = window.$gz.locale.addMinutesToUTC8601String( - val, - window.$gz.store.state.globalSettings.workLaborScheduleDefaultMinutes - ); - - console.log("start plus global default labor minutes is:", d); + console.log("IsNew:", isNew); + const globalMinutes = + window.$gz.store.state.globalSettings.workLaborScheduleDefaultMinutes; + if (globalMinutes == 0) { + return; + } + let d = window.$gz.locale.addMinutesToUTC8601String(dt); }, - handleStopDateChange: function() { + handleStopDateChange: function(isNew) { let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ this.activeItemIndex ].stopDate; console.log("Stop date value is now", val); }, - handleEstimatedQuantityChange: function() { + handleEstimatedQuantityChange: function(isNew) { let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ this.activeItemIndex ].estimatedQuantity;