feat: fix time slot hierarchy — seeder, API include_children, frontend dropdown, navigation

Restructure the festival hierarchy end-to-end:

Seeder: Remove duplicate festival-level VOLUNTEER time slots, keep only CREW
operational slots. Rename sub-events to "Dag 1/2/3 — ..." pattern. Change
Nachtsecurity to Security (cross_event). EHBO/Security shifts now use sub-event
time slots via cross_event exception. Add flat event "Braderie Dorpstown 2026".

API: Add ?include_children=true to TimeSlotController for festivals, returning
all sub-event time slots with source and event_name fields. Update
StoreShiftRequest and UpdateShiftRequest to accept child time slots for
cross_event sections.

Frontend: Create useTimeSlotDropdown composable with 4-scenario dropdown logic.
Replace AppSelect with VAutocomplete in CreateShiftDialog with grouped items,
dimmed festival slots, and info tooltips. Add InfoTooltip reusable component.
Show festival context labels on cross_event sections in sub-event section lists.
Add read-only festival time slots on sub-event time-slots page. Add cross_event
context banner with "Bekijk alle diensten" link.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-14 22:07:37 +02:00
parent acb7fb2c3a
commit 7bc0f1a0c7
16 changed files with 829 additions and 120 deletions

View File

@@ -234,4 +234,108 @@ class TimeSlotTest extends TestCase
$response->assertForbidden();
}
public function test_include_children_returns_sub_event_time_slots(): void
{
$festival = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'event_type' => 'festival',
]);
$subEvent1 = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'parent_event_id' => $festival->id,
]);
$subEvent2 = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'parent_event_id' => $festival->id,
]);
// 2 festival time slots
TimeSlot::factory()->count(2)->create(['event_id' => $festival->id]);
// 3 sub-event 1 time slots
TimeSlot::factory()->count(3)->create(['event_id' => $subEvent1->id]);
// 1 sub-event 2 time slot
TimeSlot::factory()->create(['event_id' => $subEvent2->id]);
Sanctum::actingAs($this->orgAdmin);
// Without include_children: only festival's own
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$festival->id}/time-slots");
$response->assertOk();
$this->assertCount(2, $response->json('data'));
// With include_children: festival + all sub-events
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$festival->id}/time-slots?include_children=true");
$response->assertOk();
$this->assertCount(6, $response->json('data'));
}
public function test_include_children_marks_source_and_event_name(): void
{
$festival = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'event_type' => 'festival',
'name' => 'Test Festival',
]);
$subEvent = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'parent_event_id' => $festival->id,
'name' => 'Day 1',
]);
TimeSlot::factory()->create(['event_id' => $festival->id, 'name' => 'Festival Slot']);
TimeSlot::factory()->create(['event_id' => $subEvent->id, 'name' => 'Sub Slot']);
Sanctum::actingAs($this->orgAdmin);
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$festival->id}/time-slots?include_children=true");
$response->assertOk();
$data = $response->json('data');
$festivalSlot = collect($data)->firstWhere('name', 'Festival Slot');
$subSlot = collect($data)->firstWhere('name', 'Sub Slot');
$this->assertEquals('own', $festivalSlot['source']);
$this->assertEquals('Test Festival', $festivalSlot['event_name']);
$this->assertEquals($subEvent->id, $subSlot['source']);
$this->assertEquals('Day 1', $subSlot['event_name']);
}
public function test_include_children_ignored_for_sub_events(): void
{
$festival = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'event_type' => 'festival',
]);
$subEvent = Event::factory()->create([
'organisation_id' => $this->organisation->id,
'parent_event_id' => $festival->id,
]);
TimeSlot::factory()->count(2)->create(['event_id' => $festival->id]);
TimeSlot::factory()->count(3)->create(['event_id' => $subEvent->id]);
Sanctum::actingAs($this->orgAdmin);
// include_children on a sub-event should have no effect
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$subEvent->id}/time-slots?include_children=true");
$response->assertOk();
$this->assertCount(3, $response->json('data'));
}
public function test_include_children_ignored_for_flat_events(): void
{
TimeSlot::factory()->count(3)->create(['event_id' => $this->event->id]);
Sanctum::actingAs($this->orgAdmin);
// include_children on a flat event should have no effect
$response = $this->getJson("/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/time-slots?include_children=true");
$response->assertOk();
$this->assertCount(3, $response->json('data'));
}
}