25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
|
|
import { gcDe, ETIQUETA_MODALIDAD } from "../../lib/gerencia";
|
||
|
|
import { localDeIso, minAHora } from "../../lib/agendador";
|
||
|
|
|
||
|
|
const ESTADO = { participo: "✓ Participó", participara: "◷ Participará" };
|
||
|
|
const hora = (a) => {
|
||
|
|
const iso = a.tipo === "Tarea" ? a.scheduledend : a.scheduledstart || a.scheduledend;
|
||
|
|
return iso ? minAHora(localDeIso(iso).min) : "";
|
||
|
|
};
|
||
|
|
|
||
|
|
// Celda «Gerencia Comercial» de una fila del plan: por cada actividad de la fila donde participa Gerencia, su estado
|
||
|
|
// (participó / participará) y su modalidad (presencial, virtual o llamada). «—» si no participa en ninguna.
|
||
|
|
export default function GerenciaCelda({ acts }) {
|
||
|
|
const items = (acts || []).map((a) => ({ a, g: gcDe(a) })).filter((x) => x.g);
|
||
|
|
if (!items.length) return <span className="gc-nada">—</span>;
|
||
|
|
return (
|
||
|
|
<span className="gc-celda">
|
||
|
|
{items.map(({ a, g }) => (
|
||
|
|
<span key={a.id} className={`gc-chip ${g.estado}`} title={`${a.tipo === "Cita" ? "Visita" : a.tipo}: ${a.asunto || ""}`}>
|
||
|
|
{ESTADO[g.estado]} · {ETIQUETA_MODALIDAD[g.modalidad] || a.tipo} {hora(a)}
|
||
|
|
</span>
|
||
|
|
))}
|
||
|
|
</span>
|
||
|
|
);
|
||
|
|
}
|