From cd601c5935ef55b1db59721338b642c43a583adc Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 7 Jul 2021 18:17:40 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 8 -- .../work-order-item-scheduled-users.vue | 34 +++++++++ ayanova/src/components/work-order-items.vue | 73 +------------------ ayanova/src/views/svc-workorder.vue | 3 +- 4 files changed, 37 insertions(+), 81 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 95fb081e..c0cb80ac 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -426,14 +426,6 @@ CURRENTLY DOING: TODO 2 (all 2's): V7 features on wo I haven't coded yet - - WOItem selected - 3374 - be able to move woitem to any customer's open workorders not just the same customer. - not sure of the use of this, it's couched like a template issue which is what template is for, but since we no longer force - a fixed customer per workorder there's no reason I can see not to do this when implementing the Move woItem feature - - Move woitem to new wo - Copy woitem to new wo Sched user selected Convert sched user to labor diff --git a/ayanova/src/components/work-order-item-scheduled-users.vue b/ayanova/src/components/work-order-item-scheduled-users.vue index d7bdd102..ba21df15 100644 --- a/ayanova/src/components/work-order-item-scheduled-users.vue +++ b/ayanova/src/components/work-order-item-scheduled-users.vue @@ -21,6 +21,14 @@ {{ $ay.t("New") }} + + + $ayiHammer + + {{ + $ay.t("WorkOrderConvertScheduledUserToLabor") + }} + $ayiTrashRestoreAlt @@ -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 diff --git a/ayanova/src/components/work-order-items.vue b/ayanova/src/components/work-order-items.vue index 85053f56..15e1f6dd 100644 --- a/ayanova/src/components/work-order-items.vue +++ b/ayanova/src/components/work-order-items.vue @@ -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; diff --git a/ayanova/src/views/svc-workorder.vue b/ayanova/src/views/svc-workorder.vue index ddfbb127..5005bc48 100644 --- a/ayanova/src/views/svc-workorder.vue +++ b/ayanova/src/views/svc-workorder.vue @@ -2172,7 +2172,8 @@ async function fetchTranslatedText(vm) { "PartAssembly", "PartSerialNumbersAvailable", "AddMultipleUnits", - "CopyToWorkOrder" + "CopyToWorkOrder", + "WorkOrderConvertScheduledUserToLabor" ]); }