import type { ColumnDef } from '@tanstack/react-table'; import { ArrowUpDown, Pencil, Trash2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip'; import { formatCurrency } from '@/lib/utils'; export type CashAccount = { id: number; name: string; balance: number; }; type CreateColumnsParams = { handleEdit: (cashAccount: CashAccount) => void; handleDeleteClick: (cashAccount: CashAccount) => void; }; export function createCashAccountColumns( params: CreateColumnsParams, ): ColumnDef[] { const { handleEdit, handleDeleteClick } = params; return [ { id: 'no', header: () => No, cell: ({ row }) => ( {row.index + 1} ), meta: { className: 'w-[50px] text-center', headerClassName: 'w-[50px] text-center', }, }, { accessorKey: 'name', header: ({ column }) => ( ), cell: ({ row }) => ( {row.getValue('name') as string} ), }, { accessorKey: 'balance', header: ({ column }) => ( ), cell: ({ row }) => ( {formatCurrency(row.getValue('balance') as number)} ), }, { id: 'actions', header: () => Aksi, meta: { className: 'w-[100px] text-center', headerClassName: 'w-[100px] text-center', }, cell: ({ row }) => { const cashAccount = row.original; return (
Edit Hapus
); }, }, ]; }