diff --git a/ayanova/src/components/work-order-item-scheduled-users.vue b/ayanova/src/components/work-order-item-scheduled-users.vue index e8b7c749..24b3fcc2 100644 --- a/ayanova/src/components/work-order-item-scheduled-users.vue +++ b/ayanova/src/components/work-order-item-scheduled-users.vue @@ -445,6 +445,34 @@ export default { }, handleStopDateChange: function(isNew, dStart, dStop) { // (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 + const globalMinutes = + window.$gz.store.state.globalSettings.workLaborScheduleDefaultMinutes; + + if (isNew && dStart == null) { + if (globalMinutes != 0) { + //set start date based on stop date and global minutes + this.value.items[this.activeWoItemIndex].scheduledUsers[ + this.activeItemIndex + ].startDate = window.$gz.locale.addMinutesToUTC8601String( + dStop, + 0 - globalMinutes + ); + + this.value.items[this.activeWoItemIndex].scheduledUsers[ + this.activeItemIndex + ].estimatedQuantity = globalMinutes; + } + } else { + //Existing record or both dates filled, just update quantity + if (dStart != null) { + this.value.items[this.activeWoItemIndex].scheduledUsers[ + this.activeItemIndex + ].estimatedQuantity = window.$gz.locale.diffHoursFromUTC8601String( + dStart, + dStop + ); + } + } }, handleEstimatedQuantityChange: function(isNew, dStart, dStop) { let val = this.value.items[this.activeWoItemIndex].scheduledUsers[