FIX: Editar pago

This commit is contained in:
Juan Pablo Vial
2024-11-06 19:55:49 -03:00
parent be410daa8b
commit d154212732

View File

@ -301,15 +301,15 @@
return
}
const tr = $(`tr[data-pago='${json.pago.id}']`)
tr.find(':nth-child(1)').html(json.pago.numero)
tr.children(':nth-child(1)').html(json.pago.numero)
const fecha = json.pago.fecha.split(' ')[0].split('-').reverse().join('-')
tr.find(':nth-child(2)').html(fecha)
tr.find(':nth-child(3)').html(json.pago.banco.nombre)
tr.find(':nth-child(4)').html(json.pago.identificador)
tr.children(':nth-child(2)').html(fecha)
tr.children(':nth-child(3)').html(json.pago.banco.nombre)
tr.children(':nth-child(4)').html(json.pago.identificador)
const pesosFormatter = Intl.NumberFormat('es-CL', {style: 'currency', currency: 'CLP'})
tr.find(':nth-child(5)').html(pesosFormatter.format(json.pago.valor))
tr.children(':nth-child(5)').html(pesosFormatter.format(json.pago.valor))
const ufFormatter = Intl.NumberFormat('es-CL', {minimumFractionDigits: 2, maximumFractionDigits: 2})
tr.find(':nth-child(6)').html(ufFormatter.format(json.pago.valor_uf) + ' UF')
tr.children(':nth-child(6)').html(ufFormatter.format(json.pago.valor_uf) + ' UF')
})
})
}
@ -320,9 +320,10 @@
$('.edit_cuota').on('click', clickEvent => {
const id = $(clickEvent.currentTarget).data('cuota')
const tr = $(`tr[data-pago='${id}']`)
const number = tr.find(':nth-child(1)').text().split('<')[0].trim()
const fecha = tr.find(':nth-child(2)').text()
const banco_id = bancos.filter(banco => banco.nombre === tr.find(':nth-child(3)').text())[0].id
const number = tr.children(':nth-child(1)').text().split('<')[0].trim()
const fecha = tr.children(':nth-child(2)').text()
const nombre_banco = tr.children(':nth-child(3)').text()
const banco_id = bancos.filter(banco => banco.nombre === nombre_banco)[0].id
const identificador = tr.find(':nth-child(4)').text()
const valor = parseInt(tr.find(':nth-child(5)').text().replace('$', '').replaceAll('.', '').trim())