informe-comercial-alfa/app/components/plan/SinActividadPanel.js

65 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { money, registroUrl, nuevaActividadUrl, TIPOS_NUEVA_ACTIVIDAD } from "../../lib/constants";
import { COD_RENOVACION, objetivoSugerido } from "../../lib/plan";
const fechaTxt = (iso) => iso.split("-").reverse().join("/");
// Huecos de planificación: oportunidades con cierre estimado en el período y sin actividad agendada,
// con un botón por tipo (Tarea / Cita / Llamada) que abre el formulario nuevo en Dynamics ya ligado a
// la oportunidad. Solo pantalla (no va en el PDF). Compartido por Plan del Día y Plan de Actividades.
export default function SinActividadPanel({ filas, titulo, hint, vacio }) {
return (
<section className="panel plan-sin no-print">
<h3>{titulo} ({filas.length})</h3>
<p className="hint">{hint}</p>
{filas.length ? (
<div className="ts" style={{ maxHeight: 460, overflowY: "auto" }}>
<table>
<thead>
<tr>
<th>Ejecutivo</th>
<th>Cliente</th>
<th>Tipo</th>
<th className="num">Valor estimado</th>
<th>Cierre estimado</th>
<th>Forecast</th>
<th>Objetivo sugerido</th>
<th>Agendar</th>
</tr>
</thead>
<tbody>
{filas.map((o) => (
<tr key={o.id}>
<td>{o.owner}</td>
<td>
<a className="opp" href={registroUrl("opportunity", o.id)} target="_blank" rel="noopener">
{o.cliente || o.nombre || "—"}
</a>
{o.prioridadAlta && <span className="plan-prio" title="Forecast 80% o 90%: lo más cercano al cierre">Prioridad</span>}
</td>
<td>{COD_RENOVACION.has(o.tipoCodigo) ? "Renovación" : "Venta"}</td>
<td className="num">{money(o.valor)}</td>
<td>{fechaTxt(o.cierre)}</td>
<td>{o.forecast || "—"}</td>
<td className="plan-sugerido" title="Guía según la etapa de forecast; al agendar, elige este objetivo en la actividad">
{objetivoSugerido(o) || "—"}
</td>
<td>
<span className="plan-agenda-btns">
{TIPOS_NUEVA_ACTIVIDAD.map((t) => (
<a key={t.etn} className="plan-agendar" href={nuevaActividadUrl(o, t.etn)} target="_blank" rel="noopener" title={t.ayuda}>
+ {t.label}
</a>
))}
</span>
</td>
</tr>
))}
</tbody>
</table>
</div>
) : (
<p className="hint" style={{ margin: 0 }}>✓ {vacio}</p>
)}
</section>
);
}