From b996c4a53c585ad73e11875baaf8af8721f75ca4 Mon Sep 17 00:00:00 2001 From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com> Date: Tue, 23 Feb 2021 09:51:26 -0400 Subject: [PATCH] feat: Refactor payments vuex module (#586) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Refactorizar el módulo vuex de pagos * minimal changees * minimal changes --- package.json | 4 + .../ADempiere/Form/VPOS/Collection/index.vue | 5 +- .../ADempiere/Form/VPOS/Order/index.vue | 24 +- .../ADempiere/Form/VPOS/OrderList/index.vue | 5 +- .../ADempiere/pointOfSales/collection.js | 372 ------------------ .../modules/ADempiere/pointOfSales/order.js | 11 +- .../pointOfSales/payments/actions.js | 297 ++++++++++++++ .../pointOfSales/payments/getters.js | 36 ++ .../ADempiere/pointOfSales/payments/index.js | 18 + .../pointOfSales/payments/mutations.js | 34 ++ .../ADempiere/pointOfSales/payments/state.js | 20 + 11 files changed, 434 insertions(+), 392 deletions(-) delete mode 100644 src/store/modules/ADempiere/pointOfSales/collection.js create mode 100644 src/store/modules/ADempiere/pointOfSales/payments/actions.js create mode 100644 src/store/modules/ADempiere/pointOfSales/payments/getters.js create mode 100644 src/store/modules/ADempiere/pointOfSales/payments/index.js create mode 100644 src/store/modules/ADempiere/pointOfSales/payments/mutations.js create mode 100644 src/store/modules/ADempiere/pointOfSales/payments/state.js diff --git a/package.json b/package.json index a400287f..470ee73b 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,10 @@ { "name": "Edwin Betancourt", "url": "https://github.com/EdwinBetanc0urt/" + }, + { + "name": "Elsio Sanchez", + "url": "https://github.com/elsiosanchez" } ], "scripts": { diff --git a/src/components/ADempiere/Form/VPOS/Collection/index.vue b/src/components/ADempiere/Form/VPOS/Collection/index.vue index b35b70ee..42d12e02 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/index.vue @@ -266,7 +266,7 @@ export default { return listLocal }, paymentBox() { - const payment = this.isPaymentBox.filter(pay => { + const payment = this.listPayments.filter(pay => { return pay.isVisible }) if (this.isEmptyValue(payment)) { @@ -527,7 +527,7 @@ export default { mounted() { setTimeout(() => { this.convertCurrency() - }, 1000) + }, 2000) }, methods: { formatDate, @@ -602,7 +602,6 @@ export default { currencyUuid: this.currencyDisplay(currencyToPay).currencyUuid }) } - this.amontSend = 0 this.addCollect() }, updateServer(listPaymentsLocal) { diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue index a6a29c05..5093ac56 100644 --- a/src/components/ADempiere/Form/VPOS/Order/index.vue +++ b/src/components/ADempiere/Form/VPOS/Order/index.vue @@ -216,7 +216,7 @@ >

- {{ $t('form.pos.order.pointSale') }}: {{ namePointOfSales }} + {{ $t('form.pos.order.pointSale') }}: {{ namePointOfSales.name }}

{ - // this.tenderTypeDisplaye() - // this.currencyDisplaye() - // }, 1500) + setTimeout(() => { + this.tenderTypeDisplaye() + this.currencyDisplaye() + }, 1500) }, methods: { changePos(posElement) { @@ -460,9 +469,8 @@ export default { this.isShowedPOSKeyLayout = !this.isShowedPOSKeyLayout this.$store.commit('setShowPOSCollection', true) // this.isShowedPOSKeyLayout = true - const posUuid = this.$store.getters.getCurrentPOS.uuid const orderUuid = this.$route.query.action - this.$store.dispatch('listPayments', { posUuid, orderUuid }) + this.$store.dispatch('listPayments', { orderUuid }) this.isShowedPOSKeyLaout = !this.isShowedPOSKeyLaout this.$store.commit('setShowPOSOptions', false) }, diff --git a/src/components/ADempiere/Form/VPOS/OrderList/index.vue b/src/components/ADempiere/Form/VPOS/OrderList/index.vue index de46884d..eb71a620 100644 --- a/src/components/ADempiere/Form/VPOS/OrderList/index.vue +++ b/src/components/ADempiere/Form/VPOS/OrderList/index.vue @@ -203,7 +203,7 @@ export default { }, mounted() { const listOrder = this.$store.getters.getListOrderLine - if (this.isEmptyValue(listOrder)) { + if (this.isEmptyValue(listOrder) && !this.isEmptyValue(this.$store.getters.getCurrentPOS.uuid)) { this.$store.dispatch('listOrdersFromServer', { posUuid: this.$store.getters.getCurrentPOS.uuid }) @@ -256,9 +256,8 @@ export default { action: row.uuid } }, () => {}) - const posUuid = this.$store.getters.getCurrentPOS.uuid const orderUuid = this.$route.query.action - this.$store.dispatch('listPayments', { posUuid, orderUuid }) + this.$store.dispatch('listPayments', { orderUuid }) } }, subscribeChanges() { diff --git a/src/store/modules/ADempiere/pointOfSales/collection.js b/src/store/modules/ADempiere/pointOfSales/collection.js deleted file mode 100644 index 91673287..00000000 --- a/src/store/modules/ADempiere/pointOfSales/collection.js +++ /dev/null @@ -1,372 +0,0 @@ - -import { - requestGetConversionRate, - requestCreatePayment, - requestDeletePayment, - requestUpdatePayment, - requestListPayments -} from '@/api/ADempiere/form/point-of-sales.js' -import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js' -import { showMessage } from '@/utils/ADempiere/notification.js' - -const collection = { - state: { - paymentBox: [], - multiplyRate: 1, - divideRate: 1, - multiplyRateCollection: 1, - divideRateCollection: 1, - listPayments: [], - tenderTypeDisplaye: [ - { - tenderTypeCode: 0, - tenderTypeDisplay: '' - } - ], - currency: [], - convertion: {} - }, - mutations: { - addPaymentBox(state, paymentBox) { - state.paymentBox.push(paymentBox) - }, - currencyMultiplyRate(state, multiplyRate) { - state.multiplyRate = multiplyRate - }, - currencyDivideRate(state, divideRate) { - state.divideRate = divideRate - }, - currencyMultiplyRateCollection(state, multiplyRateCollection) { - state.multiplyRateCollection = multiplyRateCollection - }, - currencyDivideRateCollection(state, divideRateCollection) { - state.divideRateCollection = divideRateCollection - }, - setListPayments(state, list) { - state.listPayments = list - }, - setTenderTypeDisplaye(state, tenderTypeDisplaye) { - state.tenderTypeDisplaye = tenderTypeDisplaye - }, - setCurrencyDisplaye(state, currency) { - state.currency = currency - }, - setConvertionPayment(state, convertion) { - state.convertion = convertion - } - }, - actions: { - /** - * creating boxes with the payment list - */ - setPaymentBox({ state, commit, getters }, { - quantityCahs, - bankUuid, - referenceNo, - description, - amount, - paymentDate, - tenderTypeCode, - currencyUuid - }) { - const payments = getters.getPaymentBox.find(element => { - if (tenderTypeCode === 'X' && element.currencyUuid === currencyUuid) { - return element - } - }) - if (isEmptyValue(payments)) { - commit('addPaymentBox', { - quantityCahs, - bankUuid, - referenceNo, - description, - amount, - paymentDate, - tenderTypeCode, - currencyUuid - }) - } else { - const addPayment = getters.getPaymentBox.map(item => { - if ((item.tenderTypeCode === tenderTypeCode) && item.currencyUuid === currencyUuid) { - return { - ...item, - payAmt: item.amount + amount, - quantityCahs: item.quantityCahs + quantityCahs - } - } - return item - }) - state.paymentBox = addPayment - } - }, - // upload orders to theServer - uploadOrdersToServer({ dispatch }, { - listPaymentsLocal, - posUuid, - orderUuid - }) { - listPaymentsLocal.forEach(payment => { - requestCreatePayment({ - posUuid, - orderUuid, - bankUuid: payment.bankUuid, - referenceNo: payment.referenceNo, - description: payment.description, - amount: payment.amount, - paymentDate: payment.paymentDate, - tenderTypeCode: payment.tenderTypeCode, - currencyUuid: payment.currencyUuid - }) - .then(response => { - const orderUuid = response.order_uuid - dispatch('listPayments', { orderUuid }) - }) - .catch(error => { - console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) - }) - }, - deleteCollectBox({ state }, key) { - const payment = state.paymentBox - payment.splice(key, 1) - }, - deleteAllCollectBox({ state }) { - const payment = state.paymentBox - payment.splice(0) - }, - conversionDivideRate({ commit }, params) { - requestGetConversionRate({ - conversionTypeUuid: params.conversionTypeUuid, - currencyFromUuid: params.currencyFromUuid, - currencyToUuid: params.currencyToUuid - }) - .then(response => { - const divideRate = isEmptyValue(response.divideRate) ? 1 : response.divideRate - if (params.containerUuid === 'Collection') { - commit('currencyDivideRateCollection', divideRate) - } else { - commit('currencyDivideRate', divideRate) - } - }) - .catch(error => { - console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) - }, - conversionMultiplyRate({ commit }, { - containerUuid, - conversionTypeUuid, - currencyFromUuid, - currencyToUuid - // conversionDate - }) { - requestGetConversionRate({ - conversionTypeUuid, - currencyFromUuid, - currencyToUuid - // conversionDate - }) - .then(response => { - const multiplyRate = isEmptyValue(response.multiplyRate) ? 0 : response.multiplyRate - if (containerUuid === 'Collection') { - commit('currencyMultiplyRateCollection', multiplyRate) - } else { - commit('currencyMultiplyRate', multiplyRate) - } - }) - .catch(error => { - console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) - }, - changeMultiplyRate({ commit }, params) { - commit('currencyMultiplyRate', params) - }, - changeDivideRate({ commit }, divideRate) { - commit('currencyDivideRate', divideRate) - }, - createPayments({ dispatch, state, getters }, { - posUuid, - orderUuid, - invoiceUuid, - bankUuid, - referenceNo, - description, - amount, - paymentDate, - tenderTypeCode, - currencyUuid - }) { - const listPayments = getters.getListPayments.find(payment => { - if ((payment.tenderTypeCode === tenderTypeCode) && (payment.tenderTypeCode === 'X') && (currencyUuid === payment.currencyUuid)) { - return payment - } - return undefined - }) - if (isEmptyValue(listPayments)) { - requestCreatePayment({ - posUuid, - orderUuid, - invoiceUuid, - bankUuid, - referenceNo, - description, - amount, - paymentDate, - tenderTypeCode, - currencyUuid - }) - .then(response => { - const orderUuid = response.order_uuid - dispatch('listPayments', { orderUuid }) - }) - .catch(error => { - console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) - } else { - requestUpdatePayment({ - paymentUuid: listPayments.uuid, - bankUuid, - referenceNo, - description, - amount: listPayments.amount + amount, - paymentDate, - tenderTypeCode - }) - .then(response => { - const orderUuid = response.order_uuid - dispatch('listPayments', { orderUuid }) - }) - .catch(error => { - console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) - } - }, - deletetPayments({ dispatch }, { - orderUuid, - paymentUuid - }) { - requestDeletePayment({ - paymentUuid - }) - .then(response => { - dispatch('listPayments', { orderUuid }) - }) - .catch(error => { - console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) - }, - listPayments({ commit, rootGetters }, { posUuid, orderUuid }) { - requestListPayments({ - posUuid, - orderUuid - }) - .then(response => { - commit('setListPayments', response.listPayments) - }) - .catch(error => { - console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) - }) - }, - tenderTypeDisplaye({ commit }, tenderType) { - const displayTenderType = tenderType.map(item => { - return { - tenderTypeCode: item.id, - tenderTypeDisplay: item.label - } - }) - commit('setTenderTypeDisplaye', displayTenderType) - }, - currencyDisplaye({ commit }, currency) { - const displaycurrency = currency.map(item => { - return { - currencyUuid: item.uuid, - currencyId: item.id, - currencyDisplay: item.label - } - }) - commit('setCurrencyDisplaye', displaycurrency) - }, - convertionPayment({ commit }, { - conversionTypeUuid, - currencyFromUuid, - currencyToUuid - }) { - requestGetConversionRate({ - conversionTypeUuid, - currencyFromUuid, - currencyToUuid - }) - .then(response => { - commit('setConvertionPayment', response) - }) - .catch(error => { - console.warn(`ConvertionPayment: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'error', - message: error.message, - showClose: true - }) - }) - } - }, - getters: { - getPaymentBox: (state) => { - return state.paymentBox - }, - getMultiplyRate: (state) => { - return state.multiplyRate - }, - getDivideRate: (state) => { - return state.divideRate - }, - getMultiplyRateCollection: (state) => { - return state.multiplyRateCollection - }, - getDivideRateCollection: (state) => { - return state.divideRateCollection - }, - getListPayments: (state) => { - return state.listPayments - }, - getListsPaymentTypes: (state) => { - return state.tenderTypeDisplaye - }, - getListCurrency: (state) => { - return state.currency - }, - getConvertionPayment: (state) => { - return state.convertion - } - } -} - -export default collection diff --git a/src/store/modules/ADempiere/pointOfSales/order.js b/src/store/modules/ADempiere/pointOfSales/order.js index 78d007ca..5d06b7d8 100644 --- a/src/store/modules/ADempiere/pointOfSales/order.js +++ b/src/store/modules/ADempiere/pointOfSales/order.js @@ -82,7 +82,6 @@ const ordes = { if (!isEmptyValue(token)) { pageToken = token + '-' + pageNumber } - requestListOrders({ posUuid, documentNo, @@ -114,11 +113,11 @@ const ordes = { }) .catch(error => { console.warn(`listOrdersFromServer: ${error.message}. Code: ${error.code}.`) - showMessage({ - type: 'info', - message: error.message, - showClose: true - }) + // showMessage({ + // type: 'info', + // message: error.message, + // showClose: true + // }) }) }, setOrder({ commit }, order) { diff --git a/src/store/modules/ADempiere/pointOfSales/payments/actions.js b/src/store/modules/ADempiere/pointOfSales/payments/actions.js new file mode 100644 index 00000000..2be8ecfc --- /dev/null +++ b/src/store/modules/ADempiere/pointOfSales/payments/actions.js @@ -0,0 +1,297 @@ +import { + requestGetConversionRate, + requestCreatePayment, + requestDeletePayment, + requestUpdatePayment, + requestListPayments +} from '@/api/ADempiere/form/point-of-sales.js' +import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js' +import { showMessage } from '@/utils/ADempiere/notification.js' + +/** + * Payments Actions + * @author Elsio Sanchez + */ +export default { + /** + * creating boxes with the payment list + */ + setPaymentBox({ state, commit, getters }, { + quantityCahs, + bankUuid, + referenceNo, + description, + amount, + paymentDate, + tenderTypeCode, + currencyUuid + }) { + const payments = getters.getPaymentBox.find(element => { + if (tenderTypeCode === 'X' && element.currencyUuid === currencyUuid) { + return element + } + }) + if (isEmptyValue(payments)) { + commit('addPaymentBox', { + quantityCahs, + bankUuid, + referenceNo, + description, + amount, + paymentDate, + tenderTypeCode, + currencyUuid + }) + } else { + const addPayment = getters.getPaymentBox.map(item => { + if ((item.tenderTypeCode === tenderTypeCode) && item.currencyUuid === currencyUuid) { + return { + ...item, + payAmt: item.amount + amount, + quantityCahs: item.quantityCahs + quantityCahs + } + } + return item + }) + state.paymentBox = addPayment + } + }, + // upload orders to theServer + uploadOrdersToServer({ dispatch }, { + listPaymentsLocal, + posUuid, + orderUuid + }) { + listPaymentsLocal.forEach(payment => { + requestCreatePayment({ + posUuid, + orderUuid, + bankUuid: payment.bankUuid, + referenceNo: payment.referenceNo, + description: payment.description, + amount: payment.amount, + paymentDate: payment.paymentDate, + tenderTypeCode: payment.tenderTypeCode, + currencyUuid: payment.currencyUuid + }) + .then(response => { + const orderUuid = response.order_uuid + dispatch('listPayments', { orderUuid }) + }) + .catch(error => { + console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + }) + }, + deleteCollectBox({ state }, key) { + const payment = state.paymentBox + payment.splice(key, 1) + }, + deleteAllCollectBox({ state }) { + const payment = state.paymentBox + payment.splice(0) + }, + conversionDivideRate({ commit }, params) { + requestGetConversionRate({ + conversionTypeUuid: params.conversionTypeUuid, + currencyFromUuid: params.currencyFromUuid, + currencyToUuid: params.currencyToUuid + }) + .then(response => { + const divideRate = isEmptyValue(response.divideRate) ? 1 : response.divideRate + if (params.containerUuid === 'Collection') { + commit('currencyDivideRateCollection', divideRate) + } else { + commit('currencyDivideRate', divideRate) + } + }) + .catch(error => { + console.warn(`conversionDivideRate: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + }, + conversionMultiplyRate({ commit }, { + containerUuid, + conversionTypeUuid, + currencyFromUuid, + currencyToUuid + // conversionDate + }) { + requestGetConversionRate({ + conversionTypeUuid, + currencyFromUuid, + currencyToUuid + // conversionDate + }) + .then(response => { + const multiplyRate = isEmptyValue(response.multiplyRate) ? 0 : response.multiplyRate + if (containerUuid === 'Collection') { + commit('currencyMultiplyRateCollection', multiplyRate) + } else { + commit('currencyMultiplyRate', multiplyRate) + } + }) + .catch(error => { + console.warn(`conversionMultiplyRate: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + }, + changeMultiplyRate({ commit }, params) { + commit('currencyMultiplyRate', params) + }, + changeDivideRate({ commit }, divideRate) { + commit('currencyDivideRate', divideRate) + }, + createPayments({ dispatch, state, getters }, { + posUuid, + orderUuid, + invoiceUuid, + bankUuid, + referenceNo, + description, + amount, + paymentDate, + tenderTypeCode, + currencyUuid + }) { + const listPayments = getters.getListPayments.find(payment => { + if ((payment.tenderTypeCode === tenderTypeCode) && (payment.tenderTypeCode === 'X') && (currencyUuid === payment.currencyUuid)) { + return payment + } + return undefined + }) + if (isEmptyValue(listPayments)) { + requestCreatePayment({ + posUuid, + orderUuid, + invoiceUuid, + bankUuid, + referenceNo, + description, + amount, + paymentDate, + tenderTypeCode, + currencyUuid + }) + .then(response => { + const orderUuid = response.order_uuid + dispatch('listPayments', { orderUuid }) + }) + .catch(error => { + console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + } else { + requestUpdatePayment({ + paymentUuid: listPayments.uuid, + bankUuid, + referenceNo, + description, + amount: listPayments.amount + amount, + paymentDate, + tenderTypeCode + }) + .then(response => { + const orderUuid = response.order_uuid + dispatch('listPayments', { orderUuid }) + }) + .catch(error => { + console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + } + }, + deletetPayments({ dispatch }, { + orderUuid, + paymentUuid + }) { + requestDeletePayment({ + paymentUuid + }) + .then(response => { + dispatch('listPayments', { orderUuid }) + }) + .catch(error => { + console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + }, + listPayments({ commit, rootGetters }, { posUuid, orderUuid }) { + requestListPayments({ + posUuid, + orderUuid + }) + .then(response => { + commit('setListPayments', response.listPayments) + }) + .catch(error => { + console.warn(`ListPaymentsFromServer: ${error.message}. Code: ${error.code}.`) + }) + }, + tenderTypeDisplaye({ commit }, tenderType) { + const displayTenderType = tenderType.map(item => { + return { + tenderTypeCode: item.id, + tenderTypeDisplay: item.label + } + }) + commit('setTenderTypeDisplaye', displayTenderType) + }, + currencyDisplaye({ commit }, currency) { + const displaycurrency = currency.map(item => { + return { + currencyUuid: item.uuid, + currencyId: item.id, + currencyDisplay: item.label + } + }) + commit('setCurrencyDisplaye', displaycurrency) + }, + convertionPayment({ commit }, { + conversionTypeUuid, + currencyFromUuid, + currencyToUuid + }) { + requestGetConversionRate({ + conversionTypeUuid, + currencyFromUuid, + currencyToUuid + }) + .then(response => { + commit('setConvertionPayment', response) + }) + .catch(error => { + console.warn(`ConvertionPayment: ${error.message}. Code: ${error.code}.`) + showMessage({ + type: 'error', + message: error.message, + showClose: true + }) + }) + } +} diff --git a/src/store/modules/ADempiere/pointOfSales/payments/getters.js b/src/store/modules/ADempiere/pointOfSales/payments/getters.js new file mode 100644 index 00000000..0acc707a --- /dev/null +++ b/src/store/modules/ADempiere/pointOfSales/payments/getters.js @@ -0,0 +1,36 @@ +/** + * Payments Getters + * @author Elsio Sanchez + */ + +export default { + getPaymentBox: (state) => { + console.log({ state }) + return state + }, + getMultiplyRate: (state) => { + return state.multiplyRate + }, + getDivideRate: (state) => { + return state.divideRate + }, + getMultiplyRateCollection: (state) => { + return state.multiplyRateCollection + }, + getDivideRateCollection: (state) => { + return state.divideRateCollection + }, + getListPayments: (state) => { + console.log({ state }, 1) + return state.listPayments + }, + getListsPaymentTypes: (state) => { + return state.tenderTypeDisplaye + }, + getListCurrency: (state) => { + return state.currency + }, + getConvertionPayment: (state) => { + return state.convertion + } +} diff --git a/src/store/modules/ADempiere/pointOfSales/payments/index.js b/src/store/modules/ADempiere/pointOfSales/payments/index.js new file mode 100644 index 00000000..b41bf009 --- /dev/null +++ b/src/store/modules/ADempiere/pointOfSales/payments/index.js @@ -0,0 +1,18 @@ + +import state from './state.js' +import mutations from './mutations.js' +import actions from './actions.js' +import getters from './getters.js' + +/** + * Payments Vuex Module + * @author Elsio Sanchez + */ +const collection = { + state, + mutations, + actions, + getters +} + +export default collection diff --git a/src/store/modules/ADempiere/pointOfSales/payments/mutations.js b/src/store/modules/ADempiere/pointOfSales/payments/mutations.js new file mode 100644 index 00000000..870e0d1c --- /dev/null +++ b/src/store/modules/ADempiere/pointOfSales/payments/mutations.js @@ -0,0 +1,34 @@ + +/** + * Payments Mutations + * @author Elsio Sanchez + */ +export default { + addPaymentBox(state, paymentBox) { + state.paymentBox.push(paymentBox) + }, + currencyMultiplyRate(state, multiplyRate) { + state.multiplyRate = multiplyRate + }, + currencyDivideRate(state, divideRate) { + state.divideRate = divideRate + }, + currencyMultiplyRateCollection(state, multiplyRateCollection) { + state.multiplyRateCollection = multiplyRateCollection + }, + currencyDivideRateCollection(state, divideRateCollection) { + state.divideRateCollection = divideRateCollection + }, + setListPayments(state, list) { + state.listPayments = list + }, + setTenderTypeDisplaye(state, tenderTypeDisplaye) { + state.tenderTypeDisplaye = tenderTypeDisplaye + }, + setCurrencyDisplaye(state, currency) { + state.currency = currency + }, + setConvertionPayment(state, convertion) { + state.convertion = convertion + } +} diff --git a/src/store/modules/ADempiere/pointOfSales/payments/state.js b/src/store/modules/ADempiere/pointOfSales/payments/state.js new file mode 100644 index 00000000..cb96ac00 --- /dev/null +++ b/src/store/modules/ADempiere/pointOfSales/payments/state.js @@ -0,0 +1,20 @@ +/** + * Payment State + * @author Elsio Sanchez + */ +export default { + paymentBox: [], + multiplyRate: 1, + divideRate: 1, + multiplyRateCollection: 1, + divideRateCollection: 1, + listPayments: [], + tenderTypeDisplaye: [ + { + tenderTypeCode: 0, + tenderTypeDisplay: '' + } + ], + currency: [], + convertion: {} +}