import { DataTable } from '@/components/data-table'; import { DeleteConfirmation } from '@/components/modal/delete-confirmation'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import userRoutes from '@/routes/user'; import type { User } from '@/types'; import { Head, Link } from '@inertiajs/react'; import { KeyRound, Plus, Trash2, X } from 'lucide-react'; import { usePermission } from '@/hooks/use-permission'; import { useUserIndex } from './hooks/use-user-index'; import { getColumns } from './partials/columns'; export default function UserIndex({ users, defaultPassword }: { users: User[], defaultPassword: string }) { const { hasPermission } = usePermission(); const { isDeleteDialogOpen, isBulkDeleteDialogOpen, userToDelete, isResetPasswordOpen, userToReset, rowsToDelete, rowSelection, setRowSelection, setRowsToDelete, setIsDeleteDialogOpen, setIsBulkDeleteDialogOpen, setIsResetPasswordOpen, onResetPassword, confirmResetPassword, onDelete, confirmDelete, confirmBulkDelete, } = useUserIndex(); const columns = getColumns({ onResetPassword, onDelete }).filter( (col) => col.id !== 'actions' || hasPermission('Edit:User') || hasPermission('Delete:User') || hasPermission('ResetPassword:User') ); return (