import { Badge } from '@/components/ui/badge'; import { ColumnDef } from '@tanstack/react-table'; import { format } from 'date-fns'; const TableColumn = (): ColumnDef[] => { return [ { accessorKey: 'id', header: () =>
ID
, cell: ({ row }) =>
#{row.original.id}
, }, { accessorKey: 'user.name', header: 'Customer', cell: ({ row }) => (
{row.original.user.name}
{row.original.user.email}
), }, { accessorKey: 'purchase.title', header: 'Item', cell: ({ row }) =>
{row.original.purchase?.title || 'N/A'}
, }, { accessorKey: 'amount', header: 'Amount', cell: ({ row }) =>
${Number(row.original.amount).toFixed(2)}
, }, { accessorKey: 'payment_type', header: 'Payment Method', cell: ({ row }) => ( {row.original.payment_type} ), }, { accessorKey: 'transaction_id', header: 'Transaction ID', cell: ({ row }) =>
{row.original.transaction_id}
, }, { accessorKey: 'created_at', header: () =>
Date
, cell: ({ row }) =>
{format(new Date(row.original.created_at), 'MMM dd, yyyy HH:mm')}
, }, ]; }; export default TableColumn;