From 4716f3d7f72be7b505d3a321c3b71f29ae103361 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Tue, 12 Jan 2021 17:10:45 -0400 Subject: [PATCH] price query search (#565) --- .../ADempiere/Form/PriceChecking/index.vue | 53 ++++++++++++++++++- .../ADempiere/Form/VPOS/Order/index.vue | 16 +++--- .../Form/VPOS/Order/orderLineMixin.js | 2 +- 3 files changed, 61 insertions(+), 10 deletions(-) diff --git a/src/components/ADempiere/Form/PriceChecking/index.vue b/src/components/ADempiere/Form/PriceChecking/index.vue index 327ca7d9..714e9eb4 100644 --- a/src/components/ADempiere/Form/PriceChecking/index.vue +++ b/src/components/ADempiere/Form/PriceChecking/index.vue @@ -171,7 +171,7 @@ export default { formatPrice, subscribeChanges() { return this.$store.subscribe((mutation, state) => { - if ((mutation.type === 'updateValueOfField' || mutation.type === 'addActionKeyPerformed') && mutation.payload.columnName === 'ProductValue') { + if ((mutation.type === 'addActionKeyPerformed') && mutation.payload.columnName === 'ProductValue') { // cleans all values except column name 'ProductValue' this.search = mutation.payload.value if (!this.isEmptyValue(this.search) && this.search.length >= 4) { @@ -223,6 +223,57 @@ export default { } }) } + } else if ((mutation.type === 'updateValueOfField') && (mutation.payload.columnName === 'ProductValue') && !this.isEmptyValue(mutation.payload.value)) { + clearTimeout(this.timeOut) + this.timeOut = setTimeout(() => { + requestGetProductPrice({ + searchValue: mutation.payload.value + }) + .then(productPrice => { + this.messageError = true + const { product, taxRate, priceStandard: priceBase } = productPrice + const { rate } = taxRate + const { imageURL: image } = product + + this.productPrice = { + currency: productPrice.currency, + image, + grandTotal: this.getGrandTotal(priceBase, rate), + productName: product.name, + productDescription: product.description, + priceBase, + priceStandard: productPrice.priceStandard, + priceList: productPrice.priceList, + priceLimit: productPrice.priceLimit, + schemaCurrency: productPrice.schemaCurrency, + schemaGrandTotal: this.getGrandTotal(productPrice.schemaPriceStandard, rate), + schemaPriceStandard: productPrice.schemaPriceStandard, + schemaPriceList: productPrice.schemaPriceList, + schemaPriceLimit: productPrice.schemaPriceLimit, + taxRate: rate, + taxName: taxRate.name, + taxIndicator: taxRate.taxIndicator, + taxAmt: this.getTaxAmount(priceBase, rate) + } + }) + .catch(() => { + this.messageError = false + this.timeMessage() + this.productPrice = {} + }) + .finally(() => { + this.$store.commit('updateValueOfField', { + containerUuid: this.containerUuid, + columnName: 'ProductValue', + value: '' + }) + this.search = '' + this.currentImageOfProduct = '' + if (this.isEmptyValue(this.productPrice.image)) { + this.getImage(this.productPrice.image) + } + }) + }, 500) } if (mutation.type === 'changeFormAttribute') { this.focusProductValue() diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue index 87578804..1ee35977 100644 --- a/src/components/ADempiere/Form/VPOS/Order/index.vue +++ b/src/components/ADempiere/Form/VPOS/Order/index.vue @@ -86,7 +86,7 @@ - {{ $t('form.pos.product.code') }}: {{ currentOrderLine.product.value }}
- {{ $t('form.pos.product.name') }}: {{ currentOrderLine.product.name }}
- {{ $t('form.pos.product.description') }}: {{ currentOrderLine.product.description }}
+ {{ $t('form.productInfo.code') }}: {{ currentOrderLine.product.value }}
+ {{ $t('form.productInfo.name') }}: {{ currentOrderLine.product.name }}
+ {{ $t('form.productInfo.description') }}: {{ currentOrderLine.product.description }}
- {{ $t('form.pos.product.price') }}: + {{ $t('form.productInfo.price') }}: {{ formatPrice(currentOrderLine.product.priceStandard, currencyPoint.iSOCode) }}
- {{ $t('form.pos.product.taxRate') }}: + {{ $t('form.productInfo.taxAmount') }}: {{ currentOrderLine.taxIndicator }}
- {{ $t('form.pos.product.quantityAvailable') }}: + {{ $t('form.productInfo.quantityAvailable') }}: {{ formatQuantity(currentOrderLine.quantityOrdered) }}
- {{ $t('form.pos.product.productInformation') }} + {{ $t('form.productInfo.productInformation') }}
diff --git a/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js b/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js index 5628c279..0bf3330d 100644 --- a/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js +++ b/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js @@ -17,7 +17,7 @@ export default { }, currentPrice: { columnName: 'CurrentPrice', - label: this.$t('form.pos.product.price'), + label: this.$t('form.productInfo.price'), isNumeric: true }, quantityOrdered: {