|
@@ -12,6 +12,7 @@
|
|
|
title='Pago Bancario'
|
|
|
subtitle=''
|
|
|
color='#7c7bad'
|
|
|
+ ref='wizard'
|
|
|
)
|
|
|
tab-content(
|
|
|
title='Qué tipo de operación es?'
|
|
@@ -22,56 +23,42 @@
|
|
|
@onSelect='selectBankJournal'
|
|
|
)
|
|
|
tab-content(title='Qué detalles necesita?')
|
|
|
- form.payment-details-form
|
|
|
- .form-item
|
|
|
- label.form-label Tipo de Pago
|
|
|
- select.form-input(v-model='selectedBankPaymentTypeId')
|
|
|
- option(
|
|
|
- v-for='bankPaymentType in bankPaymentTypes'
|
|
|
- :value='bankPaymentType.id'
|
|
|
- ) {{ bankPaymentType.name }}
|
|
|
- .form-item(v-show="canBeShow('number_cta')")
|
|
|
- label.form-label Nº de Cuenta
|
|
|
- input.form-input(v-model='accountNumber')
|
|
|
- .form-item(v-show="canBeShow('date_maturity')")
|
|
|
- label.form-label Vencimiento
|
|
|
+ form.payment-details-form(v-if='selectedJournal')
|
|
|
+ .form-item(v-for='(field, index) in selectedJournal.fieldsAllowed' :key='index')
|
|
|
+ label.form-label {{ field.label }}
|
|
|
+ input.form-input(
|
|
|
+ v-if="field.string.typeField === 'char'"
|
|
|
+ v-model='values[field.name]'
|
|
|
+ )
|
|
|
date-picker.form-input(
|
|
|
- v-model='dueDate'
|
|
|
+ v-else-if="field.string.typeField === 'date'"
|
|
|
+ v-model='values[field.name]'
|
|
|
input-class='form-input'
|
|
|
lang='es'
|
|
|
+ format='DD/MM/YYYY'
|
|
|
:editable='false'
|
|
|
:not-before="new Date()"
|
|
|
)
|
|
|
- .form-item(v-show="canBeShow('check_type_id')")
|
|
|
- label.form-label Tipo de Cheque
|
|
|
- select.form-input(v-model='selectedChequeTypeId')
|
|
|
- option(
|
|
|
- v-for='chequeType in chequeTypes'
|
|
|
- :value='chequeType.id'
|
|
|
- ) {{ chequeType.name }}
|
|
|
- .form-item(v-show="canBeShow('name_holder')")
|
|
|
- label.form-label Titular
|
|
|
- input.form-input(v-model='accountHolder')
|
|
|
- .form-item
|
|
|
- label.form-label Nº de Comprobante
|
|
|
- input.form-input(v-model='voucherNumber')
|
|
|
- .form-item(v-show="canBeShow('bank_id')")
|
|
|
- label.form-label Banco
|
|
|
dropdown-searcher.form-input(
|
|
|
+ v-else-if="field.string.typeField === 'many2one' && field.name === 'bank_id'"
|
|
|
:items='banks'
|
|
|
- @onSelect='selectBank'
|
|
|
+ @onSelect='selectedItem => onSelectInDropdown(field.name, selectedItem.id)'
|
|
|
+ )
|
|
|
+ dropdown-searcher.form-input(
|
|
|
+ v-else-if="field.string.typeField === 'many2one' && field.name === 'cheque_type_id'"
|
|
|
+ :items='chequeTypes'
|
|
|
+ @onSelect='selectedItem => onSelectInDropdown(field.name, selectedItem.id)'
|
|
|
)
|
|
|
- .form-item(v-show="canBeShow('number')")
|
|
|
- label.form-label Nº de Vale
|
|
|
- input.form-input(v-model='voucherNumber')
|
|
|
- .form-item(v-show="canBeShow('number_cta_origin')")
|
|
|
- label.form-label Nº de Cuenta Origen
|
|
|
- input.form-input(v-model='originAccount')
|
|
|
tab-content(title='De qué monto es la operación?')
|
|
|
form.payment-details-form
|
|
|
.form-item
|
|
|
label.form-label Monto del Pago
|
|
|
- input.form-input(v-model='amount')
|
|
|
+ //- input.form-input(v-model='amount')
|
|
|
+ input-dropdown.form-input(
|
|
|
+ format='number'
|
|
|
+ :value='values.amount'
|
|
|
+ @onChangeValue='onChangeAmount'
|
|
|
+ )
|
|
|
template(
|
|
|
slot='footer'
|
|
|
slot-scope='props'
|
|
@@ -92,7 +79,7 @@
|
|
|
v-if='!props.isLastStep'
|
|
|
class='wizard-footer-right'
|
|
|
:style='props.fillButtonStyle'
|
|
|
- @click.native='props.nextTab()'
|
|
|
+ @click.native='goNext'
|
|
|
) Siguiente
|
|
|
wizard-button(
|
|
|
v-else
|
|
@@ -105,7 +92,7 @@
|
|
|
<script>
|
|
|
import { FormWizard, TabContent, WizardButton } from 'vue-form-wizard'
|
|
|
import DatePicker from 'vue2-datepicker'
|
|
|
- import { CardGrid, DropdownSearcher } from '../common'
|
|
|
+ import { CardGrid, DropdownSearcher, InputDropdown } from '../common'
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
@@ -121,74 +108,56 @@
|
|
|
type: Boolean,
|
|
|
required: true
|
|
|
},
|
|
|
- banks: {
|
|
|
- type: Array,
|
|
|
+ selectedJournal: {
|
|
|
+ type: Boolean,
|
|
|
required: true
|
|
|
},
|
|
|
- bankPaymentTypes: {
|
|
|
+ banks: {
|
|
|
type: Array,
|
|
|
required: true
|
|
|
},
|
|
|
- selectedBankPaymentType: {
|
|
|
- type: Object,
|
|
|
- required: true
|
|
|
- },
|
|
|
chequeTypes: {
|
|
|
type: Array,
|
|
|
required: true
|
|
|
},
|
|
|
- selectedChequeType: {
|
|
|
- type: Object,
|
|
|
- required: true
|
|
|
- },
|
|
|
show: {
|
|
|
type: Boolean,
|
|
|
required: true
|
|
|
}
|
|
|
},
|
|
|
- components: {
|
|
|
- FormWizard,
|
|
|
- TabContent,
|
|
|
- WizardButton,
|
|
|
- DropdownSearcher,
|
|
|
- CardGrid,
|
|
|
- DatePicker
|
|
|
- },
|
|
|
computed: {
|
|
|
- selectedBankPaymentTypeId: {
|
|
|
- get() {
|
|
|
- return this.selectedBankPaymentType && this.selectedBankPaymentType.id
|
|
|
- },
|
|
|
- set(value) {
|
|
|
- this.changeBankPaymentType(value)
|
|
|
- }
|
|
|
- },
|
|
|
- selectedChequeTypeId: {
|
|
|
+ amount: {
|
|
|
get() {
|
|
|
- return this.selectedChequeType && this.selectedChequeType.id
|
|
|
+ return this.values.amount
|
|
|
},
|
|
|
set(value) {
|
|
|
- this.changeChequeType(value)
|
|
|
+ this.values.amount = value
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ components: {
|
|
|
+ FormWizard,
|
|
|
+ TabContent,
|
|
|
+ WizardButton,
|
|
|
+ DropdownSearcher,
|
|
|
+ CardGrid,
|
|
|
+ DatePicker,
|
|
|
+ InputDropdown
|
|
|
+ },
|
|
|
watch: {
|
|
|
show(value) {
|
|
|
+ this.values = {}
|
|
|
+ this.values.amount = this.initialAmount
|
|
|
+
|
|
|
if (!value) {
|
|
|
this.$modal.hide('payment-bank-modal')
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (this.journals.length === 0) {
|
|
|
- this.onCancel()
|
|
|
- this.notify('No hay diarios definidos para pagos bancarios')
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
this.$modal.show('payment-bank-modal')
|
|
|
},
|
|
|
initialAmount(value) {
|
|
|
- this.amount = value
|
|
|
+ this.values.amount = value
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -197,66 +166,60 @@
|
|
|
e.stop()
|
|
|
}
|
|
|
},
|
|
|
- checkJournalSelectionStep() {
|
|
|
- if (!this.hasSelectedJournal) {
|
|
|
- this.notify('Debes seleccionar el tipo de operación')
|
|
|
- return false
|
|
|
+ goNext() {
|
|
|
+ if (this.journalStepIncomplete()) {
|
|
|
+ this.$emit('onNotify', 'El tipo de operación seleccionado no está configurado')
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.fieldsStepIncomplete()) {
|
|
|
+ this.$emit('onNotify', 'Algunos campos requeridos están incompletos')
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
- if (this.bankPaymentTypes.length === 0) {
|
|
|
- this.notify('No hay tipos de pago definidos para éste tipo de operación')
|
|
|
- return false
|
|
|
+ if (this.amountStepIncomplete()) {
|
|
|
+ this.$emit('onNotify', 'El monto no es válido')
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
- return true
|
|
|
+ this.$refs.wizard.nextTab()
|
|
|
},
|
|
|
- canBeShow(formItem) {
|
|
|
- return this.selectedBankPaymentType && this.selectedBankPaymentType.fieldsAllowed.indexOf(formItem) !== -1
|
|
|
+ journalStepIncomplete() {
|
|
|
+ return this.$refs.wizard.activeTabIndex == 0 && !this.selectedJournal || !this.selectedJournal.fieldsAllowed.length
|
|
|
},
|
|
|
- selectBankJournal(journal) {
|
|
|
- this.$emit('onChangeBankJournal', journal.id)
|
|
|
+ fieldsStepIncomplete() {
|
|
|
+ let completed = false;
|
|
|
+
|
|
|
+ for (let field of this.selectedJournal.fieldsAllowed) {
|
|
|
+ if (field.string.required) {
|
|
|
+ completed = !!this.values[field.name]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return this.$refs.wizard.activeTabIndex == 1 && !completed
|
|
|
},
|
|
|
- changeBankPaymentType(id) {
|
|
|
- this.$emit('onChangeBankPaymentType', id)
|
|
|
+ amountStepIncomplete() {
|
|
|
+ return false
|
|
|
},
|
|
|
- notify(message) {
|
|
|
- this.$emit('onNotify', message)
|
|
|
+ selectBankJournal(journal) {
|
|
|
+ this.$emit('onSelectBankJounal', journal.id)
|
|
|
},
|
|
|
- changeChequeType(id) {
|
|
|
- this.$emit('onChangeChequeType', id)
|
|
|
+ onSelectInDropdown(fieldName, selectedId) {
|
|
|
+ this.values[fieldName] = selectedId
|
|
|
},
|
|
|
- selectBank(bank) {
|
|
|
- this.$emit('onSelectBank', bank.id)
|
|
|
+ onChangeAmount(value) {
|
|
|
+ this.values.amount = value
|
|
|
},
|
|
|
onDone() {
|
|
|
- this.$emit('onDone', {
|
|
|
- voucherNumber: this.voucherNumber,
|
|
|
- dueDate: this.dueDate,
|
|
|
- accountHolder: this.accountHolder,
|
|
|
- originAccount: this.originAccount,
|
|
|
- amount: this.amount
|
|
|
- })
|
|
|
+ this.$emit('onDone', this.values)
|
|
|
},
|
|
|
onCancel() {
|
|
|
this.$emit('onCancel')
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.accountNumber = ''
|
|
|
- this.voucherNumber = ''
|
|
|
- this.dueDate = ''
|
|
|
- this.accountHolder = ''
|
|
|
- this.originAccount =''
|
|
|
- this.amount = 0
|
|
|
- },
|
|
|
data() {
|
|
|
return {
|
|
|
- accountNumber: '',
|
|
|
- voucherNumber: '',
|
|
|
- dueDate: '',
|
|
|
- accountHolder: '',
|
|
|
- originAccount: '',
|
|
|
- amount: 0
|
|
|
+ values: {}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -279,33 +242,6 @@
|
|
|
align-items: center !important
|
|
|
.payment-details-form
|
|
|
width: 100%
|
|
|
- .form-item
|
|
|
- width: 100%
|
|
|
- height: 35px
|
|
|
- margin-bottom: 15px
|
|
|
- & > .form-label, > .form-input
|
|
|
- display: inline-block
|
|
|
- vertical-align: top
|
|
|
- .form-label
|
|
|
- width: 200px
|
|
|
- height: 35px
|
|
|
- font-size: 12pt
|
|
|
- line-height: 30px
|
|
|
- .form-input
|
|
|
- width: 400px
|
|
|
- height: 35px
|
|
|
- font-size: 12pt
|
|
|
- border-radius: 0
|
|
|
- color: #666
|
|
|
- &.input-only
|
|
|
- margin-left: 200px
|
|
|
- margin-bottom: 15px
|
|
|
- .form-item-option
|
|
|
- display: inline-block
|
|
|
- input
|
|
|
- width: 20px
|
|
|
- height: 20px
|
|
|
- label
|
|
|
- font-size: 12pt
|
|
|
- margin: 0 35px 15px 5px
|
|
|
+ .form-input
|
|
|
+ color: #4c4c4c
|
|
|
</style>
|