Skip to content

Commit

Permalink
validate terminal configurator (#1082)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
elsiosanchez and elsiosanchez authored Aug 19, 2021
1 parent 0bffaa6 commit 6f20050
Show file tree
Hide file tree
Showing 14 changed files with 345 additions and 109 deletions.
2 changes: 1 addition & 1 deletion src/api/ADempiere/form/point-of-sales.js
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ export function listCurrencies({
* Tender Type
* @param {string} posUuidd - POS UUID reference
*/
export function listTenderType({
export function listTenderTypes({
posUuid
}) {
return request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 => {
Expand Down
35 changes: 35 additions & 0 deletions src/components/ADempiere/Form/VPOS/Collection/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;">
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -193,7 +212,8 @@ export default {
return {
option: 1,
fieldsList: fieldsListOverdrawnInvoice,
currentFieldCurrency: ''
currentFieldCurrency: '',
currentPaymentType: ''
}
},
computed: {
Expand All @@ -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)
Expand All @@ -237,6 +257,9 @@ export default {
},
emptyMandatoryFields() {
return this.$store.getters.getFieldsListEmptyMandatory({ containerUuid: 'OverdrawnInvoice', formatReturn: 'name' })
},
paymentTypeList() {
return this.$store.getters.getPaymentTypeList
}
},
methods: {
Expand Down Expand Up @@ -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:
Expand Down
36 changes: 26 additions & 10 deletions src/components/ADempiere/Form/VPOS/Options/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -90,7 +90,7 @@
<el-card shadow="hover">
<p
:style="blockOption"
@click="completePreparedOrder"
@click="adviserPin ? '' : completePreparedOrder"
>
<i class="el-icon-success" />
<br>
Expand All @@ -103,7 +103,7 @@
<el-card shadow="hover">
<p
:style="blockOption"
@click="reverseSalesTransaction"
@click="adviserPin ? '' : reverseSalesTransaction"
>
<i class="el-icon-error" />
<br>
Expand All @@ -129,16 +129,15 @@
<el-card shadow="hover">
<p
:style="blockOption"
@click="printOrder"
@click="adviserPin ? '' : printOrder"
>
<i class="el-icon-printer" />
<br>
{{ $t('form.pos.optionsPoinSales.salesOrder.print') }}
</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"
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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;'
}
Expand Down Expand Up @@ -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', {
Expand Down
Loading

0 comments on commit 6f20050

Please sign in to comment.