feat(portal): multi-step volunteer registration form with public event endpoint

- Add GET /api/v1/public/events/{slug}/registration-data endpoint for fetching
  event sections and time slots without auth
- Create 5-step registration form: personal info, details, motivation, section
  preferences, availability
- VeeValidate + Zod validation per step with Dutch error messages
- Auth-aware: pre-fills name/email for authenticated users
- Mobile responsive with custom chip-based step indicator
- Success page with contextual actions (dashboard vs login)
- Types, composable (TanStack Query), and Zod schemas

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 18:41:20 +02:00
parent 60ea1f0b40
commit 3400e4cc7e
12 changed files with 1077 additions and 8 deletions

View File

@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Api\V1;
use App\Http\Controllers\Controller;
use App\Models\Event;
use App\Models\FestivalSection;
use App\Models\TimeSlot;
use Illuminate\Http\JsonResponse;
final class PublicRegistrationDataController extends Controller
{
public function __invoke(string $slug): JsonResponse
{
$event = Event::where('slug', $slug)
->where('status', 'registration_open')
->first();
if ($event === null) {
abort(404, 'Event not found or not accepting registrations.');
}
$festivalEvent = $event->isSubEvent() ? $event->parent : $event;
$sectionQuery = FestivalSection::where('event_id', $festivalEvent->id)
->where(function ($query) {
$query->where('type', '!=', 'cross_event')
->orWhereNull('type');
})
->ordered();
if ($festivalEvent->isFestival()) {
$childIds = $festivalEvent->children()->pluck('id');
$sectionQuery->orWhere(function ($query) use ($childIds) {
$query->whereIn('event_id', $childIds)
->where(function ($q) {
$q->where('type', '!=', 'cross_event')
->orWhereNull('type');
});
});
}
$sections = $sectionQuery->get(['id', 'name', 'category', 'icon']);
$timeSlots = $festivalEvent->getAllRelevantTimeSlots()
->where('person_type', 'VOLUNTEER')
->values();
return response()->json([
'data' => [
'event' => [
'id' => $festivalEvent->id,
'name' => $festivalEvent->name,
'start_date' => $festivalEvent->start_date->toDateString(),
'end_date' => $festivalEvent->end_date->toDateString(),
'organisation_id' => $festivalEvent->organisation_id,
],
'sections' => $sections->map(fn (FestivalSection $section) => [
'id' => $section->id,
'name' => $section->name,
'category' => $section->category,
'icon' => $section->icon,
]),
'time_slots' => $timeSlots->map(fn (TimeSlot $slot) => [
'id' => $slot->id,
'name' => $slot->name,
'date' => $slot->date->toDateString(),
'start_time' => $slot->start_time,
'end_time' => $slot->end_time,
'duration_hours' => $slot->duration_hours,
]),
],
]);
}
}