From c3a7e7636f9ba667ad621128ac76876312a35a41 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Thu, 13 Nov 2025 15:19:52 -0300 Subject: [PATCH] Fill payment when editing --- .../modal/common/scripts/payments.blade.php | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/app/resources/views/ventas/reservations/modal/common/scripts/payments.blade.php b/app/resources/views/ventas/reservations/modal/common/scripts/payments.blade.php index ac1f8d3..ca8d584 100644 --- a/app/resources/views/ventas/reservations/modal/common/scripts/payments.blade.php +++ b/app/resources/views/ventas/reservations/modal/common/scripts/payments.blade.php @@ -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}`)