import { auth } from "../lib/auth";
import { ownerFilter } from "../lib/authz";
import { getClosed, getMotivosCierre, getSystemUsers } from "../lib/queries";
import { agg, EJECUTIVOS_VENTA } from "../lib/derive";
import LoginPrompt from "../components/LoginPrompt";
import OwnerControl from "../components/OwnerControl";
import ErrorNotice from "../components/ErrorNotice";
import Panel from "../components/pipeline/Panel";
import FilterChips from "../components/FilterChips";
import { DYN, money, money2 } from "../lib/constants";
import { parseFiltParam, applyFilt } from "../lib/filterState";
export const dynamic = "force-dynamic";
const DIM_LABELS = { motivo: "Motivo", competidor: "Competidor", servicio: "Servicio", origen: "Origen", owner: "Ejecutivo" };
function currentMonth() {
const d = new Date();
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}`;
}
export default async function PerdemosPage({ searchParams }) {
const session = await auth();
if (!session?.email) return
No hay seguimiento registrado en el CRM ≠ no hubo seguimiento — la mayoría del contacto comercial se hace por WhatsApp, que no está integrado a Dynamics (ver CLAUDE.md).
Clic en el nombre abre la oportunidad en Dynamics 365
No hay oportunidades perdidas en este período para este filtro.
) : (| Cliente | Oportunidad | Seg. | Motivo de cierre | Línea de Negocio | Competidor | {!scope.locked &&Ejecutivo | }MRR est. |
|---|---|---|---|---|---|---|---|
| {o.cliente || "—"} | {o.name} | {o.segmento === "Cartera Activa" ? "CA" : "CN"} | {o.motivo} | {o.linea || "—"} | {o.competidor || "—"} | {!scope.locked &&{o.owner} | }{o.est ? money2(o.est) : "—"} |