This commit is contained in:
2021-06-02 00:02:16 +00:00
parent 2ddf8b9ddf
commit d3ed4724c3

View File

@@ -396,22 +396,24 @@ export default {
].id == 0; ].id == 0;
//Auto calculate dates / quantities / global defaults //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")) { if (ref.includes("startDate")) {
this.handleStartDateChange(isNew); this.handleStartDateChange(isNew, dStart, dStop);
} }
if (ref.includes("stopDate")) { if (ref.includes("stopDate")) {
this.handleStopDateChange(isNew); this.handleStopDateChange(isNew, dStart, dStop);
} }
if (ref.includes("estimatedQuantity")) { if (ref.includes("estimatedQuantity")) {
this.handleEstimatedQuantityChange(isNew); this.handleEstimatedQuantityChange(isNew, dStart, dStop);
} }
} }
}, },
handleStartDateChange: function(isNew) { handleStartDateChange: function(isNew, dStart, dStop) {
const dStart = this.value.items[this.activeWoItemIndex].scheduledUsers[
this.activeItemIndex
].startDate;
if (isNew) { 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 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 // (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); let d = window.$gz.locale.addMinutesToUTC8601String(dStart);
} else { } else {
const dStop = this.value.items[this.activeWoItemIndex].scheduledUsers[
this.activeItemIndex
].stopDate;
// Existing // Existing
// update quantity when dates change or update stop date when quantity changes to match // 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 // no consideration for global default, once it's made that shit doesn't apply
console.log( this.value.items[this.activeWoItemIndex].scheduledUsers[
"existing record - DIFF HOURS IS:", this.activeItemIndex
window.$gz.locale.diffHoursFromUTC8601String(dStart, dStop) ].estimatedQuantity = window.$gz.locale.diffHoursFromUTC8601String(
dStart,
dStop
); );
} }
}, },
handleStopDateChange: function(isNew) { handleStopDateChange: function(isNew, dStart, dStop) {},
let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ handleEstimatedQuantityChange: function(isNew, dStart, dStop) {
this.activeItemIndex
].stopDate;
console.log("Stop date value is now", val);
},
handleEstimatedQuantityChange: function(isNew) {
let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ let val = this.value.items[this.activeWoItemIndex].scheduledUsers[
this.activeItemIndex this.activeItemIndex
].estimatedQuantity; ].estimatedQuantity;