diff --git a/src/components/ADempiere/Form/ProductInfo/productList.vue b/src/components/ADempiere/Form/ProductInfo/productList.vue index 4d649fc6..a4124751 100644 --- a/src/components/ADempiere/Form/ProductInfo/productList.vue +++ b/src/components/ADempiere/Form/ProductInfo/productList.vue @@ -241,14 +241,21 @@ export default { }, indexTable(value) { this.setCurrent(this.listWithPrice[value]) + }, + currentPoint(value) { + if (!this.isEmptyValue(value)) { + this.loadProductsPricesList() + } } }, created() { this.unsubscribe = this.subscribeChanges() - - if (this.isReadyFromGetData) { - this.loadProductsPricesList() - } + this.$store.commit('setListProductPrice', { + isLoaded: false + }) + this.timeOut = setTimeout(() => { + this.validatePos(this.currentPoint) + }, 3000) }, beforeDestroy() { this.unsubscribe() @@ -374,6 +381,25 @@ export default { }, 1000) } }) + }, + /** + * @param {object} PointOfSales + */ + validatePos(PointOfSales) { + console.log(this.isEmptyValue(PointOfSales), this.isReadyFromGetData) + if (this.isEmptyValue(PointOfSales)) { + const message = this.$t('notifications.errorPointOfSale') + this.$store.commit('setListProductPrice', { + isLoaded: true, + productPricesList: [] + }) + this.$message({ + type: 'info', + message, + duration: 1500, + showClose: true + }) + } } } } diff --git a/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue b/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue index 6b014572..de9233f2 100644 --- a/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue +++ b/src/components/ADempiere/Form/VPOS/ProductInfo/productList.vue @@ -132,21 +132,21 @@ export default { if (isToLoad) { this.loadProductsPricesList() } + }, + currentPoint(value) { + if (!this.isEmptyValue(value)) { + this.loadProductsPricesList() + } } }, created() { this.unsubscribe = this.subscribeChanges() - - if (this.isReadyFromGetData) { - this.loadProductsPricesList() - } - if (this.isEmptyValue(this.listWithPrice)) { - this.$store.dispatch('listProductPriceFromServer', { - containerUuid: 'Products-Price-List', - pageNumber: 1, - searchValue: '' - }) - } + this.$store.commit('setListProductPrice', { + isLoaded: false + }) + this.timeOut = setTimeout(() => { + this.validatePos(this.currentPoint) + }, 3000) }, beforeDestroy() { this.unsubscribe() @@ -209,6 +209,24 @@ export default { }, 1000) } }) + }, + /** + * @param {object} PointOfSales + */ + validatePos(PointOfSales) { + if (this.isEmptyValue(PointOfSales)) { + const message = this.$t('notifications.errorPointOfSale') + this.$store.commit('setListProductPrice', { + isLoaded: true, + productPricesList: [] + }) + this.$message({ + type: 'info', + message, + duration: 1500, + showClose: true + }) + } } } }