feat: registration section preferences with show_in_registration filtering and deduplication
Add show_in_registration and registration_description columns to festival_sections. Registration form now shows deduplicated sections by name (across sub-events), filtered by show_in_registration=true, grouped by category with card-based UI. Section preferences use section_name instead of section_id. Add GET/PUT registration-settings endpoints for festival-level bulk management. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,26 +24,30 @@ final class PublicRegistrationDataController extends Controller
|
||||
|
||||
$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() || $festivalEvent->hasChildren()) {
|
||||
// Festival: get child event sections only (skip parent operational sections)
|
||||
$childIds = Event::where('parent_event_id', $festivalEvent->id)->pluck('id');
|
||||
|
||||
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 = FestivalSection::whereIn('event_id', $childIds)
|
||||
->where('show_in_registration', true)
|
||||
->where('type', 'standard')
|
||||
->select('id', 'name', 'category', 'icon', 'registration_description')
|
||||
->orderBy('category')
|
||||
->orderBy('sort_order')
|
||||
->get()
|
||||
->unique('name')
|
||||
->values();
|
||||
} else {
|
||||
// Flat event: all sections of the event
|
||||
$sections = FestivalSection::where('event_id', $festivalEvent->id)
|
||||
->where('show_in_registration', true)
|
||||
->where('type', 'standard')
|
||||
->select('id', 'name', 'category', 'icon', 'registration_description')
|
||||
->orderBy('category')
|
||||
->orderBy('sort_order')
|
||||
->get();
|
||||
}
|
||||
|
||||
$sections = $sectionQuery->get(['id', 'name', 'category', 'icon']);
|
||||
|
||||
$timeSlots = $festivalEvent->getAllRelevantTimeSlots()
|
||||
->where('person_type', 'VOLUNTEER')
|
||||
->values();
|
||||
@@ -62,6 +66,7 @@ final class PublicRegistrationDataController extends Controller
|
||||
'name' => $section->name,
|
||||
'category' => $section->category,
|
||||
'icon' => $section->icon,
|
||||
'registration_description' => $section->registration_description,
|
||||
]),
|
||||
'time_slots' => $timeSlots->map(fn (TimeSlot $slot) => [
|
||||
'id' => $slot->id,
|
||||
|
||||
Reference in New Issue
Block a user