This commit is contained in:
@@ -482,7 +482,7 @@ export default {
|
|||||||
// serviceStopDate: window.$gz.locale.nowUTC8601String(), //TODO:sb now plus one hour to match v7
|
// serviceStopDate: window.$gz.locale.nowUTC8601String(), //TODO:sb now plus one hour to match v7
|
||||||
serviceRateId: null,
|
serviceRateId: null,
|
||||||
serviceDetails: null,
|
serviceDetails: null,
|
||||||
serviceRateQuantity: 1,
|
serviceRateQuantity: 0,
|
||||||
noChargeQuantity: 0,
|
noChargeQuantity: 0,
|
||||||
serviceBankId: null,
|
serviceBankId: null,
|
||||||
taxCodeSaleId: null,
|
taxCodeSaleId: null,
|
||||||
@@ -605,7 +605,6 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
//Existing record or both dates filled, just update quantity
|
//Existing record or both dates filled, just update quantity
|
||||||
if (dStart != null) {
|
if (dStart != null) {
|
||||||
console.log("setting serviceRateQuantity");
|
|
||||||
this.value.items[this.activeWoItemIndex].labors[
|
this.value.items[this.activeWoItemIndex].labors[
|
||||||
this.activeItemIndex
|
this.activeItemIndex
|
||||||
].serviceRateQuantity = window.$gz.locale.diffHoursFromUTC8601String(
|
].serviceRateQuantity = window.$gz.locale.diffHoursFromUTC8601String(
|
||||||
|
|||||||
@@ -475,11 +475,11 @@ export default {
|
|||||||
id: 0,
|
id: 0,
|
||||||
concurrency: 0,
|
concurrency: 0,
|
||||||
userId: null,
|
userId: null,
|
||||||
travelStartDate: window.$gz.locale.nowUTC8601String(),
|
travelStartDate: null,
|
||||||
travelStopDate: window.$gz.locale.nowUTC8601String(), //TODO:sb now plus one hour to match v7
|
travelStopDate: null,
|
||||||
travelRateId: null,
|
travelRateId: null,
|
||||||
travelDetails: null,
|
travelDetails: null,
|
||||||
travelRateQuantity: 1,
|
travelRateQuantity: 0,
|
||||||
noChargeQuantity: 0,
|
noChargeQuantity: 0,
|
||||||
serviceBankId: null,
|
serviceBankId: null,
|
||||||
taxCodeSaleId: null,
|
taxCodeSaleId: null,
|
||||||
@@ -530,6 +530,85 @@ export default {
|
|||||||
this.activeItemIndex
|
this.activeItemIndex
|
||||||
].isDirty = true;
|
].isDirty = true;
|
||||||
window.$gz.form.fieldValueChanged(this.pvm, ref);
|
window.$gz.form.fieldValueChanged(this.pvm, ref);
|
||||||
|
//------- SPECIAL HANDLING OF CHANGES -----------
|
||||||
|
const isNew =
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[this.activeItemIndex]
|
||||||
|
.id == 0;
|
||||||
|
|
||||||
|
//Auto calculate dates / quantities / global defaults
|
||||||
|
const dStart = this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelStartDate;
|
||||||
|
const dStop = this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelStopDate;
|
||||||
|
if (ref.includes("travelStartDate") && dStart != null) {
|
||||||
|
this.handleStartDateChange(isNew, dStart, dStop);
|
||||||
|
}
|
||||||
|
if (ref.includes("travelStopDate") && dStop != null) {
|
||||||
|
this.handleStopDateChange(isNew, dStart, dStop);
|
||||||
|
}
|
||||||
|
//------------------------------------------------------
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleStartDateChange: function(isNew, dStart, dStop) {
|
||||||
|
const globalMinutes =
|
||||||
|
window.$gz.store.state.globalSettings.workOrderTravelDefaultMinutes;
|
||||||
|
|
||||||
|
if (isNew && dStop == null) {
|
||||||
|
if (globalMinutes != 0) {
|
||||||
|
//set stop date based on start date and global minutes
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelStopDate = window.$gz.locale.addMinutesToUTC8601String(
|
||||||
|
dStart,
|
||||||
|
globalMinutes
|
||||||
|
);
|
||||||
|
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelRateQuantity = globalMinutes;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Existing record or both dates filled, just update quantity
|
||||||
|
if (dStop != null) {
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelRateQuantity = window.$gz.locale.diffHoursFromUTC8601String(
|
||||||
|
dStart,
|
||||||
|
dStop
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleStopDateChange: function(isNew, dStart, dStop) {
|
||||||
|
const globalMinutes =
|
||||||
|
window.$gz.store.state.globalSettings.workOrderTravelDefaultMinutes;
|
||||||
|
|
||||||
|
if (isNew && dStart == null) {
|
||||||
|
if (globalMinutes != 0) {
|
||||||
|
//set start date based on stop date and global minutes
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelStartDate = window.$gz.locale.addMinutesToUTC8601String(
|
||||||
|
dStop,
|
||||||
|
0 - globalMinutes
|
||||||
|
);
|
||||||
|
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelRateQuantity = globalMinutes;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//Existing record or both dates filled, just update quantity
|
||||||
|
if (dStart != null) {
|
||||||
|
this.value.items[this.activeWoItemIndex].travels[
|
||||||
|
this.activeItemIndex
|
||||||
|
].travelRateQuantity = window.$gz.locale.diffHoursFromUTC8601String(
|
||||||
|
dStart,
|
||||||
|
dStop
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
itemRowClasses: function(item) {
|
itemRowClasses: function(item) {
|
||||||
|
|||||||
Reference in New Issue
Block a user