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;
//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;