From 51fcfbb181ba31a70b93e3d968198b103878b7ab Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 14 Apr 2023 21:55:29 +0000 Subject: [PATCH] case 4504 --- src/views/biz-subscription.vue | 158 +++++++++++++++++++++++++++++++-- 1 file changed, 149 insertions(+), 9 deletions(-) diff --git a/src/views/biz-subscription.vue b/src/views/biz-subscription.vue index 046bf3e..13e44ed 100644 --- a/src/views/biz-subscription.vue +++ b/src/views/biz-subscription.vue @@ -19,7 +19,6 @@ > - - + + + + + + + + + + + + + + @@ -119,6 +179,7 @@ export default { pGroup: null, active: true, subsite: "main", + items: [], notes: null, tags: [] }, @@ -139,6 +200,52 @@ export default { } }; }, + computed: { + headerList: function() { + const headers = []; + headers.push({ + text: this.$sock.t("ProductName"), + align: "left", + value: "productViz" + }); + + headers.push({ + text: this.$sock.t("PurchaseQuantity"), + align: "right", + value: "quantity" + }); + + headers.push({ + text: this.$sock.t("PurchaseExpireDate"), + align: "right", + value: "expireDate" + }); + + if (!this.formState.readOnly) { + headers.push({ text: "", value: "actions" }); + } + return headers; + }, + itemList: function() { + return this.obj.items.map((x, i) => { + return { + index: i, + id: x.id, + quantity: window.$gz.locale.decimalLocalized( + x.quantity, + this.languageName + ), + expireDate: window.$gz.locale.utcDateToShortDateAndTimeLocalized( + x.expireDate, + this.timeZoneName, + this.languageName, + this.hour12 + ), + productViz: x.productViz + }; + }); + } + }, watch: { formState: { handler: function(val) { @@ -227,13 +334,46 @@ export default { beforeDestroy() { window.$gz.eventBus.$off("menu-click", clickHandler); }, - methods: { - openVendorNotification: function() { - window.$gz.eventBus.$emit("openobject", { - type: window.$gz.type.VendorNotification, - id: this.obj.vendorNotificationId - }); + methods: { + editItem: function(item) { + console.log("edit item", item); + // this.editPoItemIndex = item.index; + // this.editPoItemDialog = true; }, + newItem: function() { + // this.obj.items.push({ + // id: 0, + // purchaseOrderId: 0, + // partId: null, + // partWarehouseId: 1, + // quantityOrdered: 1, + // quantityReceived: 0, + // purchaseOrderCost: 0, + // receivedCost: 0.0, + // receivedDate: null, + // partRequestedById: null, + // workOrderItemPartRequestId: null, + // purchaseTaxCodeId: + // window.$gz.store.state.globalSettings.defaultTaxPartPurchaseId, + // vendorPartNumber: null + // }); + // this.editPoItemIndex = this.obj.items.length - 1; + // this.editPoItemDialog = true; + // this.formState.dirty = true; + }, + deleteItem: function() { + // this.editPoItemDialog = false; + // this.obj.items.splice(this.editPoItemIndex, 1); + // this.editPoItemIndex = 0; + // this.formState.dirty = true; + }, + itemsRowClasses: function(item) { + const path = `Items[${item.index}].`; + if (this.form().childRowHasError(this, path)) { + return "font-weight-black font-italic error--text"; + } + }, + canSave: function() { return this.formState.valid && this.formState.dirty; },