From 31451efde024aa0ef54f041cbc613b29e502949d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 26 May 2021 21:31:31 +0000 Subject: [PATCH] --- .../work-order-item-part-requests.vue | 374 +++--------------- 1 file changed, 64 insertions(+), 310 deletions(-) diff --git a/ayanova/src/components/work-order-item-part-requests.vue b/ayanova/src/components/work-order-item-part-requests.vue index 1d996a34..8819b845 100644 --- a/ayanova/src/components/work-order-item-part-requests.vue +++ b/ayanova/src/components/work-order-item-part-requests.vue @@ -48,13 +48,19 @@ disable-filtering disable-sort hide-default-footer - data-cy="partsTable" + data-cy="partRequestsTable" dense :item-class="itemRowClasses" @click:row="handleRowClick" :show-select="$vuetify.breakpoint.xs" single-select > + @@ -67,258 +73,6 @@ >{{ $ay.t("Undelete") }}$ayiTrashRestoreAlt - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -393,24 +147,20 @@ export default { }, methods: { warehouseChange(newName) { - this.value.items[this.activeWoItemIndex].parts[ + this.value.items[this.activeWoItemIndex].partRequests[ this.activeItemIndex ].partWarehouseViz = newName; }, partChange(newName) { - this.value.items[this.activeWoItemIndex].parts[ + this.value.items[this.activeWoItemIndex].partRequests[ this.activeItemIndex ].partViz = newName; }, - taxCodeChange(newName) { - this.value.items[this.activeWoItemIndex].parts[ - this.activeItemIndex - ].taxPartSaleViz = newName; - }, newItem() { - let newIndex = this.value.items[this.activeWoItemIndex].parts.length; + let newIndex = this.value.items[this.activeWoItemIndex].partRequests + .length; - this.value.items[this.activeWoItemIndex].parts.push({ + this.value.items[this.activeWoItemIndex].partRequests.push({ id: 0, concurrency: 0, userId: null, @@ -419,11 +169,8 @@ export default { partId: null, partWarehouseId: null, quantity: 1, - taxPartSaleId: null, - price: 0, - priceOverride: null, - cost: 0, - listPrice: 0, + received: null, + purchaseOrderItemId: null, isDirty: true, workOrderItemId: this.value.items[this.activeWoItemIndex].id, uid: Date.now() //used for error tracking / display @@ -433,13 +180,13 @@ export default { this.activeItemIndex = newIndex; }, unDeleteItem() { - this.value.items[this.activeWoItemIndex].parts[ + this.value.items[this.activeWoItemIndex].partRequests[ this.activeItemIndex ].deleted = false; this.setDefaultView(); }, deleteItem() { - this.value.items[this.activeWoItemIndex].parts[ + this.value.items[this.activeWoItemIndex].partRequests[ this.activeItemIndex ].deleted = true; this.setDefaultView(); @@ -447,7 +194,7 @@ export default { }, setDefaultView: function() { //if only one record left then display it otherwise just let the datatable show what the user can click on - if (this.value.items[this.activeWoItemIndex].parts.length == 1) { + if (this.value.items[this.activeWoItemIndex].partRequests.length == 1) { this.selectedRow = [{ index: 0 }]; this.activeItemIndex = 0; } else { @@ -465,7 +212,7 @@ export default { fieldValueChanged(ref) { if (!this.formState.loading && !this.formState.readonly) { //flag this record dirty so it gets picked up by save - this.value.items[this.activeWoItemIndex].parts[ + this.value.items[this.activeWoItemIndex].partRequests[ this.activeItemIndex ].isDirty = true; window.$gz.form.fieldValueChanged(this.pvm, ref); @@ -474,12 +221,12 @@ export default { itemRowClasses: function(item) { let ret = ""; const isDeleted = - this.value.items[this.activeWoItemIndex].parts[item.index].deleted === - true; + this.value.items[this.activeWoItemIndex].partRequests[item.index] + .deleted === true; const hasError = this.form().childRowHasError( this, - `Items[${this.activeWoItemIndex}].Parts[${item.index}].` + `Items[${this.activeWoItemIndex}].PartRequests[${item.index}].` ); if (isDeleted) { @@ -495,15 +242,17 @@ export default { computed: { isDeleted: function() { if ( - this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex] == - null + this.value.items[this.activeWoItemIndex].partRequests[ + this.activeItemIndex + ] == null ) { this.setDefaultView(); return true; } return ( - this.value.items[this.activeWoItemIndex].parts[this.activeItemIndex] - .deleted === true + this.value.items[this.activeWoItemIndex].partRequests[ + this.activeItemIndex + ].deleted === true ); }, parentDeleted: function() { @@ -593,35 +342,40 @@ export default { return headers; }, itemList: function() { - return this.value.items[this.activeWoItemIndex].parts.map((x, i) => { - return { - index: i, - id: x.id, - partViz: x.partViz, - partWarehouseViz: x.partWarehouseViz, - quantity: window.$gz.locale.decimalLocalized( - x.quantity, - this.pvm.languageName - ), - upcViz: x.upcViz, - purchaseOrderViz: x.purchaseOrderViz, - purchaseOrderIdViz: x.purchaseOrderIdViz, - purchaseOrderDateViz: window.$gz.locale.utcDateToShortDateAndTimeLocalized( - x.purchaseOrderDateViz, - this.pvm.timeZoneName, - this.pvm.languageName, - this.pvm.hour12 - ), - purchaseOrderExpectedDateViz: window.$gz.locale.utcDateToShortDateAndTimeLocalized( - x.purchaseOrderExpectedDateViz, - this.pvm.timeZoneName, - this.pvm.languageName, - this.pvm.hour12 - ), - purchaseOrderOnOrderViz: x.purchaseOrderOnOrderViz, - received: x.received - }; - }); + return this.value.items[this.activeWoItemIndex].partRequests.map( + (x, i) => { + return { + index: i, + id: x.id, + partViz: x.partViz, + partWarehouseViz: x.partWarehouseViz, + quantity: window.$gz.locale.decimalLocalized( + x.quantity, + this.pvm.languageName + ), + upcViz: x.upcViz, + purchaseOrderViz: x.purchaseOrderViz, + purchaseOrderIdViz: x.purchaseOrderIdViz, + purchaseOrderDateViz: window.$gz.locale.utcDateToShortDateAndTimeLocalized( + x.purchaseOrderDateViz, + this.pvm.timeZoneName, + this.pvm.languageName, + this.pvm.hour12 + ), + purchaseOrderExpectedDateViz: window.$gz.locale.utcDateToShortDateAndTimeLocalized( + x.purchaseOrderExpectedDateViz, + this.pvm.timeZoneName, + this.pvm.languageName, + this.pvm.hour12 + ), + purchaseOrderOnOrderViz: x.purchaseOrderOnOrderViz, + received: window.$gz.locale.decimalLocalized( + x.received, + this.pvm.languageName + ) + }; + } + ); }, formState: function() { return this.pvm.formState; @@ -630,16 +384,16 @@ export default { return this.pvm.formCustomTemplateKey; }, showTable: function() { - return this.value.items[this.activeWoItemIndex].parts.length > 1; + return this.value.items[this.activeWoItemIndex].partRequests.length > 1; }, canAdd: function() { - return this.pvm.rights.change && this.pvm.subRights.parts.create; + return this.pvm.rights.change && this.pvm.subRights.partRequests.create; }, canDelete: function() { return ( this.activeItemIndex != null && this.pvm.rights.change && - this.pvm.subRights.parts.delete + this.pvm.subRights.partRequests.delete ); } //----