Actualizar frontend/src/pages/Leads.jsx

This commit is contained in:
2026-09-04 16:10:06 -05:00
parent 0d09be8e4e
commit e1f25c4724

View File

@@ -9,7 +9,7 @@ import {
const MESES = ["ENERO","FEBRERO","MARZO","ABRIL","MAYO","JUNIO","JULIO","AGOSTO","SEPTIEMBRE","OCTUBRE","NOVIEMBRE","DICIEMBRE"];
export default function Leads() {
export default function Leads({ irAPrograma } = {}) {
const hoy = new Date();
const [ano, setAno] = useState(String(hoy.getFullYear()));
const [mes, setMes] = useState(String(hoy.getMonth() + 1));
@@ -49,6 +49,7 @@ export default function Leads() {
{ key: "fecha_inicio", label: "Fecha Inicio", w: 110, modo: "fija" },
{ key: "importe_pauta", label: "Importe Pauta", w: 120, modo: "fija", bold: true, render: (c) => _fmtMoney(c.importe_pauta) },
{ key: "importe_pauta_mes", label: "Importe Pauta en el Mes", w: 150, modo: "fija", bold: true, render: (c) => _fmtMoney(c.importe_pauta_mes) },
{ key: "resultados_pauta", label: "Leads Meta", w: 110, modo: "fija", bold: true, render: (c) => Number(c.resultados_pauta || 0).toLocaleString("en-US") },
{ key: "cartera_total", label: "Cartera Total", w: 110, modo: "total" },
{ key: "cartera_total_asig", label: "Cartera Total Asig.", w: 130, modo: "asig", bold: true },
{ key: "leads_nuevos", label: "L. Recibidos", w: 120, modo: "total" },
@@ -111,7 +112,10 @@ export default function Leads() {
try {
await api.guardarPauta(modalCurso.num_indice, editPauta.trim(), editConj || null, editContar);
setMsgGuardar("✓ Guardado. Refrescando datos...");
setTimeout(() => { setModalCurso(null); setEditando(false); setReload((n) => n + 1); }, 800);
setTimeout(() => {
setModalCurso(null); setEditando(false); setReload((n) => n + 1);
window.dispatchEvent(new Event("datos-actualizar")); // avisa a TODOS los apartados
}, 800);
} catch (e) {
setMsgGuardar("Error al guardar: " + e.message);
} finally { setGuardando(false); }
@@ -469,7 +473,17 @@ export default function Leads() {
{abierto ? "−" : "+"}
</span>
)}
{irAPrograma && c.dsc_det_programa ? (
<span
onClick={() => irAPrograma({ ano, mes, programa: c.dsc_det_programa })}
onMouseEnter={(e) => { e.currentTarget.style.color = "#1d4ed8"; e.currentTarget.style.textDecoration = "underline"; }}
onMouseLeave={(e) => { e.currentTarget.style.color = "inherit"; e.currentTarget.style.textDecoration = "none"; }}
style={{ cursor: "pointer", color: "inherit", textDecoration: "none",
textUnderlineOffset: 3, transition: "color .12s" }}
title="Ver este curso en el apartado Programa">
{c.personalizado}
</span>
) : c.personalizado}
</td>
) : col.ver ? (
<td key={col.key} style={{ textAlign: "center" }}>
@@ -494,7 +508,7 @@ export default function Leads() {
);
if (col.ver) return <td key={col.key}></td>;
// Estas columnas -> "-" en subfilas (Importe y Leads Recibidos/Procesados)
const GUION = ["importe_pauta", "importe_pauta_mes",
const GUION = ["importe_pauta", "resultados_pauta", "importe_pauta_mes",
"leads_nuevos", "leads_nuevos_asesor",
"leads_nuevos_mes", "leads_nuevos_mes_asesor"];
if (GUION.includes(col.key)) return (