La carpeta con .git (C:\Mis Aplicaciones\informe-comercial) quedó desactualizada frente a lo que corre hoy en Coolify (deploy directo por Foundry desde esta carpeta, sin paso por git). Este commit fija esta carpeta como fuente de verdad del repo, con Renovaciones, Actividades, Agenda, Admin/Metas y Nuevas Oportunidades que la copia vieja no tenía. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
56 lines
2.5 KiB
JavaScript
56 lines
2.5 KiB
JavaScript
import { money } from "../../lib/constants";
|
|
|
|
// Barras Gana/Pierde apiladas por categoría + motivo de pérdida más frecuente — puerto de
|
|
// comparePanelMotivo() (App Informe/assets/js/tables.js). `cats` viene de catsWonLost() (derive.js).
|
|
export default function ComparePanelMotivo({ title, hint, cats }) {
|
|
const max = Math.max(...cats.flatMap((c) => [c.ganaV, c.pierdeV]), 0.1);
|
|
const fmtV = (v) => (v < 20 ? `$${v.toFixed(2)}` : money(v));
|
|
|
|
return (
|
|
<div className="panel">
|
|
<h3>{title}</h3>
|
|
<p className="hint">{hint}</p>
|
|
{cats.length === 0 ? (
|
|
<p className="hint">Sin datos en este período.</p>
|
|
) : (
|
|
cats.map((c) => (
|
|
<div key={c.k} style={{ padding: "7px 4px", borderBottom: "1px solid var(--linea)" }}>
|
|
<div style={{ fontSize: 12.5, marginBottom: 5, fontWeight: 700 }}>{c.k}</div>
|
|
<div style={{ display: "flex", alignItems: "center", gap: 8, marginBottom: 3 }}>
|
|
<span style={{ fontSize: 10, color: "var(--gana)", width: 52 }}>Gana</span>
|
|
<div className="bar-cell">
|
|
<div className="bar-fill" style={{ width: `${((c.ganaV / max) * 100).toFixed(1)}%` }} />
|
|
</div>
|
|
<span className="v">
|
|
{fmtV(c.ganaV)}
|
|
<span style={{ color: "var(--tinta-suave)" }}> ({c.ganaN})</span>
|
|
</span>
|
|
</div>
|
|
<div style={{ display: "flex", alignItems: "center", gap: 8 }}>
|
|
<span style={{ fontSize: 10, color: "var(--pierde)", width: 52 }}>Pierde</span>
|
|
<div className="bar-cell">
|
|
<div className="bar-fill pierde" style={{ width: `${((c.pierdeV / max) * 100).toFixed(1)}%` }} />
|
|
</div>
|
|
<span className="v">
|
|
{fmtV(c.pierdeV)}
|
|
<span style={{ color: "var(--tinta-suave)" }}> ({c.pierdeN})</span>
|
|
</span>
|
|
</div>
|
|
{(c.topMotivo || c.depu > 0) && (
|
|
<p className="hint" style={{ margin: "4px 0 0" }}>
|
|
{c.topMotivo ? (
|
|
<>
|
|
Motivo principal de pérdida: <b>{c.topMotivo}</b> ({c.topMotivoN} de {c.pierdeN})
|
|
{c.depu ? ` · ${c.depu} más son depuración sin motivo real` : ""}
|
|
</>
|
|
) : (
|
|
<>{c.depu} de {c.pierdeN} pérdidas son depuración sin motivo real — no hay una razón de negocio clara aquí</>
|
|
)}
|
|
</p>
|
|
)}
|
|
</div>
|
|
))
|
|
)}
|
|
</div>
|
|
);
|
|
}
|