Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Feat: Support Sitef #1749

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import lang from '@/lang'
// Utils and Helper Methods
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { getPaymentValues } from '@/utils/ADempiere/dictionary/form/VPOS'
import { getAttributesPaymentSales } from '@/utils/ADempiere/pos/Sitef.js'
// import { defaultValueCollections } from '@/utils/ADempiere/dictionary/form/VPOS'

export default defineComponent({
Expand Down Expand Up @@ -83,6 +84,36 @@ export default defineComponent({
function addPayment() {
const { payment_method } = store.getters.getPaymentMethods
isLoading.value = true
payment_method.is_online_payment = true
const params = getPaymentValues({})
if (payment_method.is_online_payment) {
store.dispatch('setModalDialogVPOS', {
title: lang.t('pointOfSales.collection.confirmPayment'),
doneMethod: () => {
const {
cardType,
accountType
} = store.getters.getAllAttributeOnlinePayments

const attribute = getAttributesPaymentSales({
amount: params.amount,
typeCard: cardType,
type: accountType
})
store.dispatch('transactionalSale', attribute)
isLoading.value = false
},
cancelMethod: () => {
store.commit('setShowedModalDialogVPOS', {
isShowed: false
})
isLoading.value = false
},
componentPath: () => import('@/components/ADempiere/Form/VPOS2/Collection/OnlinePayments'),
isShowed: true
})
return
}
if (
!isEmptyValue(payment_method) &&
isEmptyValue(currentAccount.value) &&
Expand All @@ -102,7 +133,7 @@ export default defineComponent({
})
return
}
const params = getPaymentValues({})
// const params = getPaymentValues({})
store.dispatch('addPayment', params)
.then(() => {
isLoading.value = false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
<!--
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 [email protected] https://github.com/elsiosanchez
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/>.
-->

<template>
<el-row>
<el-col :span="24">
<el-card
shadow="never"
class="custom-card-options"
:body-style="{ padding: '10px' }"
>
<el-form
:inline="true"
label-position="top"
class="form-base"
@submit.native.prevent="notSubmitForm"
>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item
:label="$t('pointOfSales.collection.field.code')"
class="form-item-criteria"
style="margin: 0px;width: 100%;"
>
<el-input
v-model="code"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
:label="$t('pointOfSales.collection.field.typeCard.label')"
class="form-item-criteria"
style="margin: 0px;width: 100%;"
>
<el-select
v-model="cardType"
style="width: 100%;"
filterable
clearable
>
<el-option
v-for="item in optionsList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col
v-if="!isEmptyValue(cardType) && cardType === 1"
:span="6"
>
<el-form-item
:label="$t('pointOfSales.collection.field.bankAccountType.label')"
class="form-item-criteria"
style="margin: 0px;width: 100%;"
>
<el-select
v-model="accountType"
style="width: 100%;"
filterable
clearable
>
<el-option
v-for="item in listBankAccountType"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
:label="$t('pointOfSales.collection.field.fullPayment')"
class="form-item-criteria"
style="margin: 0px;width: 100%;"
>
<field-amount
:value-amount="amount"
:value-display="amount"
:handle-change="updateAmount"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</el-col>
</el-row>
</template>

<script>
import { defineComponent, computed, ref } from '@vue/composition-api'
import store from '@/store'
import lang from '@/lang'
// Component and Mixins
import fieldAmount from '@/components/ADempiere/Form/VPOS2/MainOrder/OptionLine/editLine/fieldAmount.vue'
// Utils and Helper Methods
// import { isEmptyValue } from '@/utils/ADempiere'

export default defineComponent({
name: 'OnlinePayments',
components: {
fieldAmount
},
setup() {
// Ref

const typeCard = ref(null)

const optionsList = ref([
{
label: lang.t('pointOfSales.collection.field.typeCard.debit'),
value: 1
},
{
label: lang.t('pointOfSales.collection.field.typeCard.credit'),
value: 2
}
])

const listBankAccountType = ref([
{
value: 1,
label: lang.t('pointOfSales.collection.field.bankAccountType.checking')
},
{
value: 2,
label: lang.t('pointOfSales.collection.field.bankAccountType.currentAccount')
}
])

// Computed

const amount = computed(() => {
return store.getters.getPayAmount
})

const code = computed({
get() {
return store.getters.getAttributeFieldOnlinePayments({
field: 'field',
attribute: 'value'
})
},
// setter
set(value) {
store.commit('setAttributeFieldOnlinePayments', {
field: 'field',
attribute: 'value',
value
})
}
})

const accountType = computed({
get() {
return store.getters.getAttributeFieldOnlinePayments({
field: 'field',
attribute: 'accountType'
})
},
// setter
set(value) {
store.commit('setAttributeFieldOnlinePayments', {
field: 'field',
attribute: 'accountType',
value
})
}
})

const cardType = computed({
get() {
return store.getters.getAttributeFieldOnlinePayments({
field: 'field',
attribute: 'cardType'
})
},
// setter
set(value) {
store.commit('setAttributeFieldOnlinePayments', {
field: 'field',
attribute: 'cardType',
value
})
}
})

// Methods

/**
* Update Amount
* @param {Number} amount
*/
function updateAmount(amount) {
store.commit('setPayAmount', amount)
}

return {
// Ref
typeCard,
optionsList,
listBankAccountType,
// Computed
accountType,
cardType,
amount,
code,
// Methods
updateAmount
}
}
})
</script>

<style lang="scss" scoped>
.buttons-and-options {
text-align: left;
}
.order-info {
text-align: right;
}
</style>
6 changes: 6 additions & 0 deletions src/lang/ADempiere/en/form/pointOfSales.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const pointOfSales = {
receivingBank: 'Receiving Bank',
customerAccount: 'Customer Account',
issuingBank: 'Issuing Bank',
typeCard: {
label: 'Type Card',
debit: 'Débit',
credit: 'Crédit'
},
bankAccountType: {
label: 'Bank Account Type',
currentAccount: 'Current Account',
Expand All @@ -62,6 +67,7 @@ const pointOfSales = {
cardNumber: 'Card Number',
email: 'Mail'
},
confirmPayment: 'Confirm Payment',
chargeAmount: 'Charge',
creditAmount: 'Installment',
others: 'Others',
Expand Down
6 changes: 6 additions & 0 deletions src/lang/ADempiere/es/form/pointOfSales.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const pointOfSales = {
receivingBank: 'Banco Receptor',
customerAccount: 'Cuenta de Cliente',
issuingBank: 'Banco Emisor',
typeCard: {
label: 'Tipo de Tarjeta',
debit: 'Débito',
credit: 'Crédito'
},
bankAccountType: {
label: 'Tipo de Cuenta Bancario',
currentAccount: 'Cuenta Corriente',
Expand All @@ -62,6 +67,7 @@ const pointOfSales = {
cardNumber: 'Número de Tarjeta',
email: 'Correo'
},
confirmPayment: 'Confirmar Pago',
chargeAmount: 'Cargo',
creditAmount: 'Abono',
others: 'Otros',
Expand Down
Loading