From 64d38b59a7a9685f14184b93039e164e028411e5 Mon Sep 17 00:00:00 2001 From: Yamel Senih Date: Tue, 15 Jun 2021 10:07:06 -0400 Subject: [PATCH] Feature/rename pos objects (#922) * Rename POS attributres and mutations to set * Add list warehouse from cache --- .../ADempiere/Form/VPOS/Collection/index.vue | 2 +- .../ADempiere/Form/VPOS/Order/index.vue | 28 ++++++++--------- .../ADempiere/Form/VPOS/posMixin.js | 6 ++-- .../Form/VPOS/templateDevice/desktop.vue | 2 +- .../Form/VPOS/templateDevice/mobile.vue | 2 +- .../ADempiere/pointOfSales/getters/index.js | 7 +++-- .../pointOfSales/payments/actions.js | 2 +- .../ADempiere/pointOfSales/point/actions.js | 24 +++++++-------- .../ADempiere/pointOfSales/point/mutations.js | 30 +++++++++---------- .../ADempiere/pointOfSales/point/state.js | 8 ++--- 10 files changed, 56 insertions(+), 55 deletions(-) diff --git a/src/components/ADempiere/Form/VPOS/Collection/index.vue b/src/components/ADempiere/Form/VPOS/Collection/index.vue index 63c52b61..b1658031 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/index.vue @@ -317,7 +317,7 @@ export default { return this.$store.state['pointOfSales/point/index'].listCurrency }, convertionList() { - return this.$store.state['pointOfSales/point/index'].conversionList + return this.$store.state['pointOfSales/point/index'].conversionsList }, validateCompleteCollection() { let collection diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue index bc3862e7..baacdbc7 100644 --- a/src/components/ADempiere/Form/VPOS/Order/index.vue +++ b/src/components/ADempiere/Form/VPOS/Order/index.vue @@ -218,14 +218,14 @@
- {{ $t('route.warehouse') }}: {{ curretnWarehouse.name }} + {{ $t('route.warehouse') }}: {{ currentWarehouse.name }}
- {{ $t('form.pos.priceList') }}: {{ curretnPriceList.name }} + {{ $t('form.pos.priceList') }}: {{ currentPriceList.name }} 0) { diff --git a/src/components/ADempiere/Form/VPOS/posMixin.js b/src/components/ADempiere/Form/VPOS/posMixin.js index e15e67e0..b21e2db9 100644 --- a/src/components/ADempiere/Form/VPOS/posMixin.js +++ b/src/components/ADempiere/Form/VPOS/posMixin.js @@ -86,7 +86,7 @@ export default { } }, listPointOfSales() { - return this.$store.getters.posAttributes.listPointOfSales + return this.$store.getters.posAttributes.pointOfSalesList }, curretnPriceList() { if (!this.isEmptyValue(this.$store.getters.currentPriceList)) { @@ -95,14 +95,14 @@ export default { return {} }, priceListPointOfSales() { - const list = this.$store.getters.posAttributes.currentPointOfSales.listPrices + const list = this.$store.getters.posAttributes.currentPointOfSales.pricesList if (this.isEmptyValue(list)) { return [] } return list }, warehousesListPointOfSales() { - const list = this.$store.getters.posAttributes.currentPointOfSales.listWarehouses + const list = this.$store.getters.posAttributes.currentPointOfSales.warehousesList if (this.isEmptyValue(list)) { return [] } diff --git a/src/components/ADempiere/Form/VPOS/templateDevice/desktop.vue b/src/components/ADempiere/Form/VPOS/templateDevice/desktop.vue index 36e0da2e..792d2216 100644 --- a/src/components/ADempiere/Form/VPOS/templateDevice/desktop.vue +++ b/src/components/ADempiere/Form/VPOS/templateDevice/desktop.vue @@ -111,7 +111,7 @@ export default { return this.$store.getters.getShowCollectionPos }, listPointOfSales() { - return this.$store.getters.posAttributes.listPointOfSales + return this.$store.getters.posAttributes.pointOfSalesList } }, watch: { diff --git a/src/components/ADempiere/Form/VPOS/templateDevice/mobile.vue b/src/components/ADempiere/Form/VPOS/templateDevice/mobile.vue index 61e494f6..a486e62d 100644 --- a/src/components/ADempiere/Form/VPOS/templateDevice/mobile.vue +++ b/src/components/ADempiere/Form/VPOS/templateDevice/mobile.vue @@ -125,7 +125,7 @@ export default { return this.$store.getters.getShowCollectionPos }, listPointOfSales() { - return this.$store.getters.posAttributes.listPointOfSales + return this.$store.getters.posAttributes.pointOfSalesList } }, watch: { diff --git a/src/store/modules/ADempiere/pointOfSales/getters/index.js b/src/store/modules/ADempiere/pointOfSales/getters/index.js index 7cb4911b..902492d0 100644 --- a/src/store/modules/ADempiere/pointOfSales/getters/index.js +++ b/src/store/modules/ADempiere/pointOfSales/getters/index.js @@ -50,12 +50,13 @@ export default { */ posAttributes: (state) => { return { - listPointOfSales: state.listPointOfSales, + pointOfSalesList: state.pointOfSalesList, currentPointOfSales: { ...state.currentPointOfSales, listOrder: state.listOrder, - listWarehouses: state.listWarehouses, - listPrices: state.listPrices, + warehousesList: state.warehousesList, + pricesList: state.pricesList, + currentPriceList: state.currentPriceList, currentOrder: { ...state.order, lineOrder: state.listOrderLine, diff --git a/src/store/modules/ADempiere/pointOfSales/payments/actions.js b/src/store/modules/ADempiere/pointOfSales/payments/actions.js index ffee5c2e..236054ba 100644 --- a/src/store/modules/ADempiere/pointOfSales/payments/actions.js +++ b/src/store/modules/ADempiere/pointOfSales/payments/actions.js @@ -119,7 +119,7 @@ export default { conversionDate: params.conversionDate }) .then(response => { - commit('conversionList', response) + commit('addConversionToList', response) }) .catch(error => { console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`) diff --git a/src/store/modules/ADempiere/pointOfSales/point/actions.js b/src/store/modules/ADempiere/pointOfSales/point/actions.js index c2f58dd0..2a1afa93 100644 --- a/src/store/modules/ADempiere/pointOfSales/point/actions.js +++ b/src/store/modules/ADempiere/pointOfSales/point/actions.js @@ -34,22 +34,22 @@ export default { */ listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) { const userUuid = getters['user/getUserUuid'] - let pos, listPos + let pos, pontOfSalesList listPointOfSales({ userUuid }) .then(response => { - listPos = response.sellingPointsList + pontOfSalesList = response.sellingPointsList if (!isEmptyValue(posToSet)) { - pos = listPos.find(itemPOS => itemPOS.id === parseInt(posToSet)) + pos = pontOfSalesList.find(itemPOS => itemPOS.id === parseInt(posToSet)) } if (isEmptyValue(pos) && isEmptyValue(posToSet)) { - pos = listPos.find(itemPOS => itemPOS.salesRepresentative.uuid === userUuid) + pos = pontOfSalesList.find(itemPOS => itemPOS.salesRepresentative.uuid === userUuid) } if (isEmptyValue(pos)) { - pos = listPos[0] + pos = pontOfSalesList[0] } - commit('listPointOfSales', listPos) + commit('setPointOfSalesList', pontOfSalesList) dispatch('setCurrentPOS', pos) }) .catch(error => { @@ -66,7 +66,7 @@ export default { posUuid }) .then(response => { - commit('listWarehouses', response.records) + commit('setWarehousesList', response.records) }) .catch(error => { console.warn(`listWarehouseFromServer: ${error.message}. Code: ${error.code}.`) @@ -82,7 +82,7 @@ export default { posUuid: point.uuid }) .then(response => { - commit('listPrices', response.records) + commit('setPricesList', response.records) }) .catch(error => { console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`) @@ -98,7 +98,7 @@ export default { posUuid }) .then(response => { - commit('listCurrencies', response.records) + commit('setCurrenciesList', response.records) }) .catch(error => { console.warn(`listPricesFromServer: ${error.message}. Code: ${error.code}.`) @@ -110,7 +110,7 @@ export default { }) }, setCurrentPOS({ commit, dispatch, rootGetters }, posToSet) { - commit('currentPointOfSales', posToSet) + commit('setCurrentPointOfSales', posToSet) const oldRoute = router.app._route router.push({ name: oldRoute.name, @@ -125,8 +125,8 @@ export default { dispatch('listWarehouseFromServer', posToSet.uuid) dispatch('listCurrenciesFromServer', posToSet.uuid) dispatch('listPricesFromServer', posToSet) - commit('currentPriceList', posToSet.priceList) - commit('currentWarehouse', rootGetters['user/getWarehouse']) + commit('setCurrentPriceList', posToSet.priceList) + commit('setCurrentWarehouse', rootGetters['user/getWarehouse']) commit('resetConversionRate', []) commit('setIsReloadKeyLayout') commit('setIsReloadProductPrice') diff --git a/src/store/modules/ADempiere/pointOfSales/point/mutations.js b/src/store/modules/ADempiere/pointOfSales/point/mutations.js index 552b4a6e..ecfcedd5 100644 --- a/src/store/modules/ADempiere/pointOfSales/point/mutations.js +++ b/src/store/modules/ADempiere/pointOfSales/point/mutations.js @@ -16,31 +16,31 @@ /** * Pos Mutations - * @author Elsio Sanchez + * All related to global store of Point of Sales */ export default { - listPointOfSales(state, listPointOfSales) { - state.listPointOfSales = listPointOfSales + setPointOfSalesList(state, pointOfSalesList) { + state.pointOfSalesList = pointOfSalesList }, - listWarehouses(state, listWarehouses) { - state.listWarehouses = listWarehouses + setWarehousesList(state, warehousesList) { + state.warehousesList = warehousesList }, - currentPriceList(state, priceList) { - state.currentPriceList = priceList + setCurrentPriceList(state, currentPriceList) { + state.currentPriceList = currentPriceList }, - currentWarehouse(state, warehouse) { + setCurrentWarehouse(state, warehouse) { state.currentWarehouse = warehouse }, - listPrices(state, listPrices) { - state.listPrices = listPrices + setPricesList(state, pricesList) { + state.pricesList = pricesList }, - listCurrencies(state, listCurrency) { - state.listCurrency = listCurrency + setCurrenciesList(state, currenciesList) { + state.currenciesList = currenciesList }, - conversionList(state, conversion) { - state.conversionList.push(conversion) + addConversionToList(state, conversion) { + state.conversionsList.push(conversion) }, - currentPointOfSales(state, currentPointOfSales) { + setCurrentPointOfSales(state, currentPointOfSales) { state.currentPointOfSales = currentPointOfSales }, setShowPOSOptions(state, isShowedOptions) { diff --git a/src/store/modules/ADempiere/pointOfSales/point/state.js b/src/store/modules/ADempiere/pointOfSales/point/state.js index 99ea8ff3..5664b08d 100644 --- a/src/store/modules/ADempiere/pointOfSales/point/state.js +++ b/src/store/modules/ADempiere/pointOfSales/point/state.js @@ -27,13 +27,13 @@ export default { pointOfSales: { ...withoutResponse }, - listPointOfSales: {}, - listWarehouses: {}, - listPrices: {}, + pointOfSalesList: {}, + warehousesList: {}, + pricesList: {}, currentPriceList: {}, currentWarehouse: {}, listCurrency: [], - conversionList: [], + conversionsList: [], currentPointOfSales: {}, showPOSOptions: false, showPOSKeyLayout: false,