import { Head, Link } from '@inertiajs/react'; import type { Purchase } from '@/types'; import { Card, CardContent } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Trash2 } from 'lucide-react'; import { format } from 'date-fns'; import { id } from 'date-fns/locale'; import { DataTable } from '@/components/data-table'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogTitle, } from "@/components/ui/alert-dialog" import purchaseRoutes from '@/routes/purchase'; import { usePurchaseIndex } from './hooks/use-purchase-index'; import { getColumns } from './partials/columns'; export default function PurchaseIndex({ purchases }: { purchases: Purchase[] }) { const { isDeleteDialogOpen, isBulkDeleteDialogOpen, purchaseToDelete, rowsToDelete, rowSelection, setRowSelection, setRowsToDelete, setIsDeleteDialogOpen, setIsBulkDeleteDialogOpen, onDelete, confirmDelete, confirmBulkDelete, } = usePurchaseIndex(); const columns = getColumns({ onDelete }); return (