1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

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 <elsiosanche@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-04-22 23:37:05 -04:00 committed by GitHub
parent 0e698293c8
commit 1e42f1ede9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 1412 additions and 1097 deletions

View File

@ -180,7 +180,7 @@ export default {
this.$store.dispatch('processPos', {
action: action, // process metadata
parentUuid: this.parentUuid,
idProcess: this.$store.getters.getFindOrder.id,
idProcess: this.$store.getters.posAttributes.currentOrder.id,
containerUuid: this.containerUuid,
panelType: this.panelType, // determinate if get table name and record id (window) or selection (browser)
parametersList: this.$store.getters.getPosParameters

View File

@ -143,7 +143,7 @@ export default {
return this.currentImageOfProduct
},
currentPoint() {
return this.$store.getters.getCurrentPOS
return this.$store.getters.posAttributes.currentPointOfSales
}
},
created() {

View File

@ -71,7 +71,7 @@ export default {
return []
},
currentPos() {
return this.$store.getters.getCurrentPOS
return this.$store.getters.posAttributes.currentPointOfSales
},
keyShortcuts() {
return {

View File

@ -199,7 +199,7 @@ export default {
return this.$store.state['pointOfSales/listProductPrice'].productPrice[this.attribute]
},
currentPoint() {
return this.$store.getters.getCurrentPOS
return this.$store.getters.posAttributes.currentPointOfSales
},
productPrice() {
return this.$store.getters.getProductPrice
@ -223,7 +223,7 @@ export default {
return (!isLoaded || isReload) // && this.isShowProductsPriceList
},
listPrice() {
const pos = this.$store.getters.getCurrentPOS
const pos = this.currentPoint
if (!this.isEmptyValue(pos)) {
return pos.priceList.id
}
@ -403,7 +403,6 @@ export default {
* @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', {

View File

@ -119,7 +119,7 @@ export default {
}
})
valuesToSend['posUuid'] = this.$store.getters.getPointOfSalesUuid
valuesToSend['posUuid'] = this.$store.getters.posAttributes.currentPointOfSales.uuid
return valuesToSend
},
setBusinessPartner({ id, name, uuid }, isCloseForm = true) {

View File

@ -32,10 +32,10 @@
<convert-amount
:convert="multiplyRate"
:amount="currentOrder.grandTotal"
:currency="currencyPoint"
:currency="pointOfSalesCurrency"
/>
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;">
{{ formatPrice(currentOrder.grandTotal, currencyPoint.iSOCode) }}
{{ formatPrice(currentOrder.grandTotal, pointOfSalesCurrency.iSOCode) }}
</el-button>
</el-popover>
</b>
@ -50,10 +50,10 @@
<convert-amount
:convert="multiplyRate"
:amount="pending"
:currency="currencyPoint"
:currency="pointOfSalesCurrency"
/>
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;">
{{ formatPrice(pending, currencyPoint.iSOCode) }}
{{ formatPrice(pending, pointOfSalesCurrency.iSOCode) }}
</el-button>
</el-popover>
</b>
@ -75,7 +75,7 @@
:key="field.columnName"
:metadata-field="field.columnName === 'PayAmt' ? {
...field,
labelCurrency: isEmptyValue($store.getters.getFieldCuerrency) ? currencyPoint : $store.getters.getFieldCuerrency
labelCurrency: isEmptyValue($store.getters.getFieldCuerrency) ? pointOfSalesCurrency : $store.getters.getFieldCuerrency
} : field"
/>
</el-col>
@ -94,7 +94,7 @@
<type-collection
v-if="!updateOrderPaymentPos"
:is-add-type-pay="listPayments"
:currency="currencyPoint"
:currency="pointOfSalesCurrency"
:list-types-payment="fieldsList[2]"
:is-loaded="isLoadedPayments"
/>
@ -125,10 +125,10 @@
<convert-amount
:convert="multiplyRate"
:amount="currentOrder.grandTotal"
:currency="currencyPoint"
:currency="pointOfSalesCurrency"
/>
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;">
{{ formatPrice(currentOrder.grandTotal, currencyPoint.iSOCode) }}
{{ formatPrice(currentOrder.grandTotal, pointOfSalesCurrency.iSOCode) }}
</el-button>
</el-popover>
</b>
@ -144,10 +144,10 @@
<convert-amount
:convert="multiplyRate"
:amount="pending"
:currency="currencyPoint"
:currency="pointOfSalesCurrency"
/>
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;">
{{ formatPrice(pending, currencyPoint.iSOCode) }}
{{ formatPrice(pending, pointOfSalesCurrency.iSOCode) }}
</el-button>
</el-popover>
</b>
@ -163,10 +163,10 @@
<convert-amount
:convert="multiplyRate"
:amount="pay"
:currency="currencyPoint"
:currency="pointOfSalesCurrency"
/>
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;">
{{ formatPrice(pay, currencyPoint.iSOCode) }}
{{ formatPrice(pay, pointOfSalesCurrency.iSOCode) }}
</el-button>
</el-popover>
</b>
@ -181,10 +181,10 @@
<convert-amount
:convert="multiplyRate"
:amount="change"
:currency="currencyPoint"
:currency="pointOfSalesCurrency"
/>
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;">
{{ formatPrice(change, currencyPoint.iSOCode) }}
{{ formatPrice(change, pointOfSalesCurrency.iSOCode) }}
</el-button>
</el-popover>
</b>
@ -205,6 +205,7 @@ import typeCollection from '@/components/ADempiere/Form/VPOS/Collection/typeColl
import convertAmount from '@/components/ADempiere/Form/VPOS/Collection/convertAmount/index'
import { formatDate, formatPrice } from '@/utils/ADempiere/valueFormat.js'
import { processOrder } from '@/api/ADempiere/form/point-of-sales.js'
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
export default {
name: 'Collection',
@ -213,7 +214,8 @@ export default {
convertAmount
},
mixins: [
formMixin
formMixin,
posMixin
],
props: {
isLoadedPanel: {
@ -261,7 +263,6 @@ export default {
}
}
return collection
// return false
},
fullCopper() {
if ((this.change > this.isCashAmt) && this.pay > this.currentOrder.grandTotal) {
@ -284,14 +285,14 @@ export default {
},
listPayments() {
const listLocal = this.$store.getters.getPaymentBox
const listServer = this.$store.getters.getPos.listPayments
const listServer = this.currentOrder.listPayments
if (!this.sendToServer) {
return listServer.payments
}
return listLocal
},
isLoadedPayments() {
return this.$store.getters.getPos.listPayments.isLoaded
return this.currentOrder.listPayments.isLoaded
},
paymentBox() {
const payment = this.listPayments.filter(pay => {
@ -418,21 +419,6 @@ export default {
}
return 0
},
currencyPoint() {
const currency = this.$store.getters.getCurrentPOS
if (!this.isEmptyValue(currency)) {
return currency.priceList.currency
}
return {
uuid: '',
iSOCode: '',
curSymbol: '',
id: 0
}
},
currentOrder() {
return this.$store.getters.getPos.currentOrder
},
typeCurrency() {
return this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
@ -445,12 +431,6 @@ export default {
columnName: 'C_Currency_ID_UUID'
})
},
displayeTypeCurrency() {
return this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
columnName: 'DisplayColumn_C_Currency_ID'
})
},
multiplyRate() {
return this.$store.getters.getMultiplyRate
},
@ -479,9 +459,6 @@ export default {
}
return true
},
fieldpending() {
return this.pending
},
displayCurrency() {
return this.$store.getters.getListCurrency
},
@ -491,18 +468,11 @@ export default {
updateOrderPaymentPos() {
return this.$store.getters.getUpdatePaymentPos
},
isDisabled() {
return this.$store.getters.getPos.isProcessed
currentPointOfSales() {
return this.$store.getters.posAttributes.currentPointOfSales
}
},
watch: {
fieldpending(value) {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'PayAmt',
value: value
})
},
pending(value) {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
@ -513,17 +483,17 @@ export default {
currencyUuid(value) {
if (!this.isEmptyValue(value)) {
this.$store.dispatch('conversionDivideRate', {
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
currencyFromUuid: this.pointOfSalesCurrency.uuid,
currencyToUuid: value
})
}
if (this.isEmptyValue(value)) {
this.$store.commit('setFieldCurrency', this.currencyPoint)
this.$store.commit('setFieldCurrency', this.pointOfSalesCurrency)
this.$store.dispatch('conversionDivideRate', {
containerUuid: 'Collection',
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
currencyFromUuid: this.currencyPoint.uuid,
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
currencyFromUuid: this.pointOfSalesCurrency.uuid,
currencyToUuid: value
})
}
@ -534,6 +504,18 @@ export default {
}
this.allPayCurrency = this.pay
},
converCurrency(value) {
if (!this.isEmptyValue(value)) {
this.$store.dispatch('conversionMultiplyRate', {
containerUuid: 'Collection',
conversionTypeUuid: this.currentPointOfSales,
currencyFromUuid: this.pointOfSalesCurrency.uuid,
currencyToUuid: value
})
} else {
this.$store.commit('currencyMultiplyRate', 1)
}
},
isLoaded(value) {
if (value) {
this.$store.commit('updateValueOfField', {
@ -566,7 +548,7 @@ export default {
},
addCollectToList() {
const containerUuid = this.containerUuid
const posUuid = this.$store.getters.getCurrentPOS.uuid
const posUuid = this.currentPointOfSales.uuid
const orderUuid = this.$route.query.action
const bankUuid = this.$store.getters.getValueOfField({
containerUuid,
@ -597,7 +579,7 @@ export default {
columnName: 'C_Currency_ID'
})
const currencyToPay = this.isEmptyValue(currencyUuid) ? currencyId : currencyUuid
if (this.isEmptyValue(this.currencyDisplay(currencyToPay)) && this.currencyDisplay(currencyToPay).currencyUuid !== this.currencyPoint.uuid) {
if (this.isEmptyValue(this.currencyDisplay(currencyToPay)) && this.currencyDisplay(currencyToPay).currencyUuid !== this.pointOfSalesCurrency.uuid) {
this.amontSend = this.convert.divideRate * this.amontSend
}
if (this.sendToServer) {
@ -626,8 +608,7 @@ export default {
this.addCollect()
},
updateServer(listPaymentsLocal) {
// const listLocal = this.$store.getters.getPaymentBox
const posUuid = this.$store.getters.getCurrentPOS.uuid
const posUuid = this.currentPointOfSales.uuid
const orderUuid = this.$route.query.action
this.$store.dispatch('uploadOrdersToServer', { listPaymentsLocal, posUuid, orderUuid })
},
@ -648,7 +629,7 @@ export default {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'C_Currency_ID',
value: this.currencyPoint.id
value: this.pointOfSalesCurrency.id
})
this.$store.commit('updateValueOfField', {
parentUuid: '',
@ -683,7 +664,7 @@ export default {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'C_Currency_ID',
value: this.currencyPoint.id
value: this.pointOfSalesCurrency.id
})
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
@ -723,17 +704,17 @@ export default {
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'DisplayColumn_C_Currency_ID',
value: this.currencyPoint.iSOCode
value: this.pointOfSalesCurrency.iSOCode
})
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'C_Currency_ID',
value: this.currencyPoint.id
value: this.pointOfSalesCurrency.id
})
this.$store.commit('updateValueOfField', {
containerUuid: this.containerUuid,
columnName: 'C_Currency_ID_UUID',
value: this.currencyPoint.uuid
value: this.pointOfSalesCurrency.uuid
})
},
defaulTenderType() {
@ -753,11 +734,19 @@ export default {
if (display) {
return display
}
if (currency === this.currencyPoint.id) {
return this.currencyPoint.uuid
if (currency === this.pointOfSalesCurrency.id) {
return this.pointOfSalesCurrency.uuid
}
return currency
},
convertCurrency() {
const convertCurrency = this.currencyDisplay(100)
this.$store.dispatch('convertionPayment', {
conversionTypeUuid: this.currentPointOfSales,
currencyFromUuid: this.pointOfSalesCurrency.uuid,
currencyToUuid: convertCurrency.currencyUuid
})
},
undoPatment() {
const list = this.listPayments[this.listPayments.length - 1]
const orderUuid = list.orderUuid
@ -768,7 +757,7 @@ export default {
})
},
completePreparedOrder(payment) {
const posUuid = this.$store.getters.getCurrentPOS.uuid
const posUuid = this.currentPointOfSales.uuid
const orderUuid = this.$route.query.action
this.$store.dispatch('updateOrderPos', true)
this.$store.dispatch('updatePaymentPos', true)
@ -800,7 +789,7 @@ export default {
})
.finally(() => {
this.$store.dispatch('listOrdersFromServer', {
posUuid: this.$store.getters.getCurrentPOS.uuid
posUuid: this.currentPointOfSales.uuid
})
this.$store.dispatch('updateOrderPos', false)
this.$store.dispatch('updatePaymentPos', false)

View File

@ -99,9 +99,13 @@ import {
import {
requestGetConversionRate
} from '@/api/ADempiere/form/point-of-sales.js'
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
export default {
name: 'TypeCollection',
mixins: [
posMixin
],
props: {
isAddTypePay: {
type: Array,
@ -151,7 +155,7 @@ export default {
const currencyUuid = this.isAddTypePay.find(pay => pay.currencyUuid !== this.currency.uuid)
if (!this.isEmptyValue(currencyUuid)) {
requestGetConversionRate({
conversionTypeUuid: this.$store.getters.getCurrentPOS.conversionTypeUuid,
conversionTypeUuid: this.currentPointOfSales.conversionTypeUuid,
currencyFromUuid: this.currency.uuid,
currencyToUuid: currencyUuid.currencyUuid
})

View File

@ -126,11 +126,8 @@ export default {
defaultImage() {
return require('@/image/ADempiere/pos/no-image.jpg')
},
currentPoint() {
return this.$store.getters.getCurrentPOS
},
listOrderLine() {
return this.$store.getters.getPos.lineOrder
currentPointOfSales() {
return this.$store.getters.posAttributes.currentPointOfSales
},
getKeyLayout() {
return this.$store.getters.getKeyLayout
@ -176,7 +173,7 @@ export default {
methods: {
formatQuantity,
loadKeyLayout(uuid = null) {
const currentPOS = this.currentPoint
const currentPOS = this.currentPointOfSales
if (this.isEmptyValue(currentPOS) || this.isEmptyValue(currentPOS.uuid)) {
this.$message({
type: 'warn',
@ -254,10 +251,10 @@ export default {
}
},
handleCommand(command) {
const point = this.$store.getters.getPointOfSalesUuid.keyLayoutUuid
const point = this.$store.getters.posAttributes.currentPointOfSales.uuid
const toReturn = this.getKeyList.find(keyLayoutItem => keyLayoutItem.subKeyLayoutUuid === point)
let keyLayoutUuid = this.currentPoint.keyLayoutUuid
let keyLayoutUuid = this.currentPointOfSales.keyLayoutUuid
if (!this.isEmptyValue(toReturn)) {
keyLayoutUuid = toReturn.subKeyLayoutUuid
}

View File

@ -238,7 +238,7 @@
</p>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="item in sellingPointsList"
v-for="item in listPointOfSales"
:key="item.uuid"
:command="item"
>
@ -260,7 +260,6 @@
:is-selectable="false"
popover-name="isShowPopoverMenu"
/>
<div
slot="reference"
:style="blockOption"
@ -295,6 +294,7 @@ import {
} from '@/api/ADempiere/form/point-of-sales.js'
import ModalDialog from '@/components/ADempiere/Dialog'
import posProcess from '@/utils/ADempiere/constants/posProcess'
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
import orderLineMixin from '@/components/ADempiere/Form/VPOS/Order/orderLineMixin.js'
export default {
@ -305,7 +305,8 @@ export default {
ModalDialog
},
mixins: [
orderLineMixin
orderLineMixin,
posMixin
],
props: {
metadata: {
@ -323,7 +324,7 @@ export default {
computed: {
isShowProductsPriceList: {
get() {
return this.$store.state['pointOfSales/listProductPrice'].productPrice.isShowPopoverMenu
return this.$store.state['pointOfSales/point/index'].productPrice.isShowPopoverMenu
},
set(isShowed) {
if (!this.isEmptyValue(this.$route.query.pos)) {
@ -336,7 +337,7 @@ export default {
},
isShowOrdersList: {
get() {
return this.$store.getters.getPos.listOrder.isShowPopover
return this.ordersList.isShowPopover
},
set(value) {
if (!this.isEmptyValue(this.$route.query.pos)) {
@ -344,22 +345,6 @@ export default {
}
}
},
sellingPointsList() {
return this.$store.getters.getSellingPointsList
},
currentPOS() {
return this.$store.getters.getPos.currentOrder
},
currentPoint() {
return this.$store.getters.getCurrentPOS
},
pointOfSalesId() {
const currentPOS = this.currentPOS
if (!this.isEmptyValue(currentPOS)) {
return currentPOS.id
}
return undefined
},
blockOption() {
if (!this.isEmptyValue(this.$route.query.pos)) {
return 'cursor: pointer; text-align: center !important; color: black'
@ -379,67 +364,6 @@ export default {
event.preventDefault()
return false
},
changePos(posElement) {
this.$store.dispatch('setCurrentPOS', posElement)
this.newOrder()
},
newOrder() {
const pos = this.pointOfSalesId || this.$route.query.pos
this.$router.push({
params: {
...this.$route.params
},
query: {
pos
}
}).catch(error => {
console.info(`VPOS/Options component (New Order): ${error.message}`)
}).finally(() => {
const { templateBusinessPartner } = this.$store.getters.getCurrentPOS
// TODO: Set order with POS Terminal default values
this.$store.commit('setListPayments', {
payments: []
})
this.$store.dispatch('setOrder', {
documentType: {},
documentStatus: {
value: ''
},
totalLines: 0,
grandTotal: 0,
salesRepresentative: {},
businessPartner: {
value: '',
uuid: ''
}
})
this.$store.dispatch('listOrderLine', [])
this.$store.commit('setShowPOSCollection', false)
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: this.$store.getters['user/getUserUuid']
}]
})
})
},
printOrder() {
printOrder({
orderUuid: this.$route.query.action
@ -454,7 +378,7 @@ export default {
})
},
completePreparedOrder() {
const posUuid = this.currentPoint.uuid
const posUuid = this.currentPointOfSales.uuid
this.$store.dispatch('updateOrderPos', true)
this.$store.dispatch('updatePaymentPos', true)
this.$message({
@ -465,8 +389,8 @@ export default {
processOrder({
posUuid,
orderUuid: this.$route.query.action,
createPayments: !this.isEmptyValue(this.$store.getters.getPos.listPayments),
payments: this.$store.getters.getPos.listPayments
createPayments: !this.isEmptyValue(this.currentOrder.listPayments),
payments: this.currentOrder.listPayments
})
.then(response => {
this.$store.dispatch('reloadOrder', response.uuid)
@ -485,7 +409,7 @@ export default {
})
.finally(() => {
this.$store.dispatch('listOrdersFromServer', {
posUuid: this.$store.getters.getCurrentPOS.uuid
posUuid: this.currentPointOfSales.uuid
})
this.$store.dispatch('updateOrderPos', false)
this.$store.dispatch('updatePaymentPos', false)
@ -497,11 +421,11 @@ export default {
const parametersList = [
{
columnName: 'C_Order_ID',
value: this.$store.getters.getPos.currentOrder.id
value: this.currentOrder.id
},
{
columnName: 'Bill_BPartner_ID',
value: this.$store.getters.getPos.currentOrder.businessPartner.id
value: this.currentOrder.businessPartner.id
},
{
columnName: 'IsCancelled',
@ -542,16 +466,16 @@ export default {
},
copyOrder() {
this.processPos = posProcess[1].uuid
const posUuid = this.currentPoint.uuid
const posUuid = this.currentPointOfSales.uuid
const parametersList = [{
columnName: 'C_Order_ID',
value: this.$store.getters.getPos.currentOrder.id
value: this.currentOrder.id
}]
this.$store.dispatch('addParametersProcessPos', parametersList)
requestCreateOrder({
posUuid,
customerUuid: this.currentPOS.businessPartner.uuid,
salesRepresentativeUuid: this.currentPOS.salesRepresentative.uuid
customerUuid: this.currentPointOfSales.businessPartner.uuid,
salesRepresentativeUuid: this.currentPointOfSales.salesRepresentative.uuid
})
.then(order => {
this.$store.dispatch('currentOrder', order)
@ -600,11 +524,11 @@ export default {
orderUuid: this.$route.query.action
})
.then(response => {
this.changePos(this.$store.getters.getCurrentPOS)
this.changePos(this.currentPointOfSales)
})
.finally(() => {
this.$store.dispatch('listOrdersFromServer', {
posUuid: this.$store.getters.getCurrentPOS.uuid
posUuid: this.currentPointOfSales.uuid
})
this.$message({
type: 'success',
@ -615,7 +539,7 @@ export default {
})
},
seeOrderList() {
if (this.$store.getters.getPos.listOrder.recordCount <= 0) {
if (this.ordersList.recordCount <= 0) {
this.$store.dispatch('listOrdersFromServer', {})
}
},

View File

@ -52,11 +52,11 @@
</el-col>
<el-col :span="2" :style="isShowedPOSKeyLayout ? 'margin-top: 3.4%;padding: 0px;' : 'padding: 0px;margin-top: 2.4%;'">
<el-tag
v-if="!isEmptyValue(getOrder.documentStatus.value)"
:type="tagStatus(getOrder.documentStatus.value)"
v-if="!isEmptyValue(currentOrder.documentStatus.value)"
:type="tagStatus(currentOrder.documentStatus.value)"
>
<span v-if="!isEmptyValue(getOrder.documentStatus.value)">
{{ getOrder.documentStatus.name }}
<span v-if="!isEmptyValue(currentOrder.documentStatus.value)">
{{ currentOrder.documentStatus.name }}
</span>
</el-tag>
</el-col>
@ -74,7 +74,7 @@
<el-table
ref="linesTable"
v-shortkey="shortsKey"
:data="allOrderLines"
:data="listOrderLine"
border
style="width: 100%; max-width: 100%; background-color: #FFFFFF; font-size: 14px; overflow: auto; color: #606266;"
highlight-current-row
@ -138,7 +138,7 @@
<el-col :span="10">
<div style="float: right">
{{ $t('form.productInfo.price') }}:
<b>{{ formatPrice(currentOrderLine.product.priceStandard, currencyPoint.iSOCode) }}</b>
<b>{{ formatPrice(currentOrderLine.product.priceStandard, pointOfSalesCurrency.iSOCode) }}</b>
<br>
{{ $t('form.productInfo.taxAmount') }}:
<b>{{ currentOrderLine.taxIndicator }}</b>
@ -191,9 +191,9 @@
<div class="keypad">
<el-button type="primary" icon="el-icon-top" :disabled="isDisabled" @click="arrowTop" />
<el-button type="primary" icon="el-icon-bottom" :disabled="isDisabled" @click="arrowBottom" />
<el-button v-show="isValidForDeleteLine(allOrderLines)" type="danger" icon="el-icon-delete" :disabled="isDisabled" @click="deleteOrderLine(currentOrderLine)" />
<el-button v-show="isValidForDeleteLine(listOrderLine)" type="danger" icon="el-icon-delete" :disabled="isDisabled" @click="deleteOrderLine(currentOrderLine)" />
<el-button
v-show="isValidForDeleteLine(allOrderLines)"
v-show="isValidForDeleteLine(listOrderLine)"
type="success"
icon="el-icon-bank-card"
@click="openCollectionPanel"
@ -203,17 +203,18 @@
<br>
<p>
<el-dropdown
v-if="!isEmptyValue(currentPointOfSales)"
trigger="click"
style="padding-top: 8px; color: black;"
@command="changePos"
>
<p>
<i class="el-icon-mobile-phone" />
{{ $t('form.pos.order.pointSale') }}: <b style="cursor: pointer"> {{ namePointOfSales.name }} </b>
{{ $t('form.pos.order.pointSale') }}: <b style="cursor: pointer"> {{ currentPointOfSales.name }} </b>
</p>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="item in sellingPointsList"
v-for="item in listPointOfSales"
:key="item.uuid"
:command="item"
>
@ -225,11 +226,11 @@
</div>
<span style="float: right;">
<p class="total">{{ $t('form.pos.order.seller') }}:<b style="float: right;">
{{ getOrder.salesRepresentative.name }}
{{ currentOrder.salesRepresentative.name }}
</b></p>
<p class="total"> {{ $t('form.pos.order.subTotal') }}:<b class="order-info">{{ formatPrice(getOrder.totalLines, currencyPoint.iSOCode) }}</b></p>
<p class="total"> {{ $t('form.pos.order.discount') }}:<b class="order-info">{{ formatPrice(0, currencyPoint.iSOCode) }}</b> </p>
<p class="total"> {{ $t('form.pos.order.tax') }}:<b style="float: right;">{{ getOrderTax(currencyPoint.iSOCode) }}</b> </p>
<p class="total"> {{ $t('form.pos.order.subTotal') }}:<b class="order-info">{{ formatPrice(currentOrder.totalLines, pointOfSalesCurrency.iSOCode) }}</b></p>
<p class="total"> {{ $t('form.pos.order.discount') }}:<b class="order-info">{{ formatPrice(0, pointOfSalesCurrency.iSOCode) }}</b> </p>
<p class="total"> {{ $t('form.pos.order.tax') }}:<b style="float: right;">{{ getOrderTax(pointOfSalesCurrency.iSOCode) }}</b> </p>
<p class="total">
<b>
{{ $t('form.pos.order.total') }}:
@ -242,25 +243,25 @@
<convert-amount
v-show="seeConversion"
:convert="multiplyRate"
:amount="getOrder.grandTotal"
:currency="currencyPoint"
:amount="currentOrder.grandTotal"
:currency="pointOfSalesCurrency"
/>
<el-button slot="reference" type="text" style="color: #000000;font-weight: 604!important;font-size: 100%;" @click="seeConversion = !seeConversion">
{{ formatPrice(getOrder.grandTotal, currencyPoint.iSOCode) }}
{{ formatPrice(currentOrder.grandTotal, pointOfSalesCurrency.iSOCode) }}
</el-button>
</el-popover>
</b>
</p>
</span>
<span style="float: right;padding-right: 40px;">
<p class="total">{{ $t('form.pos.order.order') }}: <b class="order-info">{{ getOrder.documentNo }}</b></p>
<p class="total">{{ $t('form.pos.order.order') }}: <b class="order-info">{{ currentOrder.documentNo }}</b></p>
<p class="total">
{{ $t('form.pos.order.date') }}:
<b class="order-info">
{{ orderDate }}
</b>
</p>
<p class="total">{{ $t('form.pos.order.type') }}:<b class="order-info">{{ getOrder.documentType.name }}</b></p>
<p class="total">{{ $t('form.pos.order.type') }}:<b class="order-info">{{ currentOrder.documentType.name }}</b></p>
<p class="total">
{{ $t('form.pos.order.itemQuantity') }}
<b class="order-info">
@ -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

View File

@ -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') {

View File

@ -55,8 +55,8 @@
<el-table
ref="orderTable"
v-shortkey="shortsKey"
v-loading="!tableOrder.isLoaded"
:data="ordersList"
v-loading="!ordersList.isLoaded"
:data="ordersList.ordersList"
border
fit
:highlight-current-row="highlightRow"
@ -118,8 +118,8 @@
</el-table>
<custom-pagination
:total="tableOrder.recordCount"
:current-page="tableOrder.pageNumber"
:total="ordersList.recordCount"
:current-page="ordersList.pageNumber"
:handle-change-page="handleChangePage"
/>
</el-main>
@ -136,6 +136,7 @@ import {
formatQuantity
} from '@/utils/ADempiere/valueFormat.js'
import Field from '@/components/ADempiere/Field'
import posMixin from '@/components/ADempiere/Form/VPOS/posMixin.js'
export default {
name: 'OrdersList',
@ -143,6 +144,9 @@ export default {
CustomPagination,
Field
},
mixins: [
posMixin
],
props: {
metadata: {
type: Object,
@ -181,26 +185,18 @@ export default {
}
return false
},
tableOrder() {
return this.$store.getters.getPos.listOrder
},
ordersList() {
const order = this.tableOrder
if (order && !this.isEmptyValue(order.ordersList)) {
return order.ordersList
}
return []
},
selectOrder() {
const action = this.$route.query.action
const order = this.ordersList.find(item => item.uuid === action)
if (!this.isEmptyValue(order)) {
return order
if (!this.isEmptyValue(this.ordersList.ordersList)) {
const order = this.ordersList.ordersList.find(item => item.uuid === action)
if (!this.isEmptyValue(order)) {
return order
}
}
return null
},
isReadyFromGetData() {
const { isReload } = this.tableOrder
const { isReload } = this.ordersList
return isReload
},
shortsKey() {
@ -246,7 +242,7 @@ export default {
containerUuid: this.metadata.containerUuid
})
values = this.convertValuesToSend(values)
const point = this.$store.getters.getPointOfSalesUuid
const point = this.$store.getters.posAttributes.currentPointOfSales.uuid
if (!this.isEmptyValue(point)) {
this.$store.dispatch('listOrdersFromServer', {
...values

View File

@ -73,16 +73,6 @@
</span>
</span>
</el-col>
<!-- <el-col :span="6">
<span class="upc">
{{ props.item.product.description }}
</span>
</el-col> -->
<!-- <el-col :span="6">
<span class="upc">
{{ props.item.quantityAvailable }}
</span>
</el-col> -->
<el-col :span="12">
<span class="price">
{{ formatPrice(props.item.priceStandard, props.item.currency.iSOCode) }}
@ -90,7 +80,6 @@
<span class="quantityAvailable">
{{ formatQuantity(props.item.quantityAvailable) }}
</span>
<!-- {{ props.item.currency.curSymbol }} -->
</span>
</el-col>
</el-row>
@ -199,7 +188,6 @@ export default {
}
return false
})
// Remote search
if (this.isEmptyValue(results) && String(stringToMatch.length > 3)) {
clearTimeout(this.timeOut)

View File

@ -120,8 +120,11 @@ export default {
isShowProductsPriceList() {
return this.$store.state['pointOfSales/listProductPrice'].productPrice[this.attribute]
},
currentPoint() {
return this.$store.getters.getCurrentPOS
// currentPoint() {
// return this.$store.getters.getCurrentPOS
// },
currentPointOfSales() {
return this.$store.getters.posAttributes.currentPointOfSales
},
productPrice() {
return this.$store.getters.getProductPrice
@ -149,12 +152,12 @@ export default {
if (isToLoad) {
this.loadProductsPricesList()
}
},
currentPoint(value) {
if (!this.isEmptyValue(value)) {
this.loadProductsPricesList()
}
}
// currentPointOfSales(value) {
// if (!this.isEmptyValue(value)) {
// this.loadProductsPricesList()
// }
// }
},
created() {
this.unsubscribe = this.subscribeChanges()
@ -162,7 +165,7 @@ export default {
isLoaded: false
})
this.timeOut = setTimeout(() => {
this.validatePos(this.currentPoint)
this.validatePos(this.currentPointOfSales)
}, 3000)
},
beforeDestroy() {

View File

@ -109,12 +109,8 @@ export default {
showCollection() {
return this.$store.getters.getShowCollectionPos
},
pointOfSalesId() {
const currentPOS = this.$store.getters.getCurrentPOS
if (currentPOS && !this.isEmptyValue(currentPOS.id)) {
return currentPOS.id
}
return undefined
listPointOfSales() {
return this.$store.getters.posAttributes.listPointOfSales
}
},
watch: {
@ -130,27 +126,13 @@ export default {
},
created() {
// load pont of sales list
if (this.isEmptyValue(this.$store.getters.getSellingPointsList)) {
let posToSet
if (this.isEmptyValue(this.listPointOfSales)) {
// set pos id with query path
this.$store.dispatch('listPointOfSalesFromServer', posToSet)
this.$store.dispatch('listPointOfSalesFromServer', this.$route.query.pos)
}
this.unsubscribePOSList = this.posListWithOrganization()
},
mounted() {
if (this.isEmptyValue(this.$route.query) || this.isEmptyValue(this.$route.query.pos)) {
this.$router.push({
params: {
...this.$route.params
},
query: {
...this.$route.query,
pos: this.pointOfSalesId
}
}, () => {})
}
},
beforeDestroy() {
this.unsubscribePOSList()
},

View File

@ -23,9 +23,13 @@ import {
formatPrice,
formatQuantity
} from '@/utils/ADempiere/valueFormat.js'
import orderLineMixin from './Order/orderLineMixin.js'
export default {
name: 'POSMixin',
mixins: [
orderLineMixin
],
props: {
metadata: {
type: Object,
@ -56,49 +60,6 @@ export default {
}
},
computed: {
allOrderLines() {
return this.listOrderLine
},
listOrderLine() {
return this.$store.getters.getListOrderLine
},
ordersList() {
const order = this.$store.getters.getListOrder
if (order && !this.isEmptyValue(order.ordersList)) {
return order.ordersList
}
return []
},
currentOrder() {
const action = this.$route.query.action
if (!this.isEmptyValue(action)) {
return this.$store.getters.getOrder
}
return {
documentType: {},
documentStatus: {
value: ''
},
totalLines: 0,
grandTotal: 0,
salesRepresentative: {},
businessPartner: {
value: '',
uuid: ''
}
}
},
currentPoint() {
return this.$store.getters.getCurrentPOS
},
priceListUuid() {
const currentPOS = this.currentPoint
if (this.isEmptyValue(currentPOS)) {
return undefined
}
return this.currentPoint.priceList.uuid
},
getWarehouse() {
return this.$store.getters['user/getWarehouse']
},
@ -114,14 +75,65 @@ export default {
updateOrderProcessPos() {
return this.$store.getters.getUpdateOrderPos
},
getOrder() {
return this.$store.getters.getPos.currentOrder
currentPointOfSales() {
return this.$store.getters.posAttributes.currentPointOfSales
},
// Currency Point Of Sales
pointOfSalesCurrency() {
// const currency = this.currentPointOfSales
if (!this.isEmptyValue(this.currentPointOfSales.priceList)) {
return this.currentPointOfSales.priceList.currency
}
return {
uuid: '',
iSOCode: '',
curSymbol: ''
}
},
listPointOfSales() {
return this.$store.getters.posAttributes.listPointOfSales
},
ordersList() {
if (this.isEmptyValue(this.currentPointOfSales)) {
return []
}
return this.currentPointOfSales.listOrder
},
currentOrder() {
if (this.isEmptyValue(this.currentPointOfSales)) {
return {
documentType: {},
documentStatus: {
value: ''
},
totalLines: 0,
grandTotal: 0,
salesRepresentative: {},
businessPartner: {
value: '',
uuid: ''
}
}
}
return this.currentPointOfSales.currentOrder
},
isDisabled() {
return this.currentPointOfSales.currentOrder.isProcessed
},
listOrderLine() {
if (this.isEmptyValue(this.currentOrder)) {
return []
}
return this.currentOrder.lineOrder
}
},
watch: {
getOrder(value) {
if (!this.isEmptyValue(value)) {
// this.order = value
currentOrder(value) {
if (this.isEmptyValue(value)) {
this.orderLines = []
this.$store.dispatch('listOrderLine', [])
this.listOrderLines()
} else {
this.$store.commit('updateValuesOfContainer', {
parentUuid: this.parentUuid,
containerUuid: this.containerUuid,
@ -140,71 +152,24 @@ export default {
})
}
},
currentOrder(value) {
if (this.isEmptyValue(value)) {
this.orderLines = []
this.$store.dispatch('listOrderLine', [])
this.listOrderLines({})
} else {
this.listOrderLines(value)
}
},
currentPoint(value) {
if (!this.isEmptyValue(value)) {
this.$store.dispatch('setCurrentPOS', value)
}
},
/**
* Used when loading/reloading the app without the order uuid
* @param {oject|boolean} bPartnerToSet
*/
isSetTemplateBP(bPartnerToSet) {
if (bPartnerToSet) {
this.setBusinessPartner(bPartnerToSet)
}
},
updateOrderProcessPos(value) {
if (!value && !this.isEmptyValue(this.$route.query)) {
this.reloadOrder(true)
}
}
},
created() {
this.getPanel()
},
beforeMount() {
if (!this.isEmptyValue(this.currentPoint)) {
if (!this.isEmptyValue(this.currentOrder)) {
this.listOrderLines(this.currentOrder)
}
}
this.unsubscribe = this.subscribeChanges()
},
beforeDestroy() {
this.unsubscribe()
},
mounted() {
if (!this.isEmptyValue(this.$route.query)) {
this.reloadOrder(true, this.$route.query.action)
}
if (!this.isEmptyValue(this.$route.query.pos) && !this.isEmptyValue(this.allOrderLines) && this.isEmptyValue(this.$route.query.action)) {
this.$router.push({
params: {
...this.$route.params
},
query: {
...this.$route.query,
action: this.getOrder.uuid
}
}, () => {})
}
},
methods: {
formatDate,
formatPrice,
formatQuantity,
withoutPOSTerminal() {
if (this.isEmptyValue(this.currentPoint)) {
if (this.isEmptyValue(this.currentPointOfSales)) {
this.$message({
type: 'warn',
message: 'Without POS Terminal',
@ -231,7 +196,7 @@ export default {
},
updateOrder(update) {
// user session
if (update.value !== this.getOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPoint)) {
if (update.value !== this.currentOrder.businessPartner.uuid && !this.isEmptyValue(this.currentPoint)) {
this.$store.dispatch('updateOrder', {
orderUuid: this.$route.query.action,
posUuid: this.currentPoint.uuid,
@ -267,7 +232,7 @@ export default {
findProduct({
searchValue: searchProduct,
priceListUuid: this.priceListUuid
priceListUuid: this.currentPointOfSales.priceList.uuid
})
.then(productPrice => {
this.product = productPrice.product
@ -308,7 +273,7 @@ export default {
}
const orderUuid = this.$route.query.action
if (this.isEmptyValue(orderUuid)) {
const posUuid = this.currentPoint.uuid
const posUuid = this.currentPointOfSales.uuid
let customerUuid = this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
columnName: 'C_BPartner_ID_UUID'
@ -318,14 +283,14 @@ export default {
columnName: 'C_BPartner_ID'
})
if (this.isEmptyValue(customerUuid) || id === 1000006) {
customerUuid = this.currentPoint.templateBusinessPartner.uuid
customerUuid = this.currentPointOfSales.templateBusinessPartner.uuid
}
// user session
// alert(name)
this.$store.dispatch('createOrder', {
posUuid,
customerUuid,
salesRepresentativeUuid: this.currentPoint.templateBusinessPartner.uuid
salesRepresentativeUuid: this.currentPointOfSales.templateBusinessPartner.uuid
})
.then(response => {
// this.order = response
@ -356,7 +321,7 @@ export default {
if (this.isEmptyValue(orderUuid)) {
orderUuid = this.$route.query.action
// if (this.isEmptyValue(orderUuid)) {
// orderUuid = this.$store.getters.getOrder.uuid // this.currentOrder.uuid
// orderUuid = this.$store.getters.currentOrder.uuid // this.currentOrder.uuid
// }
}
if (!this.isEmptyValue(orderUuid)) {
@ -389,7 +354,7 @@ export default {
// this.order = orderToPush
},
getOrderTax(currency) {
return this.formatPrice(this.getOrder.grandTotal - this.getOrder.totalLines, currency)
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
},
subscribeChanges() {
return this.$store.subscribe((mutation, state) => {
@ -433,12 +398,6 @@ export default {
}
})
},
mas() {
this.$refs.linesTable.setCurrentRow(this.listOrderLine[1])
},
menos() {
this.$refs.linesTable.setCurrentRow(this.listOrderLine[0])
},
shortcutKeyMethod(event) {
switch (event.srcKey) {
// case 'options':
@ -489,6 +448,62 @@ export default {
})
break
}
},
newOrder() {
this.$router.push({
params: {
...this.$route.params
},
query: {
pos: this.currentPointOfSales.id
}
}).catch(() => {
}).finally(() => {
this.$store.commit('setListPayments', [])
const { templateBusinessPartner } = this.currentPointOfSales
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.commit('setShowPOSCollection', false)
this.$store.dispatch('listOrderLine', [])
})
},
changePos(posElement) {
this.$store.dispatch('setCurrentPOS', posElement)
this.newOrder()
}
}
}

View File

@ -0,0 +1,110 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* PointOfSales Getters
*/
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
const withoutResponse = {
isLoaded: false,
isReload: true,
recordCount: 0,
nextPageToken: undefined
}
function isProcessed(order) {
if (!isEmptyValue(order.documentStatus.value) &&
(order.documentStatus.value === 'CO' ||
order.documentStatus.value === 'VO' ||
order.documentStatus.value === 'IP' ||
order.documentStatus.value === 'IP')) {
return true
}
return false
}
export default {
/**
* Point of Sale Attributes
* List Point Of Sales
* Current Point Of Sales
* Current Order
* List Order Lines
* List Payment Order
* Lst Order
*/
posAttributes: (state, getters) => {
return {
listPointOfSales: state.listPointOfSales,
currentPointOfSales: {
...state.currentPointOfSales,
listOrder: state.listOrder,
currentOrder: {
...state.order,
lineOrder: state.listOrderLine,
listPayments: state.listPayments,
isProcessed: isProcessed(state.order)
}
}
}
},
/**
* Product Price Getters
* List Product
* Search Product
*/
getProductPrice: (state) => {
if (isEmptyValue(state.productPrice) || !state.productPrice.isLoaded) {
return {
...withoutResponse,
productPricesList: []
}
}
return state.productPrice
},
getSearchProduct: (state) => {
return state.searchProduct
},
/**
* visibility of point of sale panels
* Show Panel Options the Point Of Sales
* Show Panel Key Layout the Point Of Sales
* Show Panel Collection the Point Of Sales
*/
getIsShowPOSOptions: (state) => {
return state.showPOSOptions
},
getShowPOSKeyLayout: (state) => {
return state.showPOSKeyLayout
},
getShowCollectionPos: (state) => {
return state.showPOSCollection
},
/**
* get Key Layout
* List Catalog
*/
getKeyLayout: (state) => {
if (isEmptyValue(state.keyLayout)) {
return {
...withoutResponse,
uuid: undefined,
ordersList: []
}
}
return state.keyLayout
}
}

View File

@ -1,172 +0,0 @@
import Vue from 'vue'
import router from '@/router'
import {
requestListPointOfSales
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
const withoutResponse = {
isLoaded: false,
isReload: true,
recordCount: 0,
currentPOS: {},
nextPageToken: undefined
}
const pointOfSales = {
state: {
showPOSOptions: false,
showPOSKeyLayout: false,
showPOSCollection: false,
pointOfSales: {
...withoutResponse
}
},
mutations: {
resetStatePointOfSales(state) {
state = {}
},
setPontOfSales(state, pos) {
state.pointOfSales = pos
},
setCurrentPOS(state, pos) {
Vue.set(state.pointOfSales, 'currentPOS', pos)
},
setShowPOSOptions(state, isShowedOptions) {
state.showPOSOptions = isShowedOptions
},
setShowPOSKeyLayout(state, isShowedKeyLayout) {
state.showPOSKeyLayout = isShowedKeyLayout
},
setShowPOSCollection(state, isShowedCollection) {
state.showPOSCollection = isShowedCollection
}
},
actions: {
/**
* List point of sales terminal
* @param {number} posToSet id to set
*/
listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) {
const userUuid = getters['user/getUserUuid']
requestListPointOfSales({
userUuid
})
.then(response => {
// TODO: Add organization
commit('setPontOfSales', {
...response,
userUuid
})
const posList = response.sellingPointsList
const getterPos = getters.getPointOfSalesUuid
let pos
if (!isEmptyValue(posList)) {
if (!isEmptyValue(getterPos)) {
pos = posList.find(itemPOS => itemPOS.uuid === getterPos)
}
// match with route.query.pos
if (isEmptyValue(pos) && !isEmptyValue(posToSet)) {
pos = posList.find(itemPOS => itemPOS.id === posToSet)
}
// set first element in array list
if (isEmptyValue(pos)) {
pos = posList[0]
}
}
if (isEmptyValue(pos)) {
pos = {
uuid: undefined
}
}
if (pos.uuid !== getterPos) {
dispatch('setCurrentPOS', pos)
}
})
.catch(error => {
console.warn(`listPointOfSalesFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
},
setCurrentPOS({ commit, dispatch }, posToSet) {
commit('setCurrentPOS', posToSet)
const oldRoute = router.app._route
router.push({
name: oldRoute.name,
params: {
...oldRoute.params
},
query: {
...oldRoute.query,
pos: posToSet.id
}
}, () => {})
commit('setIsReloadKeyLayout')
commit('setIsReloadProductPrice')
commit('setIsReloadListOrders')
commit('setShowPOSKeyLayout', false)
dispatch('deleteAllCollectBox')
}
},
getters: {
getPointOfSales: (state) => {
if (isEmptyValue(state.pointOfSales)) {
return {
...withoutResponse,
sellingPointsList: []
}
}
return state.pointOfSales
},
// current pos uuid
getPointOfSalesUuid: (state, getters) => {
const currentPOS = getters.getCurrentPOS
if (isEmptyValue(currentPOS)) {
return undefined
}
return currentPOS.uuid
},
// current pos info
getCurrentPOS: (state, getters) => {
const userUuid = getters['user/getUserUuid']
let currentPOS
const sellingPointsList = state.pointOfSales.sellingPointsList
if (!isEmptyValue(sellingPointsList) && (sellingPointsList.length > 1)) {
currentPOS = state.pointOfSales.sellingPointsList.find(elem => elem.salesRepresentative.uuid === userUuid)
}
if (!isEmptyValue(currentPOS)) {
return currentPOS
}
if (isEmptyValue(state.pointOfSales.currentPOS) && (!isEmptyValue(sellingPointsList))) {
return state.pointOfSales.sellingPointsList[0]
}
if (state.pointOfSales.currentPOS) {
return state.pointOfSales.currentPOS
}
return undefined
},
getSellingPointsList: (state, getters) => {
return getters.getPointOfSales.sellingPointsList
},
getIsShowPOSOptions: (state) => {
return state.showPOSOptions
},
getShowPOSKeyLayout: (state) => {
return state.showPOSKeyLayout
},
getShowCollectionPos: (state) => {
return state.showPOSCollection
}
}
}
export default pointOfSales

View File

@ -1,82 +0,0 @@
import Vue from 'vue'
import {
getKeyLayout
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
const withoutResponse = {
isLoaded: false,
isReload: true,
recordCount: 0,
nextPageToken: undefined
}
const keyLayout = {
state: {
keyLayout: {}
},
mutations: {
setKeyLayout(state, keyLayout) {
Vue.set(state, 'keyLayout', keyLayout)
},
setIsReloadKeyLayout(state) {
Vue.set(state.keyLayout, 'isReload', true)
Vue.set(state.keyLayout, 'isLoaded', false)
}
},
actions: {
getKeyLayoutFromServer({ commit, getters }, keyLayoutUuid) {
if (isEmptyValue(keyLayoutUuid)) {
keyLayoutUuid = getters.getKeyLayoutUuidWithPOS
}
if (isEmptyValue(keyLayoutUuid)) {
console.info('not load key layout')
return
}
getKeyLayout({
keyLayoutUuid
})
.then(responseKeyLayout => {
commit('setKeyLayout', {
...responseKeyLayout,
isLoaded: true,
isReload: false
// token,
// pageNumber
})
})
.catch(error => {
console.warn(`getKeyLayoutFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
}
},
getters: {
// current pos uuid
getKeyLayoutUuidWithPOS: (state, getters) => {
const currentPOS = getters.getCurrentPOS
if (isEmptyValue(currentPOS)) {
return undefined
}
return currentPOS.keyLayoutUuid
},
getKeyLayout: (state) => {
if (isEmptyValue(state.keyLayout)) {
return {
...withoutResponse,
uuid: undefined,
ordersList: []
}
}
return state.keyLayout
}
}
}
export default keyLayout

View File

@ -0,0 +1,55 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import {
getKeyLayout
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
/**
* keyLayout Actions
*/
export default {
getKeyLayoutFromServer({ commit, rootGetters }, keyLayoutUuid) {
if (isEmptyValue(keyLayoutUuid)) {
keyLayoutUuid = rootGetters.posAttributes.currentPointOfSales.keyLayoutUuid
}
if (isEmptyValue(keyLayoutUuid)) {
console.info('not load key layout')
return
}
getKeyLayout({
keyLayoutUuid
})
.then(responseKeyLayout => {
commit('setKeyLayout', {
...responseKeyLayout,
isLoaded: true,
isReload: false
})
})
.catch(error => {
console.warn(`getKeyLayoutFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
}
}

View File

@ -0,0 +1,30 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import state from './state.js'
import mutations from './mutations.js'
import actions from './actions.js'
/**
* keyLayout Vuex Module
*/
const keyLayout = {
state,
mutations,
actions
}
export default keyLayout

View File

@ -0,0 +1,30 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* KeyLayout Mutations
*/
import Vue from 'vue'
export default {
setKeyLayout(state, keyLayout) {
Vue.set(state, 'keyLayout', keyLayout)
},
setIsReloadKeyLayout(state) {
Vue.set(state.keyLayout, 'isReload', true)
Vue.set(state.keyLayout, 'isLoaded', false)
}
}

View File

@ -0,0 +1,22 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* keyLayout State
*/
export default {
keyLayout: {}
}

View File

@ -1,220 +0,0 @@
import Vue from 'vue'
import {
getProductPriceList
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue, extractPagingToken } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
import language from '@/lang'
const withoutResponse = {
isLoaded: false,
isReload: true,
recordCount: 0,
nextPageToken: undefined
}
const listProductPrice = {
state: {
productPrice: {
...withoutResponse,
isShowPopoverField: false, // with field
isShowPopoverMenu: false // with menu
},
searchProduct: ''
},
mutations: {
setListProductPrice(state, productsPrices) {
state.productPrice = {
...state.productPrice,
...productsPrices
}
},
setProductPicePageNumber(state, pageNumber) {
state.productPrice.pageNumber = pageNumber
},
showListProductPrice(state, payload) {
Vue.set(state.productPrice, payload.attribute, payload.isShowed)
},
setIsReloadProductPrice(state) {
Vue.set(state.productPrice, 'isReload', true)
Vue.set(state.productPrice, 'isLoaded', false)
},
updtaeSearchProduct(state, searchProduct) {
state.searchProduct = searchProduct
}
},
actions: {
setProductPicePageNumber({ commit }, pageNumber) {
commit('setProductPicePageNumber', pageNumber)
commit('setIsReloadProductPrice')
// Not reload, watch in component to reload
// dispatch('listProductPriceFromServer', {})
},
listProductPriceFromServer({ state, commit, rootGetters }, {
containerUuid = 'Products-Price-List',
pageNumber, // 1
searchValue
}) {
const posUuid = rootGetters.getPointOfSalesUuid
if (isEmptyValue(posUuid)) {
const message = language.t('notifications.errorPointOfSale')
showMessage({
type: 'info',
message
})
console.warn(message)
return
}
commit('setIsReloadProductPrice')
let pageToken, token
if (isEmptyValue(pageNumber)) {
pageNumber = state.productPrice.pageNumber
if (isEmptyValue(pageNumber)) {
pageNumber = 1
}
token = state.productPrice.token
if (!isEmptyValue(token)) {
pageToken = token + '-' + pageNumber
}
}
const { priceList, templateBusinessPartner } = rootGetters.getCurrentPOS
const { uuid: businessPartnerUuid } = templateBusinessPartner
const { uuid: priceListUuid } = priceList
const { uuid: warehouseUuid } = rootGetters['user/getWarehouse']
if (isEmptyValue(searchValue)) {
searchValue = rootGetters.getValueOfField({
containerUuid,
columnName: 'ProductValue'
})
}
return new Promise(resolve => {
getProductPriceList({
searchValue,
priceListUuid,
businessPartnerUuid,
warehouseUuid,
pageToken
}).then(responseProductPrice => {
if (isEmptyValue(token) || isEmptyValue(pageToken)) {
token = extractPagingToken(responseProductPrice.nextPageToken)
}
commit('setListProductPrice', {
...responseProductPrice,
isLoaded: true,
isReload: false,
businessPartnerUuid,
warehouseUuid,
token,
pageNumber
})
resolve(responseProductPrice)
}).catch(error => {
console.warn(`getKeyLayoutFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
})
},
listProductPriceFromServerProductInfo({ state, commit, rootGetters }, {
containerUuid = 'Products-Price-List-ProductInfo',
pageNumber, // 1
searchValue
}) {
const posUuid = rootGetters.getPointOfSalesUuid
if (isEmptyValue(posUuid)) {
const message = 'Sin punto de venta seleccionado'
showMessage({
type: 'info',
message
})
console.warn(message)
return
}
commit('setIsReloadProductPrice')
let pageToken, token
if (isEmptyValue(pageNumber)) {
pageNumber = state.productPrice.pageNumber
if (isEmptyValue(pageNumber)) {
pageNumber = 1
}
token = state.productPrice.token
if (!isEmptyValue(token)) {
pageToken = token + '-' + pageNumber
}
}
const { priceList, templateBusinessPartner } = rootGetters.getCurrentPOS
const { uuid: businessPartnerUuid } = templateBusinessPartner
const { uuid: priceListUuid } = priceList
const { uuid: warehouseUuid } = rootGetters['user/getWarehouse']
if (isEmptyValue(searchValue)) {
searchValue = rootGetters.getValueOfField({
containerUuid,
columnName: 'ProductValue'
})
}
return new Promise(resolve => {
getProductPriceList({
searchValue,
priceListUuid,
businessPartnerUuid,
warehouseUuid,
pageToken
}).then(responseProductPrice => {
if (isEmptyValue(token) || isEmptyValue(pageToken)) {
token = extractPagingToken(responseProductPrice.nextPageToken)
}
commit('setListProductPrice', {
...responseProductPrice,
isLoaded: true,
isReload: false,
businessPartnerUuid,
warehouseUuid,
token,
pageNumber
})
resolve(responseProductPrice)
}).catch(error => {
console.warn(`getKeyLayoutFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
})
},
updateSearch({ commit }, newValue) {
commit('updtaeSearchProduct', newValue)
}
},
getters: {
getProductPrice: (state) => {
if (isEmptyValue(state.productPrice) || !state.productPrice.isLoaded) {
return {
...withoutResponse,
productPricesList: []
}
}
return state.productPrice
},
getSearchProduct: (state) => {
return state.searchProduct
}
}
}
export default listProductPrice

View File

@ -1,3 +1,19 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import {
requestCreateOrder,
requestGetOrder,
@ -10,7 +26,6 @@ import { showMessage } from '@/utils/ADempiere/notification.js'
/**
* Order Actions
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
export default {
/**
@ -117,7 +132,7 @@ export default {
*/
reloadOrder({ commit, dispatch, rootGetters }, { orderUuid }) {
if (isEmptyValue(orderUuid)) {
orderUuid = rootGetters.getOrder.uuid // this.currentOrder.uuid
orderUuid = rootGetters.posAttributes.currentPointOfSales.currentOrder.uuid // this.currentOrder.uuid
}
if (!isEmptyValue(orderUuid)) {
requestGetOrder(orderUuid)
@ -188,7 +203,7 @@ export default {
salesRepresentativeUuid
}) {
if (isEmptyValue(posUuid)) {
posUuid = getters.getPointOfSalesUuid
posUuid = getters.posAttributes.currentPointOfSales.uuid
}
let { pageNumber, token } = state.listOrder
@ -237,7 +252,8 @@ export default {
// })
})
},
setOrder({ commit }, order) {
setOrder({ commit, dispatch }, order) {
dispatch('listOrderLinesFromServer', order.uuid)
commit('setOrder', order)
},
currentOrder({ commit }, findOrder) {

View File

@ -1,48 +0,0 @@
/**
* Order Getters
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
const withoutResponse = {
isLoaded: false,
isReload: true,
recordCount: 0,
nextPageToken: undefined
}
export default {
getOrder: (state) => {
return state.order
},
getPos: (state, getters) => {
const OrderPos = {
currentOrder: state.order,
listOrder: getters.getListOrder,
lineOrder: getters.getListOrderLine,
listPayments: getters.getListPayments,
isProcessed: getters.getIsProcessed
}
return OrderPos
},
getIsProcessed: (state) => {
const order = state.order
if (!isEmptyValue(order.documentStatus.value) &&
(order.documentStatus.value === 'CO' || order.documentStatus.value === 'VO' || order.documentStatus.value === 'IP' || order.documentStatus.value === 'IP')) {
return true
}
return false
},
getListOrder: (state) => {
if (isEmptyValue(state.listOrder)) {
return {
...withoutResponse,
ordersList: []
}
}
return state.listOrder
},
getFindOrder: (state) => {
return state.findOrder
}
}

View File

@ -1,8 +1,22 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import state from './state.js'
import mutations from './mutations.js'
import actions from './actions.js'
import getters from './getters.js'
/**
* Order Vuex Module
@ -11,13 +25,11 @@ import getters from './getters.js'
* List Order
* Delete Order
* Reload Order
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
const ordes = {
state,
mutations,
actions,
getters
actions
}
export default ordes

View File

@ -1,7 +1,21 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Order Mutations
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
export default {
setOrder(state, order) {

View File

@ -1,6 +1,21 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Order State
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
const withoutResponse = {
isLoaded: false,

View File

@ -0,0 +1,88 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import {
requestListOrderLines
} from '@/api/ADempiere/form/point-of-sales.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
/**
* Order Line Actions
*/
export default {
listOrderLine({ commit }, params) {
commit('setListOrderLine', params)
},
listOrderLinesFromServer({ commit }, orderUuid) {
requestListOrderLines({
orderUuid
})
.then(response => {
const line = response.orderLineList.map(lineItem => {
return {
...lineItem,
quantityOrdered: lineItem.quantity,
priceActual: lineItem.price,
discount: lineItem.discountRate,
product: {
...lineItem.product,
priceStandard: lineItem.price,
help: lineItem.help
},
taxIndicator: lineItem.taxRate.taxIndicator,
grandTotal: lineItem.lineNetAmount
}
})
commit('setListOrderLine', line)
})
.catch(error => {
console.warn(`listOrderLinesFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
},
updateOrderLines({ commit, rootGetters }, params) {
// const line = rootGetters.getListOrderLine
const line = rootGetters.posAttributes.currentPointOfSales.currentOrder.lineOrder
const found = line.map(element => {
if (element.uuid === params.uuid) {
return {
...element,
uuid: params.uuid,
lineDescription: params.lineDescription,
quantityOrdered: params.quantity,
priceActual: params.price,
discount: params.discountRate,
product: {
description: params.product.description,
priceStandard: params.price,
help: params.help,
name: params.product.name,
value: params.product.value
},
taxIndicator: params.taxRate.taxIndicator,
grandTotal: params.lineNetAmount
}
}
return {
...element
}
})
commit('setListOrderLine', found)
}
}

View File

@ -0,0 +1,34 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import state from './state.js'
import mutations from './mutations.js'
import actions from './actions.js'
/**
* Order Line Vuex Module
* Create Line
* Update Line
* Delete Line
* List Line
*/
const orderLine = {
state,
mutations,
actions
}
export default orderLine

View File

@ -0,0 +1,25 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Order Line Mutations
*/
export default {
setListOrderLine(state, listOrderLine) {
state.listOrderLine = listOrderLine
}
}

View File

@ -0,0 +1,23 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Order Line State
*/
export default {
listOrderLine: []
}

View File

@ -1,86 +0,0 @@
import {
requestListOrderLines
} from '@/api/ADempiere/form/point-of-sales.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
const orderLine = {
state: {
listOrderLine: []
},
mutations: {
setListOrderLine(state, listOrderLine) {
state.listOrderLine = listOrderLine
}
},
actions: {
listOrderLine({ commit }, params) {
commit('setListOrderLine', params)
},
listOrderLinesFromServer({ commit }, orderUuid) {
requestListOrderLines({
orderUuid
})
.then(response => {
const line = response.orderLineList.map(lineItem => {
return {
...lineItem,
quantityOrdered: lineItem.quantity,
priceActual: lineItem.price,
discount: lineItem.discountRate,
product: {
...lineItem.product,
priceStandard: lineItem.price,
help: lineItem.help
},
taxIndicator: lineItem.taxRate.taxIndicator,
grandTotal: lineItem.lineNetAmount
}
})
commit('setListOrderLine', line)
})
.catch(error => {
console.warn(`listOrderLinesFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
},
updateOrderLines({ commit, rootGetters }, params) {
const line = rootGetters.getListOrderLine
const found = line.map(element => {
if (element.uuid === params.uuid) {
return {
...element,
uuid: params.uuid,
lineDescription: params.lineDescription,
quantityOrdered: params.quantity,
priceActual: params.price,
discount: params.discountRate,
product: {
description: params.product.description,
priceStandard: params.price,
help: params.help,
name: params.product.name,
value: params.product.value
},
taxIndicator: params.taxRate.taxIndicator,
grandTotal: params.lineNetAmount
}
}
return {
...element
}
})
commit('setListOrderLine', found)
}
},
getters: {
getListOrderLine: (state) => {
return state.listOrderLine
}
}
}
export default orderLine

View File

@ -1,3 +1,19 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import {
requestGetConversionRate,
createPayment,
@ -10,7 +26,6 @@ import { showMessage } from '@/utils/ADempiere/notification.js'
/**
* Payments Actions
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
export default {
/**

View File

@ -1,6 +1,21 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Payments Getters
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
export default {

View File

@ -1,3 +1,18 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import state from './state.js'
import mutations from './mutations.js'
@ -6,7 +21,10 @@ import getters from './getters.js'
/**
* Payments Vuex Module
* @author Elsio Sanchez <elsiosanches@gmail.com>
* Create Payment
* Update Payment
* Delete Payment
* List Payment
*/
const collection = {
state,

View File

@ -1,7 +1,21 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Payments Mutations
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
export default {
addPaymentBox(state, paymentBox) {

View File

@ -1,6 +1,21 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Payment State
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
export default {
paymentBox: [],

View File

@ -0,0 +1,89 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import router from '@/router'
import {
requestListPointOfSales
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
/**
* Pos Actions
*/
export default {
/**
* List point of sales terminal
* @param {number} posToSet id to set
*/
listPointOfSalesFromServer({ commit, getters, dispatch }, posToSet = null) {
const userUuid = getters['user/getUserUuid']
let pos, listPos
requestListPointOfSales({
userUuid
})
.then(response => {
listPos = response.sellingPointsList
if (!isEmptyValue(posToSet)) {
pos = listPos.find(itemPOS => itemPOS.id === parseInt(posToSet))
}
if (isEmptyValue(pos) && isEmptyValue(posToSet)) {
pos = listPos.find(itemPOS => itemPOS.salesRepresentative.uuid === userUuid)
}
if (isEmptyValue(pos)) {
pos = listPos[0]
}
commit('listPointOfSales', listPos)
dispatch('setCurrentPOS', pos)
})
.catch(error => {
console.warn(`listPointOfSalesFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
},
setCurrentPOS({ commit, dispatch }, posToSet) {
commit('currentPointOfSales', posToSet)
const currentPOS = posToSet
const oldRoute = router.app._route
router.push({
name: oldRoute.name,
params: {
...oldRoute.params
},
query: {
...oldRoute.query,
pos: posToSet.id
}
}, () => {})
commit('setIsReloadKeyLayout')
commit('setIsReloadProductPrice')
commit('setIsReloadListOrders')
commit('setShowPOSKeyLayout', false)
// Maintain Order and Product List
dispatch('listOrdersFromServer', {
posUuid: currentPOS.uuid
})
dispatch('listProductPriceFromServer', {
currentPOS
})
}
}

View File

@ -0,0 +1,98 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Get Point Of Sales Vuex Module Store Data
* Search Point of Sale list
* Current Point of Sale
*/
import state from './state.js'
import mutations from './mutations.js'
import actions from './actions.js'
import getters from '../getters/index.js'
/**
* Get Order Vuex Module Store Data
* Create Order
* Update Order
* List Order
* Delete Order
* Reload Order
*/
import stateOrder from '../order/state.js'
import mutationsOrder from '../order/mutations.js'
/**
* Get Order Line Vuex Module Store Data
* Create Line
* Update Line
* Delete Line
* List Line
*/
import stateOrderLine from '../orderLine/state.js'
import mutationsOrderLine from '../orderLine/mutations.js'
/**
* Get Payments Vuex Module Store Data
* Create Payment
* Update Payment
* Delete Payment
* List Payment
*/
import statePayments from '../payments/state.js'
import mutationsPayments from '../payments/mutations.js'
/**
* Get Product Price Vuex Module Store Data
* Product List
* Search Product
*/
import stateProductPrice from '../productPrice/state.js'
import mutationsProductPrice from '../productPrice/mutations.js'
/**
* Get keyLayout Vuex Module Store Data
* List Catalog
*/
import stateKeyLayout from '../keyLayout/state.js'
import mutationsKeyLayout from '../keyLayout/mutations.js'
const pointOfSales = {
state: {
...state,
...stateOrder,
...stateOrderLine,
...statePayments,
...stateProductPrice,
...stateKeyLayout
},
mutations: {
...mutations,
...mutationsOrder,
...mutationsOrderLine,
...mutationsPayments,
...mutationsProductPrice,
...mutationsKeyLayout
},
actions,
getters
}
export default pointOfSales

View File

@ -0,0 +1,45 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import Vue from 'vue'
/**
* Pos Mutations
* @author Elsio Sanchez <elsiosanches@gmail.com>
*/
export default {
setPontOfSales(state, pos) {
state.pointOfSales = pos
},
setCurrentPOS(state, pos) {
Vue.set(state.pointOfSales, 'currentPOS', pos)
},
listPointOfSales(state, listPointOfSales) {
state.listPointOfSales = listPointOfSales
},
currentPointOfSales(state, currentPointOfSales) {
state.currentPointOfSales = currentPointOfSales
},
setShowPOSOptions(state, isShowedOptions) {
state.showPOSOptions = isShowedOptions
},
setShowPOSKeyLayout(state, isShowedKeyLayout) {
state.showPOSKeyLayout = isShowedKeyLayout
},
setShowPOSCollection(state, isShowedCollection) {
state.showPOSCollection = isShowedCollection
}
}

View File

@ -0,0 +1,35 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Pos State
*/
const withoutResponse = {
isLoaded: false,
isReload: true,
recordCount: 0,
nextPageToken: undefined
}
export default {
pointOfSales: {
...withoutResponse
},
listPointOfSales: {},
currentPointOfSales: {},
showPOSOptions: false,
showPOSKeyLayout: false,
showPOSCollection: false
}

View File

@ -0,0 +1,180 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import {
getProductPriceList
} from '@/api/ADempiere/form/point-of-sales.js'
import { isEmptyValue, extractPagingToken } from '@/utils/ADempiere/valueUtils.js'
import { showMessage } from '@/utils/ADempiere/notification.js'
import language from '@/lang'
/**
* Product Price Actions
*/
export default {
setProductPicePageNumber({ commit }, pageNumber) {
commit('setProductPicePageNumber', pageNumber)
commit('setIsReloadProductPrice')
},
listProductPriceFromServer({ state, commit, rootGetters }, {
containerUuid = 'Products-Price-List',
pageNumber, // 1
searchValue,
currentPOS
}) {
const posUuid = isEmptyValue(currentPOS) ? rootGetters.posAttributes.currentPointOfSales.uuid : currentPOS.uuid
if (isEmptyValue(posUuid)) {
const message = language.t('notifications.errorPointOfSale')
showMessage({
type: 'info',
message
})
console.warn(message)
return
}
commit('setIsReloadProductPrice')
let pageToken, token
if (isEmptyValue(pageNumber)) {
pageNumber = state.productPrice.pageNumber
if (isEmptyValue(pageNumber)) {
pageNumber = 1
}
token = state.productPrice.token
if (!isEmptyValue(token)) {
pageToken = token + '-' + pageNumber
}
}
const { priceList, templateBusinessPartner } = rootGetters.posAttributes.currentPointOfSales
const { uuid: businessPartnerUuid } = templateBusinessPartner
const { uuid: priceListUuid } = priceList
const { uuid: warehouseUuid } = rootGetters['user/getWarehouse']
if (isEmptyValue(searchValue)) {
searchValue = rootGetters.getValueOfField({
containerUuid,
columnName: 'ProductValue'
})
}
return new Promise(resolve => {
getProductPriceList({
searchValue,
priceListUuid,
businessPartnerUuid,
warehouseUuid,
pageToken
}).then(responseProductPrice => {
if (isEmptyValue(token) || isEmptyValue(pageToken)) {
token = extractPagingToken(responseProductPrice.nextPageToken)
}
commit('setListProductPrice', {
...responseProductPrice,
isLoaded: true,
isReload: false,
businessPartnerUuid,
warehouseUuid,
token,
pageNumber
})
resolve(responseProductPrice)
}).catch(error => {
console.warn(`getKeyLayoutFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
})
},
listProductPriceFromServerProductInfo({ state, commit, rootGetters }, {
containerUuid = 'Products-Price-List-ProductInfo',
pageNumber, // 1
searchValue
}) {
const posUuid = rootGetters.posAttributes.currentPointOfSales.uuid
if (isEmptyValue(posUuid)) {
const message = 'Sin punto de venta seleccionado'
showMessage({
type: 'info',
message
})
console.warn(message)
return
}
commit('setIsReloadProductPrice')
let pageToken, token
if (isEmptyValue(pageNumber)) {
pageNumber = state.productPrice.pageNumber
if (isEmptyValue(pageNumber)) {
pageNumber = 1
}
token = state.productPrice.token
if (!isEmptyValue(token)) {
pageToken = token + '-' + pageNumber
}
}
const { priceList, templateBusinessPartner } = rootGetters.posAttributes.currentPointOfSales
const { uuid: businessPartnerUuid } = templateBusinessPartner
const { uuid: priceListUuid } = priceList
const { uuid: warehouseUuid } = rootGetters['user/getWarehouse']
if (isEmptyValue(searchValue)) {
searchValue = rootGetters.getValueOfField({
containerUuid,
columnName: 'ProductValue'
})
}
return new Promise(resolve => {
getProductPriceList({
searchValue,
priceListUuid,
businessPartnerUuid,
warehouseUuid,
pageToken
}).then(responseProductPrice => {
if (isEmptyValue(token) || isEmptyValue(pageToken)) {
token = extractPagingToken(responseProductPrice.nextPageToken)
}
commit('setListProductPrice', {
...responseProductPrice,
isLoaded: true,
isReload: false,
businessPartnerUuid,
warehouseUuid,
token,
pageNumber
})
resolve(responseProductPrice)
}).catch(error => {
console.warn(`getKeyLayoutFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
})
},
updateSearch({ commit }, newValue) {
commit('updtaeSearchProduct', newValue)
}
}

View File

@ -0,0 +1,32 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import state from './state.js'
import mutations from './mutations.js'
import actions from './actions.js'
/**
* Product Price Vuex Module
* Product List
* Search Product
*/
const listProductPrice = {
state,
mutations,
actions
}
export default listProductPrice

View File

@ -0,0 +1,42 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Product Price Mutations
*/
import Vue from 'vue'
export default {
setListProductPrice(state, productsPrices) {
state.productPrice = {
...state.productPrice,
...productsPrices
}
},
setProductPicePageNumber(state, pageNumber) {
state.productPrice.pageNumber = pageNumber
},
showListProductPrice(state, payload) {
Vue.set(state.productPrice, payload.attribute, payload.isShowed)
},
setIsReloadProductPrice(state) {
Vue.set(state.productPrice, 'isReload', true)
Vue.set(state.productPrice, 'isLoaded', false)
},
updtaeSearchProduct(state, searchProduct) {
state.searchProduct = searchProduct
}
}

View File

@ -0,0 +1,33 @@
// ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
// Copyright (C) 2017-Present E.R.P. Consultores y Asociados, C.A.
// Contributor(s): Elsio Sanchez esanchez@erpya.com www.erpya.com
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/**
* Product Price State
*/
const withoutResponse = {
isLoaded: false,
isReload: true,
recordCount: 0,
nextPageToken: undefined
}
export default {
productPrice: {
...withoutResponse,
isShowPopoverField: false, // with field
isShowPopoverMenu: false // with menu
},
searchProduct: ''
}