import { ColumnDef } from '@tanstack/react-table'; import { Purchase } from '@/types'; import { DataTableColumnHeader } from '@/components/data-table-column-header'; import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; import { Button } from '@/components/ui/button'; import { Pencil, Trash2 } from 'lucide-react'; import { Link } from '@inertiajs/react'; import purchaseRoutes from '@/routes/purchase'; import { format } from 'date-fns'; import { id } from 'date-fns/locale'; interface ColumnProps { onDelete: (purchase: Purchase) => void; } export const getColumns = ({ onDelete }: ColumnProps): ColumnDef[] => [ { accessorKey: "purchase_date", header: ({ column }) => ( ), cell: ({ row }) => { const date = row.original.purchase_date; return format(new Date(date), 'dd MMMM yyyy', { locale: id }); }, meta: { title: "Tanggal" }, }, { accessorKey: "note", header: "Catatan", cell: ({ row }) => ( {row.original.note || '-'} ), meta: { title: "Catatan" }, }, { id: "actions", header: "Aksi", cell: ({ row }) => { const purchase = row.original; return (

Ubah

Hapus

); }, meta: { title: "Aksi" }, }, ];