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:
2026-04-10 20:03:54 +02:00
parent 3400e4cc7e
commit c21bc085e9
22 changed files with 1443 additions and 104 deletions

View File

@@ -35,11 +35,20 @@ class PublicRegistrationDataTest extends TestCase
$section = FestivalSection::factory()->create([
'event_id' => $event->id,
'type' => 'standard',
'show_in_registration' => true,
'registration_description' => 'Test description',
]);
FestivalSection::factory()->create([
'event_id' => $event->id,
'type' => 'cross_event',
'show_in_registration' => true,
]);
FestivalSection::factory()->create([
'event_id' => $event->id,
'type' => 'standard',
'show_in_registration' => false,
]);
$timeSlot = TimeSlot::factory()->create([
@@ -82,4 +91,112 @@ class PublicRegistrationDataTest extends TestCase
$response->assertNotFound();
}
public function test_includes_registration_description_in_sections(): void
{
$event = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'status' => 'registration_open',
'slug' => 'desc-event',
]);
FestivalSection::factory()->create([
'event_id' => $event->id,
'type' => 'standard',
'show_in_registration' => true,
'registration_description' => 'Tap bier en drankjes',
]);
$response = $this->getJson('/api/v1/public/events/desc-event/registration-data');
$response->assertOk()
->assertJsonPath('data.sections.0.registration_description', 'Tap bier en drankjes');
}
public function test_excludes_sections_with_show_in_registration_false(): void
{
$event = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'status' => 'registration_open',
'slug' => 'filter-event',
]);
FestivalSection::factory()->create([
'event_id' => $event->id,
'type' => 'standard',
'show_in_registration' => false,
]);
$response = $this->getJson('/api/v1/public/events/filter-event/registration-data');
$response->assertOk()
->assertJsonCount(0, 'data.sections');
}
public function test_festival_deduplicates_sections_by_name(): void
{
$festival = Event::factory()->festival()->create([
'organisation_id' => $this->organisation->id,
'status' => 'registration_open',
'slug' => 'dedup-festival',
]);
$sub1 = Event::factory()->subEvent($festival)->create(['status' => 'registration_open']);
$sub2 = Event::factory()->subEvent($festival)->create(['status' => 'registration_open']);
$sub3 = Event::factory()->subEvent($festival)->create(['status' => 'published']);
// Same section name across 3 sub-events
foreach ([$sub1, $sub2, $sub3] as $sub) {
FestivalSection::factory()->create([
'event_id' => $sub->id,
'name' => 'Hoofdpodium Bar',
'type' => 'standard',
'show_in_registration' => true,
'category' => 'Bar',
]);
}
TimeSlot::factory()->create(['event_id' => $sub1->id, 'person_type' => 'VOLUNTEER']);
$response = $this->getJson('/api/v1/public/events/dedup-festival/registration-data');
$response->assertOk()
->assertJsonCount(1, 'data.sections')
->assertJsonPath('data.sections.0.name', 'Hoofdpodium Bar');
}
public function test_festival_excludes_parent_operational_sections(): void
{
$festival = Event::factory()->festival()->create([
'organisation_id' => $this->organisation->id,
'status' => 'registration_open',
'slug' => 'parent-ops-festival',
]);
$sub = Event::factory()->subEvent($festival)->create(['status' => 'registration_open']);
// Parent operational section (should be excluded)
FestivalSection::factory()->create([
'event_id' => $festival->id,
'name' => 'Terreinploeg',
'type' => 'standard',
'show_in_registration' => true,
]);
// Sub-event section (should be included)
FestivalSection::factory()->create([
'event_id' => $sub->id,
'name' => 'Bar',
'type' => 'standard',
'show_in_registration' => true,
]);
TimeSlot::factory()->create(['event_id' => $sub->id, 'person_type' => 'VOLUNTEER']);
$response = $this->getJson('/api/v1/public/events/parent-ops-festival/registration-data');
$response->assertOk()
->assertJsonCount(1, 'data.sections')
->assertJsonPath('data.sections.0.name', 'Bar');
}
}