import type { ColumnDef } from "@tanstack/react-table"; import { Wrench } from "lucide-react"; import Link from "next/link"; import { DataTable } from "~/components/custom_ui/data-table"; import { DataTableColumnHeader } from "~/components/custom_ui/dataTable-header"; import type { PinnedFiltro, SearchFiltro, } from "~/components/custom_ui/dataTable-toolbar"; import { Button } from "~/components/ui/button"; import { StatusBadge } from "~/pages/area-riservata/admin/edit-annuncio/[id]"; import type { Annunci } from "~/schemas/public/Annunci"; export const AnnunciTable = ({ data, }: { data: Pick< Annunci, "id" | "codice" | "titolo_it" | "comune" | "tipo" | "locatore" | "stato" >[]; }) => { const tabledata = data.map((row) => { return { actions: "Azioni", codice: row.codice, comune: row.comune, id: row.id, locatore: row.locatore, stato: row.stato, tipo: row.tipo, titolo_it: row.titolo_it, }; }); const columns_titles = { actions: "Azioni", codice: "Codice", comune: "Comune", locatore: "Locatore", stato: "Stato", tipo: "Tipo", titolo_it: "Titolo", }; type Column = (typeof tabledata)[number]; const columns: ColumnDef[] = [ { accessorKey: "actions", cell: ({ row }) => { return ( ); }, enableHiding: false, enableSorting: false, header: ({ column }) => ( ), }, { accessorKey: "codice", header: ({ column }) => ( ), }, { accessorKey: "stato", cell: ({ row }) => { return ; }, header: ({ column }) => ( ), }, { accessorKey: "titolo_it", header: ({ column }) => ( ), }, { accessorKey: "comune", header: ({ column }) => ( ), }, { accessorKey: "tipo", header: ({ column }) => ( ), }, { accessorKey: "locatore", header: ({ column }) => ( ), }, ]; const searchFiltro: SearchFiltro = { columnName: "codice", placeholder: "Filtra codice...", }; const pinnedFiltri: PinnedFiltro[] = [ { columnName: "stato", options: [ { label: "Attivo", value: "Attivo" }, { label: "Sospeso", value: "Sospeso", }, { label: "Trattativa", value: "Trattativa", }, ], title: "Stato", }, ]; return (
); };