import { ColumnDef } from "@tanstack/react-table"; import { Download, Eye, Trash2, } from "lucide-react"; import { Checkbox } from "@/components/ui/checkbox"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Badge } from "@/components/ui/badge"; import { cn } from "@/lib/utils"; import { Link } from '@/i18n/routing'; export type DataProps = { id: string | number; order: number; date: string; quantity: number; amount: string; delivery: string; status: "paid" | "due" | "canceled"; action: React.ReactNode; }; export const columns: ColumnDef[] = [ { id: "select", header: ({ table }) => ( table.toggleAllPageRowsSelected(!!value)} aria-label="Select all" className="bg-default-100" /> ), cell: ({ row }) => (
row.toggleSelected(!!value)} aria-label="Select row" className="bg-default-100" />
), enableSorting: false, enableHiding: false, }, { accessorKey: "order", header: "Order", cell: ({ row }) => {row.getValue("order")}, }, { accessorKey: "date", header: "Date", cell: ({ row }) => { return {row.getValue("date")}; }, }, { accessorKey: "amount", header: "Amount", cell: ({ row }) => { return {row.getValue("amount")}; }, }, { accessorKey: "delivery", header: "Delivery Status", cell: ({ row }) => { return {row.getValue("delivery")}; }, }, { accessorKey: "status", header: "Payment Status", cell: ({ row }) => { const statusColors: Record = { paid: "bg-success/20 text-success", due: "bg-warning/20 text-warning", canceled: "bg-destructive/20 text-destructive", }; const status = row.getValue("status"); const statusStyles = statusColors[status] || "default"; return ( {status}{" "} ); }, }, { id: "actions", accessorKey: "action", header: "Actions", enableHiding: false, cell: ({ row }) => { return (
); }, }, ];