This commit is contained in:
2021-06-01 23:24:47 +00:00
parent 6cf679adaf
commit 73d6c7c219

View File

@@ -390,39 +390,43 @@ export default {
this.activeItemIndex this.activeItemIndex
].isDirty = true; ].isDirty = true;
window.$gz.form.fieldValueChanged(this.pvm, ref); 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 //Auto calculate dates / quantities / global defaults
if (ref.includes("startDate")) { if (ref.includes("startDate")) {
this.handleStartDateChange(); this.handleStartDateChange(isNew);
} }
if (ref.includes("stopDate")) { if (ref.includes("stopDate")) {
this.handleStopDateChange(); this.handleStopDateChange(isNew);
} }
if (ref.includes("estimatedQuantity")) { if (ref.includes("estimatedQuantity")) {
this.handleEstimatedQuantityChange(); this.handleEstimatedQuantityChange(isNew);
} }
} }
}, },
handleStartDateChange: function() { handleStartDateChange: function(isNew) {
let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ const dt = this.value.items[this.activeWoItemIndex].scheduledUsers[
this.activeItemIndex this.activeItemIndex
].startDate; ].startDate;
console.log("Start date value is now", val);
let d = window.$gz.locale.addMinutesToUTC8601String( console.log("IsNew:", isNew);
val, const globalMinutes =
window.$gz.store.state.globalSettings.workLaborScheduleDefaultMinutes window.$gz.store.state.globalSettings.workLaborScheduleDefaultMinutes;
); if (globalMinutes == 0) {
return;
console.log("start plus global default labor minutes is:", d); }
let d = window.$gz.locale.addMinutesToUTC8601String(dt);
}, },
handleStopDateChange: function() { handleStopDateChange: function(isNew) {
let val = this.value.items[this.activeWoItemIndex].scheduledUsers[ let val = this.value.items[this.activeWoItemIndex].scheduledUsers[
this.activeItemIndex this.activeItemIndex
].stopDate; ].stopDate;
console.log("Stop date value is now", val); console.log("Stop date value is now", val);
}, },
handleEstimatedQuantityChange: function() { 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;