feat(cobranza): desglose del total por tipo en el dashboard
Bajo las tarjetas de Total acumulado / Interés moratorio agrega 4 mini- tarjetas (grid 2×2) con el saldo pendiente desglosado por tipo de cobro: Renta, Valor residual, Extraordinaria y Otros (personalizados). Cada una con acento de color del tipo; siempre visibles (incluso en $0). La suma de las cuatro coincide con el Total acumulado. renderStats acumula saldo por tipo (tipos desconocidos caen en Otros). Solo UI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
eed47026ac
commit
050dc9d309
1 file changed
+35
-1
+35
-1
@@ -82,6 +82,21 @@
|
||||
.stat-value.accent { color: var(--accent); }
|
||||
.stat-value.warning { color: var(--warning); }
|
||||
|
||||
/* Desglose del total por tipo de cobro */
|
||||
.summary-breakdown { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1.4rem; }
|
||||
.stat.mini { padding: 0.7rem 0.85rem; border-left: 3px solid var(--line); }
|
||||
.stat.mini.renta { border-left-color: var(--renta); }
|
||||
.stat.mini.vr { border-left-color: var(--vr); }
|
||||
.stat.mini.extra { border-left-color: var(--extra); }
|
||||
.stat.mini.otro { border-left-color: var(--otro); }
|
||||
.stat.mini .stat-label { display: flex; align-items: center; gap: 6px; }
|
||||
.stat.mini .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
|
||||
.stat.mini.renta .dot { background: var(--renta); }
|
||||
.stat.mini.vr .dot { background: var(--vr); }
|
||||
.stat.mini.extra .dot { background: var(--extra); }
|
||||
.stat.mini.otro .dot { background: var(--otro); }
|
||||
.stat.mini .stat-value { font-size: 19px; margin-top: 3px; }
|
||||
|
||||
.section-label { font-size: 11px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.9px; margin: 0 0 12px 2px; display: flex; align-items: center; gap: 7px; }
|
||||
.btn-wide, .btn, .btn-save, .btn-cliente, .dup-banner button, .undo-fab, .btn-cobro, .btn-pagado, .btn-edit { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
|
||||
.ic { flex: 0 0 auto; vertical-align: middle; }
|
||||
@@ -340,6 +355,13 @@
|
||||
<div class="stat"><div class="stat-label">Interés moratorio</div><div class="stat-value warning" id="stat-mora">$0</div></div>
|
||||
</div>
|
||||
|
||||
<div class="summary-breakdown">
|
||||
<div class="stat mini renta"><div class="stat-label"><span class="dot"></span>Renta</div><div class="stat-value" id="stat-renta">$0</div></div>
|
||||
<div class="stat mini vr"><div class="stat-label"><span class="dot"></span>Valor residual</div><div class="stat-value" id="stat-vr">$0</div></div>
|
||||
<div class="stat mini extra"><div class="stat-label"><span class="dot"></span>Extraordinaria</div><div class="stat-value" id="stat-extra">$0</div></div>
|
||||
<div class="stat mini otro"><div class="stat-label"><span class="dot"></span>Otros</div><div class="stat-value" id="stat-otro">$0</div></div>
|
||||
</div>
|
||||
|
||||
<div class="view active" id="view-tarjetas">
|
||||
<div class="footer-actions top">
|
||||
<button class="btn-wide" onclick="abrirCrearRenglon()"><svg class="ic" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M5 12h14"/></svg> Agregar renglón</button>
|
||||
@@ -630,9 +652,21 @@ async function refrescarDuplicados(){
|
||||
function render(){ renderTarjetas(); renderTabla(); renderStats(); }
|
||||
function renderStats(){
|
||||
let total=0, mora=0;
|
||||
renglones.forEach(r => { total += Number(r.saldo)||0; mora += Number(r.moratorio)||0; });
|
||||
// Desglose del total (saldo pendiente) por tipo de cobro.
|
||||
const porTipo = { renta:0, vr:0, extra:0, otro:0 };
|
||||
renglones.forEach(r => {
|
||||
const saldo = Number(r.saldo)||0;
|
||||
total += saldo;
|
||||
mora += Number(r.moratorio)||0;
|
||||
const tipo = (r.tipo in porTipo) ? r.tipo : "otro"; // tipos desconocidos → Otros
|
||||
porTipo[tipo] += saldo;
|
||||
});
|
||||
document.getElementById("stat-total").textContent = fmtK(total);
|
||||
document.getElementById("stat-mora").textContent = fmtK(mora);
|
||||
document.getElementById("stat-renta").textContent = fmtK(porTipo.renta);
|
||||
document.getElementById("stat-vr").textContent = fmtK(porTipo.vr);
|
||||
document.getElementById("stat-extra").textContent = fmtK(porTipo.extra);
|
||||
document.getElementById("stat-otro").textContent = fmtK(porTipo.otro);
|
||||
}
|
||||
|
||||
function renderTarjetas(){
|
||||
|
||||
Reference in new issue
Block a user