import React from 'react'; import { useForm, router } from '@inertiajs/react'; import { Head } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; interface RegisterProps { package?: { id: number; name: string; description: string; price: number; } | null; } export default function Register({ package: initialPackage }: RegisterProps) { const { data, setData, post, processing, errors } = useForm({ name: '', username: '', email: '', password: '', password_confirmation: '', first_name: '', last_name: '', address: '', phone: '', privacy_consent: false, package_id: initialPackage?.id || null, }); const submit = (e: React.FormEvent) => { e.preventDefault(); router.post('/register'); }; return (

Registrieren

{initialPackage && (

{initialPackage.name}

{initialPackage.description}

{initialPackage.price === 0 ? 'Kostenlos' : `${initialPackage.price} €`}

)}
setData('name', e.target.value)} className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Vollständiger Name" /> {errors.name &&

{errors.name}

}
setData('username', e.target.value)} className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Benutzername" /> {errors.username &&

{errors.username}

}
setData('email', e.target.value)} className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="email@example.com" /> {errors.email &&

{errors.email}

}
setData('first_name', e.target.value)} className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Vorname" /> {errors.first_name &&

{errors.first_name}

}
setData('last_name', e.target.value)} className="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm" placeholder="Nachname" /> {errors.last_name &&

{errors.last_name}

}