import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout';
import { Head, Link, useForm } from '@inertiajs/react';
import { Shield, ArrowLeft, Check, AlertCircle } from 'lucide-react';
import { Button } from '@/Components/ui/button';
import { Input } from '@/Components/ui/input';
import { Label } from '@/Components/ui/label';
import { FormEvent } from 'react';
import PermissionSelector, { GroupedPermission } from './PermissionSelector';
interface Role {
id: number;
name: string;
display_name: string;
}
interface Props {
role: Role;
groupedPermissions: GroupedPermission[];
currentPermissions: string[];
}
export default function RoleEdit({ role, groupedPermissions, currentPermissions }: Props) {
const { data, setData, put, processing, errors } = useForm({
name: role.name,
display_name: role.display_name || '',
permissions: currentPermissions,
});
const handleSubmit = (e: FormEvent) => {
e.preventDefault();
put(route('roles.update', role.id));
};
return (