From e6a3a7f98966ea57d22ad50b8e3d33c66f177abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorem=20Ju=C3=A1rez?= Date: Tue, 4 Aug 2026 18:33:50 -0600 Subject: [PATCH] ui(cobranza): modal Movs con el mismo desglose del estado de cuenta MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cada movimiento muestra ahora Capital y Saldo después (aproximado con capital − abonado en movimientos previos al snapshot) además de fecha, tipo, nota y monto. El encabezado del modal agrega Originación y Saldo actual de la subcuenta. Solo frontend. Co-Authored-By: Claude Opus 4.8 --- web/cobranza.html | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/web/cobranza.html b/web/cobranza.html index 0f1a8e1..79924d7 100644 --- a/web/cobranza.html +++ b/web/cobranza.html @@ -239,8 +239,9 @@ .btn-abono { background: var(--renta); color: #fff; box-shadow: 0 6px 16px -5px rgba(37,99,201,0.4); } .btn-abono:hover { filter: brightness(0.94); } .btn-abono:active { transform: scale(0.97); } - .mov-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px; } + .mov-item { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px; flex-wrap: wrap; } .mov-item:last-child { border-bottom: none; } + .mov-det { flex-basis: 100%; font-size: 11px; color: var(--text-secondary); margin-top: 1px; padding-left: 84px; } .mov-fecha { flex: 0 0 auto; color: var(--text-tertiary); font-variant-numeric: tabular-nums; font-size: 11.5px; width: 74px; } .mov-tipo { flex: 0 0 auto; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.3px; } .mov-tipo.abono { background: var(--renta-soft); color: var(--renta); } @@ -1587,10 +1588,13 @@ const MOV_LABEL = { abono: "Abono", saldado: "Saldado", saldo_periodo: "Mes sald async function abrirMovs(id){ const r = renglones.find(x => x.id === id); if(!r) return; + const metaSub = []; + if(r.fecha_alta) metaSub.push("Originación: " + fmtFechaEs(r.fecha_alta)); + metaSub.push("Saldo actual: " + fmt(r.saldo)); document.getElementById("modal-inner").classList.remove("lote"); document.getElementById("modal-inner").innerHTML = ` -

${r.cliente}
${r.vehiculo} · ${tipoLabel(r)}

+

${r.cliente}
${r.vehiculo} · ${tipoLabel(r)}
${metaSub.join(" · ")}

Cargando…
`; document.getElementById("modal").classList.add("open"); try { @@ -1604,13 +1608,27 @@ async function abrirMovs(id){ return; } cont.innerHTML = `
Últimos ${res.visibles} movimientos (configurable en la pestaña Mensaje).
` + - movs.map(m => ` + movs.map(m => { + // Mismo desglose que el estado de cuenta: capital y saldo después + // del movimiento (aproximado con capital − abonado si el + // movimiento es previo al snapshot completo). + const cap = (m.capital != null) ? Number(m.capital) : null; + let despues = (m.saldo_despues != null) ? Number(m.saldo_despues) : null; + if(despues == null && cap != null && m.abonado != null){ + despues = cap - Number(m.abonado); + } + const det = []; + if(cap != null) det.push("Capital " + fmt(cap)); + if(despues != null) det.push("Saldo después " + fmt(despues)); + if(m.nota) det.push(m.nota); + return `
${fmtFechaEs(m.fecha)} ${MOV_LABEL[m.movimiento] || m.movimiento} - ${m.nota || ""} - ${fmt(m.monto)} -
`).join(""); + ${fmt(m.monto)} + ${det.length ? `
${det.join(" · ")}
` : ""} + `; + }).join(""); } catch(e){ const cont = document.getElementById("movs-lista"); if(cont) cont.textContent = "No se pudieron cargar los movimientos.";