import Link from 'next/link'; import { getLeads, getResumen, type LeadFiltro } from '@/db/queries'; import { ESTADOS, ESTADO_BADGE, ESTADO_LABEL, PIPELINE_LABEL, PIPELINE_NEXT, formatEuros, formatFecha, } from '@/lib/funnel'; export const dynamic = 'force-dynamic'; const FILTROS: { value: LeadFiltro; label: string }[] = [ { value: 'todos', label: 'Todos' }, ...ESTADOS.map((e) => ({ value: e as LeadFiltro, label: ESTADO_LABEL[e] })), ]; export default async function PanelPage({ searchParams, }: { searchParams: Promise<{ estado?: string }>; }) { const { estado } = await searchParams; const filtro: LeadFiltro = (FILTROS.find((f) => f.value === estado)?.value ?? 'todos') as LeadFiltro; const [leads, resumen] = await Promise.all([getLeads(filtro), getResumen()]); return (
{resumen.total} leads en total ยท {resumen.porEstado['nuevo'] ?? 0} sin contactar
| Render | Cliente | Fecha | Estado | Presupuesto | Siguiente paso |
|---|---|---|---|---|---|
|
{l.renderUrl ? (
// eslint-disable-next-line @next/next/no-img-element
|
{l.nombre}
{l.telefono}
|
{formatFecha(l.createdAt)} | {ESTADO_LABEL[l.estado]} | {formatEuros(l.presupuestoEstimado)} |
{PIPELINE_LABEL[l.pipelineStage]}
{PIPELINE_NEXT[l.pipelineStage]}
|