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

validate terminal configurator (#1082)

* Add validation for the pin according to the configuration of the terminal of the point of sale

* validate advisor options

* validate terminal configurator

* add pin to Return Order

* remove console

Co-authored-by: elsiosanchez <elsiossanches@gmail.com>
This commit is contained in:
Elsio Sanchez 2021-08-19 08:00:17 -04:00 committed by GitHub
parent 0bffaa6699
commit 6f20050745
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 345 additions and 109 deletions

View File

@ -906,7 +906,7 @@ export function listCurrencies({
* Tender Type
* @param {string} posUuidd - POS UUID reference
*/
export function listTenderType({
export function listTenderTypes({
posUuid
}) {
return request({

View File

@ -91,6 +91,26 @@ export default {
unsubscribe: () => {}
}
},
computed: {
adviserPin() {
const value = this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
columnName: 'Value'
})
const name = this.$store.getters.getValueOfField({
containerUuid: this.containerUuid,
columnName: 'Name'
})
const isSeller = this.$store.getters.posAttributes.currentPointOfSales.isAisleSeller
if (!this.isEmptyValue(value) && !this.isEmptyValue(name) && isSeller) {
return isSeller
}
return false
},
currentPointOfSales() {
return this.$store.getters.posAttributes.currentPointOfSales
}
},
watch: {
showField(value) {
if (value) {
@ -123,7 +143,7 @@ export default {
containerUuid: this.containerUuid,
formatReturn: 'name'
})
if (this.isEmptyValue(emptyMandatoryFields)) {
if (this.isEmptyValue(emptyMandatoryFields) || this.adviserPin) {
this.isLoadingRecord = true
createCustomer(values)
.then(responseBPartner => {

View File

@ -199,6 +199,8 @@
</b>
</p>
<p v-if="!isEmptyValue(currentPointOfSales.displayCurrency)" class="total"> <b> {{ $t('form.pos.collect.convertedAmount') }}: </b> <b style="float: right;">{{ formatPrice(currentOrder.grandTotal / totalAmountConverted, currentPointOfSales.displayCurrency.iso_code) }}</b> </p>
<p class="total">
{{ $t('form.pos.collect.pending') }}:
<b style="float: right;">
@ -477,6 +479,13 @@ export default {
}
return true
},
isPosRequiredPin() {
const pos = this.$store.getters.posAttributes.currentPointOfSales
if (!this.isEmptyValue(pos.isPosRequiredPin)) {
return pos.isPosRequiredPin
}
return false
},
validPay() {
const containerUuid = this.containerUuid
// filter by visible fields
@ -582,6 +591,21 @@ export default {
},
overUnderPayment() {
return this.$store.state['pointOfSales/payments/index'].dialogoInvoce.success
},
totalAmountConverted() {
const conversionsList = this.$store.state['pointOfSales/point/index'].conversionsList
if (this.isEmptyValue(conversionsList) && !this.isEmptyValue(this.currentPointOfSales.conversionTypeUuid)) {
return 1
}
const converted = conversionsList.find(converted => {
if (converted.conversionTypeUuid === this.currentPointOfSales.conversionTypeUuid) {
return converted
}
})
if (!this.isEmptyValue(converted)) {
return converted.divideRate
}
return 1
}
},
watch: {
@ -900,6 +924,17 @@ export default {
if (this.pay > this.currentOrder.grandTotal) {
this.$store.commit('dialogoInvoce', { show: true, type: 1 })
} else if (this.pay < this.currentOrder.grandTotal) {
if (this.isPosRequiredPin) {
const attributePin = {
...payment,
action: 'openBalanceInvoice',
type: 'actionPos',
label: this.$t('form.pos.pinMessage.invoiceOpen')
}
this.visible = true
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
return
}
this.$store.commit('dialogoInvoce', { show: true, type: 2 })
} else {
this.completePreparedOrder(payment)

View File

@ -21,7 +21,7 @@
:title="$t('form.pos.collect.overdrawnInvoice.title')"
:visible.sync="showDialogo"
:before-close="close"
width="70%"
width="80%"
@close="close"
>
<div v-if="caseOrder === 1">
@ -61,6 +61,9 @@
<el-card v-if="option === 3" class="box-card">
<div slot="header" class="clearfix">
<span>{{ $t('form.pos.collect.overdrawnInvoice.above') }}</span>
<span style="float: right">
<b>Limite Diario USD 20,00$ = Bs.S 85.000.000,00 </b> | <b>Disponible Bs.S 85.000.000,00 </b>
</span>
</div>
<div class="text item">
<el-form
@ -78,6 +81,22 @@
:metadata-field="field"
/>
</el-col>
<el-col :span="8">
<el-form-item label="Tipo de pago">
<el-select
v-model="currentPaymentType"
style="width: -webkit-fill-available;"
@change="changePaymentType"
>
<el-option
v-for="item in paymentTypeList"
:key="item.uuid"
:label="item.name"
:value="item.key"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item v-if="displayeCurrency" :label="$t('form.pos.collect.Currency')">
<el-select
@ -193,7 +212,8 @@ export default {
return {
option: 1,
fieldsList: fieldsListOverdrawnInvoice,
currentFieldCurrency: ''
currentFieldCurrency: '',
currentPaymentType: ''
}
},
computed: {
@ -214,7 +234,7 @@ export default {
return false
},
primaryFieldsList() {
return this.fieldsList.filter(field => field.sequence <= 3)
return this.fieldsList.filter(field => field.sequence <= 2)
},
hiddenFieldsList() {
return this.fieldsList.filter(field => field.sequence > 4)
@ -237,6 +257,9 @@ export default {
},
emptyMandatoryFields() {
return this.$store.getters.getFieldsListEmptyMandatory({ containerUuid: 'OverdrawnInvoice', formatReturn: 'name' })
},
paymentTypeList() {
return this.$store.getters.getPaymentTypeList
}
},
methods: {
@ -266,6 +289,15 @@ export default {
changeCurrency(value) {
this.currentFieldCurrency = value
},
changePaymentType(value) {
this.$store.commit('currentTenderChange', value)
this.currentPaymentType = value
this.$store.commit('updateValueOfField', {
containerUuid: 'OverdrawnInvoice',
columnName: 'TenderType',
value: value
})
},
optionSelected({ posUuid, orderUuid, customerDetails, payments }) {
switch (this.option) {
case 2:

View File

@ -34,7 +34,7 @@
<el-card shadow="hover">
<p
style="cursor: pointer; text-align: center !important; color: black;min-height: 50px;"
@click="newOrder"
@click="allowsCreateOrder ? '' : newOrder"
>
<i class="el-icon-news" />
<br>
@ -90,7 +90,7 @@
<el-card shadow="hover">
<p
:style="blockOption"
@click="completePreparedOrder"
@click="adviserPin ? '' : completePreparedOrder"
>
<i class="el-icon-success" />
<br>
@ -103,7 +103,7 @@
<el-card shadow="hover">
<p
:style="blockOption"
@click="reverseSalesTransaction"
@click="adviserPin ? '' : reverseSalesTransaction"
>
<i class="el-icon-error" />
<br>
@ -129,7 +129,7 @@
<el-card shadow="hover">
<p
:style="blockOption"
@click="printOrder"
@click="adviserPin ? '' : printOrder"
>
<i class="el-icon-printer" />
<br>
@ -137,8 +137,7 @@
</p>
</el-card>
</el-col>
<el-col :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
<el-col v-if="allowsReturnOrder" :span="size" style="padding-left: 12px;padding-right: 12px;padding-bottom: 10px;">
<el-card shadow="hover">
<p
:style="blockOption"
@ -278,7 +277,7 @@
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
v-for="item in warehousesListPointOfSales"
:key="item.uuid"
:key="item.id"
:command="item"
>
{{ item.name }}
@ -357,6 +356,15 @@ export default {
}
},
computed: {
allowsReturnOrder() {
return this.$store.getters.posAttributes.currentPointOfSales.isAllowsReturnOrder
},
allowsCreateOrder() {
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.isAllowsCreateOrder)) {
return this.$store.getters.posAttributes.currentPointOfSales.isAllowsCreateOrder
}
return false
},
isShowProductsPriceList: {
get() {
return this.$store.state['pointOfSales/point/index'].productPrice.isShowPopoverMenu
@ -380,7 +388,13 @@ export default {
}
}
},
adviserPin() {
return this.$store.getters.posAttributes.currentPointOfSales.isAisleSeller
},
blockOption() {
if (this.adviserPin) {
return 'cursor: not-allowed; text-align: center !important; color: gray;min-height: 50px;'
}
if (!this.isEmptyValue(this.currentOrder.uuid)) {
return 'cursor: pointer; text-align: center !important; color: black;min-height: 50px;'
}
@ -536,9 +550,11 @@ export default {
})
},
createNewCustomerReturnOrder() {
createNewReturnOrder({
orderUuid: this.$route.query.action
})
if (this.isPosRequiredPin) {
createNewReturnOrder({
orderUuid: this.$route.query.action
})
}
},
showModal(action) {
this.$store.dispatch('setShowDialog', {

View File

@ -91,7 +91,7 @@
</el-tag>
</el-col>
<el-col :span="14" style="padding-left: 0px; padding-right: 0px;">
<el-button type="primary" plain @click="newOrder">
<el-button type="primary" :disabled="allowsCreateOrder" plain @click="newOrder">
{{ $t('form.pos.optionsPoinSales.salesOrder.newOrder') }}
</el-button>
</el-col>
@ -148,7 +148,7 @@
label-position="top"
style="float: right;display: contents;line-height: 30px;"
>
<el-row :gutter="24">
<el-row>
<el-col :span="4">
<div>
<el-avatar v-if="isEmptyValue(scope.row.product.imageUrl)" shape="square" :size="100" src="https://#" @error="true">
@ -206,7 +206,7 @@
</el-table-column>
</el-table>
</el-main>
<el-dialog ref="dialog" :title="$t('form.pos.tableProduct.pin')" width="30%" :visible.sync="visible">
<el-dialog ref="dialog" :title="$t('form.pos.pinMessage.pin') + infowOverdrawnInvoice.label" width="40%" :visible.sync="visible">
<el-input
id="pin"
ref="pin"
@ -239,6 +239,7 @@
v-show="isValidForDeleteLine(listOrderLine)"
type="success"
icon="el-icon-bank-card"
:disabled="allowsCollectOrder"
@click="openCollectionPanel"
>
{{ labelButtonCollections }}
@ -314,20 +315,20 @@
<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">
<b v-if="!isEmptyValue(currentOrder.uuid)" class="order-info">
{{ orderDate }}
</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">
<b v-if="!isEmptyValue(currentOrder.uuid)" class="order-info">
{{ getItemQuantity }}
</b>
</p>
<p class="total">
{{ $t('form.pos.order.numberLines') }}
<b class="order-info">
<b v-if="!isEmptyValue(currentOrder.uuid)" class="order-info">
{{ numberOfLines }}
</b></p>
</span>
@ -341,7 +342,7 @@
<b>
{{ $t('form.pos.order.total') }}:
</b>
<b style="float: right;">
<b v-if="!isEmptyValue(currentOrder.uuid)" style="float: right;">
<el-popover
v-if="!isEmptyValue(currentOrder.uuid)"
:v-model="seeConversion"
@ -638,7 +639,7 @@ export default {
},
currentWarehouse() {
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.warehouse)) {
return this.$store.getters.posAttributes.currentPointOfSales.warehouse
return this.$store.getters.getCurrentWarehousePos
}
return {}
},
@ -659,9 +660,23 @@ export default {
return this.$store.getters.posAttributes.currentPointOfSales.documentTypesList
}
return []
},
showOverdrawnInvoice() {
return this.$store.getters.getOverdrawnInvoice.visible
},
infowOverdrawnInvoice() {
if (this.$store.getters.getOverdrawnInvoice.attributePin) {
return this.$store.getters.getOverdrawnInvoice.attributePin
}
return ''
}
},
watch: {
showOverdrawnInvoice(value) {
if (value) {
this.visible = value
}
},
numberOfLines(value) {
if (value > 0) {
this.convertedAmount()
@ -675,6 +690,8 @@ export default {
setTimeout(() => {
this.focusPin()
}, 500)
} else {
this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: value })
}
}
},
@ -701,33 +718,6 @@ export default {
focusPin() {
this.$refs.pin.focus()
},
// openPin(pin) {
// validatePin({
// posUuid: this.currentPointOfSales.uuid,
// pin
// })
// .then(response => {
// this.validatePin = false
// this.pin = ''
// this.visible = false
// this.pinAction(this.attributePin)
// })
// .catch(error => {
// console.error(error.message)
// this.$message({
// type: 'error',
// message: error.message,
// showClose: true
// })
// this.pin = ''
// })
// .finally(() => {
// this.closePin()
// })
// },
// closePin() {
// this.visible = false
// },
closeConvertion() {
this.seeConversion = false
},
@ -747,35 +737,47 @@ export default {
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
},
newOrder() {
this.clearOrder()
this.$store.commit('setShowPOSCollection', false)
this.createOrder({ withLine: false, newOrder: true })
this.createOrder({ withLine: false, newOrder: true, customer: this.currentPointOfSales.templateBusinessPartner.uuid })
},
changePos(pointOfSales) {
this.$store.dispatch('setCurrentPOS', pointOfSales)
this.clearOrder()
},
changeWarehouse(warehouse) {
this.attributePin = {
const attributePin = {
...warehouse,
action: 'changeWarehouse',
type: 'actionPos'
type: 'actionPos',
label: this.$t('form.pos.pinMessage.warehouse')
}
this.visible = true
const visible = true
this.visible = visible
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
},
changeDocumentType(documentType) {
this.attributePin = {
...documentType,
action: 'changeDocumentType',
type: 'actionPos'
if (this.adviserPin) {
this.$store.commit('setCurrentDocumentTypePos', documentType)
} else {
const attributePin = {
...documentType,
action: 'changeDocumentType',
type: 'actionPos',
label: this.$t('form.pos.pinMessage.documentType')
}
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
this.visible = true
}
this.visible = true
},
changePriceList(priceList) {
this.attributePin = {
const attributePin = {
...priceList,
action: 'changePriceList',
type: 'actionPos'
type: 'actionPos',
label: this.$t('form.pos.pinMessage.priceList')
}
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
this.visible = true
},
arrowTop() {
@ -797,41 +799,6 @@ export default {
this.currentOrderLine = this.listOrderLine[this.currentTable]
}
}
// pinAction(action) {
// if (action.type === 'updateOrder') {
// switch (action.columnName) {
// case 'QtyEntered':
// case 'PriceEntered':
// case 'Discount':
// this.updateOrderLine(action)
// break
// case 'C_DocTypeTarget_ID': {
// const documentTypeUuid = this.$store.getters.getValueOfField({
// containerUuid: this.$route.meta.uuid,
// columnName: 'C_DocTypeTarget_ID_UUID'
// })
// this.$store.dispatch('updateOrder', {
// orderUuid: this.$route.query.action,
// posUuid: this.currentPointOfSales.uuid,
// documentTypeUuid
// })
// break
// }
// }
// } else if (action.type === 'actionPos') {
// switch (action.action) {
// case 'changeWarehouse':
// this.$store.commit('setCurrentWarehousePos', action)
// break
// case 'changeDocumentType':
// this.$store.commit('setCurrentDocumentTypePos', action)
// break
// case 'changePriceList':
// this.$store.commit('setCurrentPriceList', action)
// break
// }
// }
// }
}
}
</script>

View File

@ -16,7 +16,8 @@
import {
findProduct,
updateOrderLine
updateOrderLine,
deleteOrderLine
} from '@/api/ADempiere/form/point-of-sales.js'
import {
formatDate,
@ -55,8 +56,26 @@ export default {
}
},
computed: {
getWarehouse() {
return this.$store.getters['user/getWarehouse']
allowsCreateOrder() {
if (!this.isEmptyValue(this.$store.getters.posAttributes.currentPointOfSales.isAllowsCreateOrder)) {
return this.$store.getters.posAttributes.currentPointOfSales.isAllowsCreateOrder
}
return false
},
allowsCollectOrder() {
return this.$store.getters.posAttributes.currentPointOfSales.isAllowsCollectOrder
},
allowsModifyQuantity() {
return this.$store.getters.posAttributes.currentPointOfSales.isAllowsModifyQuantity
},
allowsReturnOrder() {
return this.$store.getters.posAttributes.currentPointOfSales.isAllowsReturnOrder
},
modifyPrice() {
return this.$store.getters.posAttributes.currentPointOfSales.isModifyPrice
},
adviserPin() {
return this.$store.getters.posAttributes.currentPointOfSales.isAisleSeller
},
isSetTemplateBP() {
const currentPOS = this.currentPointOfSales
@ -205,6 +224,11 @@ export default {
this.pin = ''
this.visible = false
this.pinAction(this.attributePin)
this.$message({
type: 'success',
message: 'Acción a realizar',
showClose: true
})
})
.catch(error => {
console.error(error.message)
@ -220,6 +244,7 @@ export default {
})
},
pinAction(action) {
action = this.isEmptyValue(action) ? this.$store.getters.getOverdrawnInvoice.attributePin : action
if (action.type === 'updateOrder') {
switch (action.columnName) {
case 'QtyEntered':
@ -240,6 +265,8 @@ export default {
break
}
}
} else if (action.type === 'addProduct') {
this.findProduct(action.value)
} else if (action.type === 'actionPos') {
switch (action.action) {
case 'changeWarehouse':
@ -251,11 +278,15 @@ export default {
case 'changePriceList':
this.$store.commit('setCurrentPriceList', action)
break
case 'openBalanceInvoice':
this.$store.commit('dialogoInvoce', { show: true, type: 2 })
break
}
}
},
closePin() {
this.visible = false
this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: false })
this.setDocumentType(this.currentOrder.documentType)
},
withoutPOSTerminal() {
@ -371,7 +402,7 @@ export default {
})
})
},
createOrder({ withLine = false, newOrder = false }) {
createOrder({ withLine = false, newOrder = false, customer }) {
if (this.withoutPOSTerminal()) {
return
}
@ -393,6 +424,9 @@ export default {
if (this.isEmptyValue(customerUuid) || id === 1000006) {
customerUuid = this.currentPointOfSales.templateBusinessPartner.uuid
}
if (customer) {
customerUuid = customer
}
// user session
this.$store.dispatch('createOrder', {
posUuid,
@ -460,30 +494,91 @@ export default {
getOrderTax(currency) {
return this.formatPrice(this.currentOrder.grandTotal - this.currentOrder.totalLines, currency)
},
deleteOrderLine(lineSelection) {
if (this.isPosRequiredPin) {
if (this.adviserPin) {
deleteOrderLine({
orderLineUuid: lineSelection.uuid
})
.then(response => {
this.$store.dispatch('reloadOrder', { orderUuid: this.$store.getters.posAttributes.currentPointOfSales.currentOrder.uuid })
})
.catch(error => {
console.error(error.message)
this.$message({
type: 'error',
message: error.message,
showClose: true
})
})
} else {
const attributePin = {
...lineSelection,
type: 'deleteLine',
label: this.$t('form.pos.pinMessage.delete')
}
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
this.visible = true
}
}
},
subscribeChanges() {
return this.$store.subscribe((mutation, state) => {
// TODO: Add container uuid comparison
if (mutation.type === 'addActionKeyPerformed') {
switch (mutation.payload.columnName) {
case 'ProductValue':
this.findProduct(mutation.payload.value)
// this.findProduct(mutation.payload.value)
// if (this.isPosRequiredPin) {
if (!this.allowsCreateOrder) {
this.findProduct(mutation.payload.value)
} else {
const attributePin = {
...mutation.payload,
type: 'addProduct',
label: this.$t('form.pos.pinMessage.addProduct')
}
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
this.visible = true
}
// } else {
// this.findProduct(mutation.payload.value)
// }
break
}
} else if (mutation.type === 'addActionPerformed') {
switch (mutation.payload.columnName) {
case 'QtyEntered':
if (!this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
if (this.isPosRequiredPin && !this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
if (this.allowsModifyQuantity) {
this.updateOrderLine(mutation.payload)
} else {
const attributePin = {
...mutation.payload,
type: 'updateOrder',
label: this.$t('form.pos.pinMessage.qtyEntered')
}
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
this.visible = true
}
} else if (!this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
this.updateOrderLine(mutation.payload)
}
break
case 'PriceEntered':
case 'Discount':
if (this.isPosRequiredPin && !this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
this.attributePin = {
...mutation.payload,
type: 'updateOrder'
if (this.modifyPrice) {
this.updateOrderLine(mutation.payload)
} else {
const attributePin = {
...mutation.payload,
type: 'updateOrder',
label: mutation.payload.columnName === 'PriceEntered' ? this.$t('form.pos.pinMessage.price') : this.$t('form.pos.pinMessage.discount')
}
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
this.visible = true
}
this.visible = true
} else if (!this.isEmptyValue(this.$store.state['pointOfSales/orderLine/index'].line)) {
this.updateOrderLine(mutation.payload)
}
@ -494,10 +589,11 @@ export default {
columnName: 'C_DocTypeTarget_ID_UUID'
})
if (this.isPosRequiredPin && !this.isEmptyValue(documentTypeUuid) && !this.isEmptyValue(this.currentOrder.documentType.uuid)) {
this.attributePin = {
const attributePin = {
...mutation.payload,
type: 'updateOrder'
}
this.$store.dispatch('changePopoverOverdrawnInvoice', { attributePin, visible: true })
this.visible = true
} else if (!this.isEmptyValue(documentTypeUuid) && !this.isEmptyValue(this.currentOrder.documentType.uuid)) {
this.$store.dispatch('updateOrder', {

View File

@ -505,6 +505,18 @@ export default {
},
keyLayout: {
noProducto: 'No product available. Back to top'
},
pinMessage: {
pin: 'Enter pin for ',
documentType: 'change document type',
warehouse: 'change warehouse',
price: 'change price',
qtyEntered: 'change quantity',
priceList: 'change price list',
discount: 'add discount',
delete: 'delete product',
addProduct: 'add product',
invoiceOpen: 'generate invoice with an open balance'
}
},
priceChecking: {

View File

@ -481,6 +481,18 @@ export default {
},
keyLayout: {
noProducto: 'No hay producto disponible Regresar al Principio'
},
pinMessage: {
pin: 'Ingrese pin para ',
documentType: 'cambiar tipo de documento',
warehouse: 'cambiar almacen',
price: 'cambiar precio',
qtyEntered: 'cambiar cantidad',
priceList: 'cambiar lista de precio',
discount: 'agregar descuento',
delete: 'eliminar producto',
addProduct: 'agregar producto',
invoiceOpen: 'generar factura con un saldo abierto'
}
},
priceChecking: {

View File

@ -144,5 +144,9 @@ export default {
// Current POS, it can be s
getCurrenciesList: (state) => {
return state.currenciesList
},
// get Payment type list
getPaymentTypeList: (state) => {
return state.tenderTypes
}
}

View File

@ -19,6 +19,7 @@ import {
listPointOfSales,
listWarehouses,
listDocumentTypes,
listTenderTypes,
listPrices,
listCurrencies
} from '@/api/ADempiere/form/point-of-sales.js'
@ -126,6 +127,22 @@ export default {
})
})
},
listTenderTypesFromServer({ commit }, posUuid) {
listTenderTypes({
posUuid
})
.then(response => {
commit('setTenderTypesList', response.records)
})
.catch(error => {
console.warn(`listTenderTypesFromServer: ${error.message}. Code: ${error.code}.`)
showMessage({
type: 'error',
message: error.message,
showClose: true
})
})
},
setCurrentPOS({ commit, dispatch, state, rootGetters }, posToSet) {
commit('setCurrentPointOfSales', posToSet)
const oldRoute = router.app._route
@ -143,10 +160,11 @@ export default {
dispatch('listWarehousesFromServer', posToSet.uuid)
dispatch('listDocumentTypesFromServer', posToSet.uuid)
dispatch('listCurrenciesFromServer', posToSet.uuid)
dispatch('listTenderTypesFromServer', posToSet.uuid)
dispatch('listPricesFromServer', posToSet)
commit('setCurrentPriceList', posToSet.priceList)
commit('setCurrentDocumentTypePos', posToSet.documentType)
commit('setCurrentWarehousePos', rootGetters['user/getWarehouse'])
commit('setCurrentWarehousePos', posToSet.warehouse)
commit('resetConversionRate', [])
commit('setIsReloadKeyLayout')
commit('setIsReloadProductPrice')

View File

@ -43,6 +43,12 @@ export default {
setCurrenciesList(state, currenciesList) {
state.currenciesList = currenciesList
},
setTenderTypesList(state, tenderTypes) {
state.tenderTypes = tenderTypes
},
currentTenderChange(state, tenderChange) {
state.tenderChange = tenderChange
},
addConversionToList(state, conversion) {
state.conversionsList.push(conversion)
},

View File

@ -37,6 +37,8 @@ export default {
listCurrency: [],
currenciesList: [],
conversionsList: [],
tenderTypes: [],
tenderChange: '',
currentPointOfSales: {},
showPOSOptions: false,
showPOSKeyLayout: false,

View File

@ -31,7 +31,10 @@ const initStateUtils = {
updateOrder: false,
updatePayment: false,
createBusinessPartner: false,
step: 0
step: 0,
overdrawnInvoice: {
visible: false
}
}
export default {
@ -109,6 +112,9 @@ export default {
},
popoverCreateBusinessPartner(state, createBusinessPartner) {
state.createBusinessPartner = createBusinessPartner
},
popoverOverdrawnInvoice(state, payload) {
state.overdrawnInvoice = payload
}
},
actions: {
@ -178,6 +184,13 @@ export default {
},
changePopover({ commit }, params) {
commit('popoverCreateBusinessPartner', params)
},
changePopoverOverdrawnInvoice({ commit }, { attributePin, visible }) {
const overdrawn = {
attributePin,
visible
}
commit('popoverOverdrawnInvoice', overdrawn)
}
},
getters: {
@ -256,6 +269,9 @@ export default {
},
getStepCurrent: (state) => {
return state.step
},
getOverdrawnInvoice: (state) => {
return state.overdrawnInvoice
}
}
}