55 lines
1.9 KiB
JavaScript
55 lines
1.9 KiB
JavaScript
import { DYN, money2 } from "../../lib/constants";
|
|
|
|
// Tabla de detalle de ganadas — equivalente de tableWon() (assets/js/tables.js), sin el orden
|
|
// clicleable por encabezado (limitación conocida de esta v1).
|
|
export default function WonTable({ rows, title, locked }) {
|
|
const sorted = [...rows].sort((a, b) => (b.val ?? b.actual ?? 0) - (a.val ?? a.actual ?? 0));
|
|
return (
|
|
<div className="tw">
|
|
{title && (
|
|
<div className="tw-title">
|
|
<h3>{title}</h3>
|
|
<span className="tw-count">{sorted.length} oportunidades</span>
|
|
</div>
|
|
)}
|
|
<div className="ts">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Cliente</th>
|
|
<th>Oportunidad</th>
|
|
<th>Seg.</th>
|
|
{!locked && <th>Ejecutivo</th>}
|
|
<th>Tipo</th>
|
|
<th>Línea de Negocio</th>
|
|
<th>Origen</th>
|
|
<th className="num">MRR</th>
|
|
<th>Cierre</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{sorted.map((o) => (
|
|
<tr key={o.id}>
|
|
<td className="wrap-p">{o.cliente || "—"}</td>
|
|
<td className="wrap-p">
|
|
<a className="opp" href={`${DYN}${o.id}`} target="_blank" rel="noopener">{o.name}</a>
|
|
</td>
|
|
<td>
|
|
<span className={`pill ${o.segmento === "Cartera Activa" ? "cartera" : "nuevo"}`}>
|
|
{o.segmento === "Cartera Activa" ? "CA" : "CN"}
|
|
</span>
|
|
</td>
|
|
{!locked && <td>{o.owner}</td>}
|
|
<td>{o.tipo}</td>
|
|
<td>{o.linea}</td>
|
|
<td className="wrap-p">{o.origen}</td>
|
|
<td className="num">{money2(o.val ?? o.actual)}</td>
|
|
<td>{o.actualClose || o.cierre || "—"}</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|