Fill payment when editing

This commit is contained in:
Juan Pablo Vial
2025-11-13 15:19:52 -03:00
parent a41f306d3f
commit c3a7e7636f

View File

@ -37,13 +37,13 @@
this.prefix = prefix
this.ids = {
pie: {
checkbox: `${this.prefix}_has_pie`,
value: `${this.prefix}_pie`,
installments: `${this.prefix}_cuotas`
checkbox: `${this.prefix}_payment_has_pie`,
value: `${this.prefix}_payment_pie`,
installments: `${this.prefix}_payment_cuotas`
},
credit: {
checkbox: `${this.prefix}_has_credit`,
value: `${this.prefix}_credit`
checkbox: `${this.prefix}_payment_has_credit`,
value: `${this.prefix}_payment_credit`
}
}
this.setup()
@ -77,18 +77,24 @@
this.hide.credit()
}
}
fill(formaPago) {
if ('pie' in formaPago && formaPago.pie !== null) {
fill(payment) {
if ('pie' in payment && payment.pie !== null) {
this.components.pie.$checkbox.prop('checked', true)
//this.show.pie()
this.components.pie.value.value = formaPago.pie.valor
this.components.pie.installments.value = formaPago.pie.cuotas
this.show.pie()
this.components.pie.value.querySelector('input').value = payment.pie.valor
this.components.pie.installments.querySelector('input').value = payment.pie.cuotas
}
if ('credito' in formaPago && formaPago.credito !== null) {
if ('credito' in payment && payment.credito !== null) {
this.components.credit.$checkbox.prop('checked', true)
//this.show.credit()
this.components.credit.value.value = formaPago.credito.value
this.show.credit()
this.components.credit.value.querySelector('input').value = payment.credito.valor
}
/*if ('subsidio' in payment && payment.subsidio !== null) {
this.components.subsidio.$checkbox.prop('checked', true)
this.components.subsidio.subsidy.value.value = payment.subsidio.subsidio.valor
this.components.subsidio.savings.value.value = payment.subsidio.ahorro.valor
this.show.subsidio()
}*/
}
setup() {
this.components.pie.$checkbox = $(`#${this.ids.pie.checkbox}`)