From 1e42f1ede9acf2b5dcd0b205d6ba86a7b4016e31 Mon Sep 17 00:00:00 2001
From: Elsio Sanchez <45974454+elsiosanchez@users.noreply.github.com>
Date: Thu, 22 Apr 2021 23:37:05 -0400
Subject: [PATCH] Feature/refactory pos (#760)
* adding Point of Sale features
* Delete Ineccessary Getters
* minimal changes
* add list product Price and Order Line
* Add license
* minimal changes
* unify getters
* minimal changes
* minimal changes
Co-authored-by: Elsio Sanchez
- {{ $t('form.pos.order.pointSale') }}: {{ namePointOfSales.name }}
+ {{ $t('form.pos.order.pointSale') }}: {{ currentPointOfSales.name }}
{{ $t('form.pos.order.seller') }}: - {{ getOrder.salesRepresentative.name }} + {{ currentOrder.salesRepresentative.name }}
-{{ $t('form.pos.order.subTotal') }}:{{ formatPrice(getOrder.totalLines, currencyPoint.iSOCode) }}
-{{ $t('form.pos.order.discount') }}:{{ formatPrice(0, currencyPoint.iSOCode) }}
-{{ $t('form.pos.order.tax') }}:{{ getOrderTax(currencyPoint.iSOCode) }}
+{{ $t('form.pos.order.subTotal') }}:{{ formatPrice(currentOrder.totalLines, pointOfSalesCurrency.iSOCode) }}
+{{ $t('form.pos.order.discount') }}:{{ formatPrice(0, pointOfSalesCurrency.iSOCode) }}
+{{ $t('form.pos.order.tax') }}:{{ getOrderTax(pointOfSalesCurrency.iSOCode) }}
{{ $t('form.pos.order.total') }}:
@@ -242,25 +243,25 @@
{{ $t('form.pos.order.order') }}: {{ getOrder.documentNo }}
+{{ $t('form.pos.order.order') }}: {{ currentOrder.documentNo }}
{{ $t('form.pos.order.date') }}: {{ orderDate }}
-{{ $t('form.pos.order.type') }}:{{ getOrder.documentType.name }}
+{{ $t('form.pos.order.type') }}:{{ currentOrder.documentType.name }}
{{ $t('form.pos.order.itemQuantity') }}
@@ -348,30 +349,17 @@ export default {
}
return 'padding-left: 0px; padding-right: 0px; padding-top: 2.2%;margin-right: 1%;float: right;'
},
- namePointOfSales() {
- const currentPOS = this.$store.getters.getCurrentPOS
- if (currentPOS && !this.isEmptyValue(currentPOS.name)) {
- return currentPOS
- }
- return {
- name: '',
- uuid: ''
- }
- },
- sellingPointsList() {
- return this.$store.getters.getSellingPointsList
- },
orderDate() {
- if (this.isEmptyValue(this.getOrder) || this.isEmptyValue(this.getOrder.dateOrdered)) {
+ if (this.isEmptyValue(this.currentOrder) || this.isEmptyValue(this.currentOrder.dateOrdered)) {
return this.formatDate(new Date())
}
- return this.formatDate(this.getOrder.dateOrdered)
+ return this.formatDate(this.currentOrder.dateOrdered)
},
getItemQuantity() {
- if (this.isEmptyValue(this.getOrder)) {
+ if (this.isEmptyValue(this.currentOrder)) {
return 0
}
- const result = this.allOrderLines.map(order => {
+ const result = this.listOrderLine.map(order => {
return order.quantityOrdered
})
@@ -383,21 +371,10 @@ export default {
return 0
},
numberOfLines() {
- if (this.isEmptyValue(this.getOrder)) {
+ if (this.isEmptyValue(this.currentOrder)) {
return
}
- return this.allOrderLines.length
- },
- currencyPoint() {
- const currency = this.currentPoint
- if (!this.isEmptyValue(currency)) {
- return currency.priceList.currency
- }
- return {
- uuid: '',
- iSOCode: '',
- curSymbol: ''
- }
+ return this.listOrderLine.length
},
multiplyRate() {
return this.$store.getters.getMultiplyRate
@@ -414,28 +391,31 @@ export default {
columnName: 'C_Currency_ID_UUID'
})
},
- displayeTypeCurrency() {
- return this.$store.getters.getValueOfField({
- containerUuid: this.containerUuid,
- columnName: 'DisplayColumn_C_Currency_ID'
- })
- },
- isDisabled() {
- return this.$store.getters.getIsProcessed
- },
labelButtonCollections() {
return this.isDisabled ? this.$t('form.pos.order.collections') : this.$t('form.pos.order.collect')
}
},
watch: {
- namePo1intOfSales(value) {
- if (!this.isEmptyValue(value)) {
- this.$router.push({
- query: {
- pos: value.id
- }
+ currencyUuid(value) {
+ if (!this.isEmptyValue(value) && !this.isEmptyValue(this.currentPointOfSales)) {
+ this.$store.dispatch('conversionDivideRate', {
+ conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
+ currencyFromUuid: this.pointOfSalesCurrency.uuid,
+ currencyToUuid: value
})
}
+ },
+ converCurrency(value) {
+ if (!this.isEmptyValue(value) && !this.isEmptyValue(this.currentPointOfSales)) {
+ this.$store.dispatch('conversionMultiplyRate', {
+ containerUuid: 'Order',
+ conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
+ currencyFromUuid: this.pointOfSalesCurrency.uuid,
+ currencyToUuid: value
+ })
+ } else {
+ this.$store.commit('currencyMultiplyRate', 1)
+ }
}
},
mounted() {
@@ -444,10 +424,6 @@ export default {
}
},
methods: {
- changePos(posElement) {
- this.$store.dispatch('setCurrentPOS', posElement)
- this.newOrder()
- },
openCollectionPanel() {
this.isShowedPOSKeyLayout = !this.isShowedPOSKeyLayout
this.$store.commit('setShowPOSCollection', true)
@@ -456,59 +432,6 @@ export default {
this.isShowedPOSKeyLaout = !this.isShowedPOSKeyLaout
this.$store.commit('setShowPOSOptions', false)
},
- newOrder() {
- this.$router.push({
- params: {
- ...this.$route.params
- },
- query: {
- pos: this.currentPoint.id
- }
- }).catch(() => {
- }).finally(() => {
- this.$store.commit('setListPayments', {
- payments: []
- })
- const { templateBusinessPartner } = this.currentPoint
- this.$store.commit('updateValuesOfContainer', {
- containerUuid: this.metadata.containerUuid,
- attributes: [{
- columnName: 'UUID',
- value: undefined
- },
- {
- columnName: 'ProductValue',
- value: undefined
- },
- {
- columnName: 'C_BPartner_ID',
- value: templateBusinessPartner.id
- },
- {
- columnName: 'DisplayColumn_C_BPartner_ID',
- value: templateBusinessPartner.name
- },
- {
- columnName: ' C_BPartner_ID_UUID',
- value: templateBusinessPartner.uuid
- }]
- })
- this.$store.dispatch('setOrder', {
- documentType: {},
- documentStatus: {
- value: ''
- },
- totalLines: 0,
- grandTotal: 0,
- salesRepresentative: {},
- businessPartner: {
- value: '',
- uuid: ''
- }
- })
- this.$store.dispatch('listOrderLine', [])
- })
- },
open() {
if (!this.seeConversion) {
this.seeConversion = true
diff --git a/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js b/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js
index 8d4e3a91..7dfbec84 100644
--- a/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js
+++ b/src/components/ADempiere/Form/VPOS/Order/orderLineMixin.js
@@ -99,7 +99,6 @@ export default {
},
listOrderLines({ uuid: orderUuid }) {
if (!this.isEmptyValue(orderUuid)) {
- this.$store.dispatch('listOrderLinesFromServer', orderUuid)
this.orderLines = this.listOrderLine
this.handleCurrentLineChange(this.currentOrderLine)
}
@@ -168,8 +167,7 @@ export default {
if (columnName === 'LineDescription') {
return row.lineDescription
}
-
- const currency = this.currencyPoint.iSOCode
+ const currency = this.pointOfSalesCurrency.iSOCode
if (columnName === 'CurrentPrice') {
return this.formatPrice(row.priceActual, currency)
} else if (columnName === 'QtyOrdered') {
diff --git a/src/components/ADempiere/Form/VPOS/OrderList/index.vue b/src/components/ADempiere/Form/VPOS/OrderList/index.vue
index 62aa8bca..1625578f 100644
--- a/src/components/ADempiere/Form/VPOS/OrderList/index.vue
+++ b/src/components/ADempiere/Form/VPOS/OrderList/index.vue
@@ -55,8 +55,8 @@