diff --git a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue index 78a47c37..d785a277 100644 --- a/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue +++ b/src/components/ADempiere/Form/VPOS/Collection/overdrawnInvoice/index.vue @@ -28,7 +28,6 @@ {{ $t('form.pos.collect.overdrawnInvoice.returned') }} {{ formatPrice(change, currency.iSOCode) }} - {{ $t('form.pos.collect.overdrawnInvoice.coupon') }} {{ $t('form.pos.collect.overdrawnInvoice.returnMoney') }} {{ $t('form.pos.collect.overdrawnInvoice.adjustDocument') }} diff --git a/src/components/ADempiere/Form/VPOS/Options/index.vue b/src/components/ADempiere/Form/VPOS/Options/index.vue index cf805373..88137789 100644 --- a/src/components/ADempiere/Form/VPOS/Options/index.vue +++ b/src/components/ADempiere/Form/VPOS/Options/index.vue @@ -77,7 +77,7 @@


@@ -90,7 +90,7 @@


@@ -103,7 +103,7 @@


@@ -116,7 +116,7 @@


@@ -129,7 +129,7 @@


@@ -141,7 +141,7 @@


@@ -153,7 +153,7 @@


@@ -165,7 +165,7 @@


@@ -219,7 +219,7 @@ - +

@@ -311,6 +311,29 @@ + + + + + + + @@ -327,6 +350,7 @@ import { createOrder, processOrder } from '@/api/ADempiere/form/point-of-sales.js' +import { validatePin } from '@/api/ADempiere/form/point-of-sales.js' import ModalDialog from '@/components/ADempiere/Dialog' import posProcess from '@/utils/ADempiere/constants/posProcess' import orderLineMixin from '@/components/ADempiere/Form/VPOS/Order/orderLineMixin.js' @@ -351,11 +375,21 @@ export default { return { activeName: '', processPos: '', + pin: '', + attributePin: {}, + validatePin: true, + visible: false, showFieldListOrder: false, posProcess } }, computed: { + infowOverdrawnInvoice() { + if (this.$store.getters.getOverdrawnInvoice.attributePin) { + return this.$store.getters.getOverdrawnInvoice.attributePin + } + return '' + }, allowsReturnOrder() { return this.$store.getters.posAttributes.currentPointOfSales.isAllowsReturnOrder }, @@ -389,12 +423,9 @@ export default { } }, adviserPin() { - return this.$store.getters.posAttributes.currentPointOfSales.isAisleSeller + return this.$store.getters.posAttributes.currentPointOfSales.isPosRequiredPin }, 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;' } @@ -449,10 +480,96 @@ export default { return this.currentPointOfSales.currentOrder } }, + // watch: { + // visible(value) { + // if (value && !this.isEmptyValue(this.$refs)) { + // setTimeout(() => { + // this.focusPin() + // }, 500) + // } else { + // this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: value }) + // } + // } + // }, created() { this.findProcess(this.posProcess) }, methods: { + closePin() { + this.visible = false + this.$store.dispatch('changePopoverOverdrawnInvoice', { visible: false }) + this.pin = '' + }, + focusPin() { + this.$refs.pin.focus() + }, + openPin(pin) { + validatePin({ + posUuid: this.currentPointOfSales.uuid, + pin + }) + .then(response => { + this.validatePin = true + this.pin = '' + this.visible = false + this.optionPin(this.attributePin) + this.$message({ + type: 'success', + message: 'Acción a realizar', + showClose: true + }) + }) + .catch(error => { + console.error(error.message) + this.$message({ + type: 'error', + message: error.message, + showClose: true + }) + this.pin = '' + }) + .finally(() => { + this.visible = false + }) + }, + validateOption(name) { + this.visible = true + this.attributePin = { + type: 'updateOrder', + label: name + } + }, + optionPin(action) { + switch (action.label) { + case 'Crear Nueva Orden de Devolución': + this.createNewCustomerReturnOrder() + break + case this.$t('form.pos.optionsPoinSales.salesOrder.completePreparedOrder'): + this.completePreparedOrder() + break + case this.$t('form.pos.optionsPoinSales.salesOrder.generateImmediateInvoice'): + this.generateImmediateInvoice() + break + case this.$t('form.pos.optionsPoinSales.salesOrder.cancelSaleTransaction'): + this.reverseSalesTransaction() + break + case this.$t('form.pos.optionsPoinSales.salesOrder.createPos'): + this.withdrawal() + break + case this.$t('form.pos.optionsPoinSales.salesOrder.print'): + this.printOrder() + break + case this.$t('form.pos.optionsPoinSales.salesOrder.copyOrder'): + this.copyOrder() + break + case this.$t('form.pos.optionsPoinSales.salesOrder.cancelOrder'): + this.deleteOrder() + break + case this.$t('form.pos.optionsPoinSales.generalOptions.changePos'): + this.changePos() + break + } + }, notSubmitForm(event) { event.preventDefault() return false @@ -550,11 +667,9 @@ export default { }) }, createNewCustomerReturnOrder() { - if (this.isPosRequiredPin) { - createNewReturnOrder({ - orderUuid: this.$route.query.action - }) - } + createNewReturnOrder({ + orderUuid: this.$route.query.action + }) }, showModal(action) { this.$store.dispatch('setShowDialog', { @@ -627,7 +742,7 @@ export default { } this.$store.dispatch('updateOrderPos', true) deleteOrder({ - orderUuid: this.$route.query.action + orderUuid: this.currentOrder.uuid }) .then(response => { this.changePos(this.currentPointOfSales) diff --git a/src/components/ADempiere/Form/VPOS/Order/index.vue b/src/components/ADempiere/Form/VPOS/Order/index.vue index 8274ed09..9c1765aa 100644 --- a/src/components/ADempiere/Form/VPOS/Order/index.vue +++ b/src/components/ADempiere/Form/VPOS/Order/index.vue @@ -242,7 +242,7 @@ v-show="isValidForDeleteLine(listOrderLine)" type="success" icon="el-icon-bank-card" - :disabled="allowsCollectOrder" + :disabled="!allowsCollectOrder" @click="openCollectionPanel" > {{ labelButtonCollections }} diff --git a/src/components/ADempiere/Form/VPOS/posMixin.js b/src/components/ADempiere/Form/VPOS/posMixin.js index 94e82b83..740e7df5 100644 --- a/src/components/ADempiere/Form/VPOS/posMixin.js +++ b/src/components/ADempiere/Form/VPOS/posMixin.js @@ -267,6 +267,21 @@ export default { } } else if (action.type === 'addProduct') { this.findProduct(action.value) + } else if (action.type === 'deleteLine') { + deleteOrderLine({ + orderLineUuid: action.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 if (action.type === 'actionPos') { switch (action.action) { case 'changeWarehouse':