This commit is contained in:
@@ -21,6 +21,14 @@
|
||||
</v-list-item-icon>
|
||||
<v-list-item-title>{{ $ay.t("New") }}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="hasSelection" @click="convertToLabor">
|
||||
<v-list-item-icon>
|
||||
<v-icon>$ayiHammer</v-icon>
|
||||
</v-list-item-icon>
|
||||
<v-list-item-title>{{
|
||||
$ay.t("WorkOrderConvertScheduledUserToLabor")
|
||||
}}</v-list-item-title>
|
||||
</v-list-item>
|
||||
<v-list-item v-if="canDelete && isDeleted" @click="unDeleteItem">
|
||||
<v-list-item-icon>
|
||||
<v-icon>$ayiTrashRestoreAlt</v-icon>
|
||||
@@ -332,6 +340,32 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
convertToLabor() {
|
||||
const s = this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.activeItemIndex
|
||||
];
|
||||
this.value.items[this.activeWoItemIndex].labors.push({
|
||||
id: 0,
|
||||
concurrency: 0,
|
||||
userId: s.userId,
|
||||
serviceStartDate: s.startDate,
|
||||
serviceStopDate: s.stopDate,
|
||||
serviceRateId: s.serviceRateId,
|
||||
serviceDetails: null,
|
||||
serviceRateQuantity: s.estimatedQuantity,
|
||||
noChargeQuantity: 0,
|
||||
taxCodeSaleId: null,
|
||||
price: 0,
|
||||
priceOverride: null,
|
||||
isDirty: true,
|
||||
workOrderItemId: this.value.items[this.activeWoItemIndex].id,
|
||||
uid: Date.now(),
|
||||
userViz: s.userViz,
|
||||
serviceRateViz: s.serviceRateViz,
|
||||
taxCodeViz: null
|
||||
});
|
||||
this.$emit("change");
|
||||
},
|
||||
userChange(newName) {
|
||||
this.value.items[this.activeWoItemIndex].scheduledUsers[
|
||||
this.activeItemIndex
|
||||
|
||||
@@ -876,82 +876,11 @@ export default {
|
||||
//Self copy to current workorder??
|
||||
if (this.copyItemWoNumber == this.value.serial) {
|
||||
let newIndex = this.value.items.length;
|
||||
// let wi = window.$gz.util.deepCopy(
|
||||
// this.value.items[this.activeItemIndex]
|
||||
// );
|
||||
|
||||
let wi = JSON.parse(
|
||||
JSON.stringify(this.value.items[this.activeItemIndex])
|
||||
);
|
||||
|
||||
// //deep copy all children
|
||||
// wi.expenses.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// });
|
||||
// wi.labors.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// });
|
||||
// wi.loans.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// x.cost = 0;
|
||||
// x.listPrice = 0;
|
||||
// });
|
||||
// wi.parts.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// x.cost = 0;
|
||||
// x.listPrice = 0;
|
||||
// });
|
||||
|
||||
// wi.scheduledUsers.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// });
|
||||
// wi.tasks.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// });
|
||||
// wi.travels.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// });
|
||||
// wi.units.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// });
|
||||
// wi.outsideServices.forEach(x => {
|
||||
// x.id = 0;
|
||||
// x.workOrderItemId = 0;
|
||||
// x.concurrency = undefined;
|
||||
// x.isDirty = true;
|
||||
// });
|
||||
|
||||
console.log(
|
||||
"wi equals source",
|
||||
wi === this.value.items[this.activeItemIndex]
|
||||
);
|
||||
console.log(
|
||||
"wi.labors[0] equals source.labors[0]",
|
||||
wi.labors[0] === this.value.items[this.activeItemIndex].labors[0]
|
||||
);
|
||||
this.pvm.washWorkOrderItem(wi);
|
||||
wi.workOrderId = this.value.id;
|
||||
wi.sequence = newIndex + 1;
|
||||
|
||||
Reference in New Issue
Block a user