import Link from "next/link"; interface LeadItem { id: string; number: string; status: "new" | "in_progress" | "converted" | "declined"; firstName: string | null; lastName: string | null; companyName: string | null; cargoDescription: string | null; createdAt: Date; responsible: { name: string } | null; } interface Column { status: LeadItem["status"]; label: string; } function toDateInputValue(date: Date): string { const d = new Date(date); return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`; } export function LeadsBoard({ leads, columns }: { leads: LeadItem[]; columns: Column[] }) { return (
{columns.map((col) => { const items = leads.filter((l) => l.status === col.status); return (

{col.label} {items.length}

{items.map((lead) => (
{lead.number}
{[lead.lastName, lead.firstName].filter(Boolean).join(" ") || lead.companyName || "Без имени"}
{lead.cargoDescription &&
{lead.cargoDescription}
}
{lead.responsible?.name ?? "—"} {toDateInputValue(lead.createdAt)}
))} {items.length === 0 &&

Пусто

}
); })}
); }