import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { ColumnDef } from '@tanstack/react-table'; import { format } from 'date-fns'; import { CheckCircle2, Clock, Eye, XCircle } from 'lucide-react'; const TableColumn = (onVerifyClick: (payment: PaymentHistory) => void): 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: 'meta.payment_date', header: 'Payment Date', cell: ({ row }) => (
{row.original.meta?.payment_date ? format(new Date(row.original.meta.payment_date as string), 'MMM dd, yyyy') : 'N/A'}
), }, { accessorKey: 'meta.status', header: 'Status', cell: ({ row }) => { const status = row.original.meta?.status || 'pending'; return ( {status === 'verified' ? ( ) : status === 'rejected' ? ( ) : ( )} {status as string} ); }, }, { accessorKey: 'created_at', header: 'Submitted At', cell: ({ row }) =>
{format(new Date(row.original.created_at), 'MMM dd, yyyy HH:mm')}
, }, { id: 'actions', header: () =>
Actions
, cell: ({ row }) => { const status = row.original.meta?.status || 'pending'; return (
); }, }, ]; }; export default TableColumn;