informe-comercial-alfa/app/m/components/Tarjeta.js

29 lines
1.4 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.

"use client";
import { useCampo } from "../CampoContext";
import { ICONO_TIPO, ROTULO_TIPO } from "../../lib/agendaDia";
import { money } from "../../lib/constants";
// Tarjeta de UNA actividad: hora, cliente, tipo · objetivo · MRR. Tocarla abre la hoja de acciones.
export default function Tarjeta({ it, conOwner = false, conDia = false }) {
const { abrirActividad } = useCampo();
const cls = ["m-card", it.completada ? "hecha" : "", it.vencida ? "venc" : "", it.cruce ? "cruce" : ""].filter(Boolean).join(" ");
return (
<button type="button" className={cls} data-sec={it.sec} onClick={() => abrirActividad(it)}>
<span className="m-h">
<b>{it.completada ? "✓ " : ""}{it.hora || "—"}</b>
<small>{it.vencida ? "vencida" : it.esTarea ? "tarea" : it.dur ? `${it.dur} min` : ""}</small>
</span>
<span className="m-c">
<b>{it.cliente}</b>
<small>
{ICONO_TIPO[it.tipo]} {ROTULO_TIPO[it.tipo]} · {it.objetivo}{it.valor != null ? ` · ${money(it.valor)}` : ""}
{it.gv.map((g) => <em key={g.k} className={`m-gv ${g.k}`}>{g.txt}</em>)}
</small>
{conOwner && <small className="m-own">{it.owner}</small>}
{conDia && it.oppNombre && <small className="m-own">{it.oppNombre}</small>}
{it.cruce && <small className="m-warn">⚠ se cruza con la {it.cruce}</small>}
</span>
<span className="m-chev" aria-hidden="true">›</span>
</button>
);
}