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:
@@ -444,4 +444,86 @@ class ShiftTest extends TestCase
|
||||
|
||||
$response->assertForbidden();
|
||||
}
|
||||
|
||||
public function test_create_shift_with_parent_festival_time_slot_succeeds(): 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,
|
||||
]);
|
||||
$festivalSlot = TimeSlot::factory()->create(['event_id' => $festival->id]);
|
||||
$subSection = FestivalSection::factory()->create(['event_id' => $subEvent->id, 'type' => 'standard']);
|
||||
|
||||
Sanctum::actingAs($this->orgAdmin);
|
||||
|
||||
$response = $this->postJson(
|
||||
"/api/v1/organisations/{$this->organisation->id}/events/{$subEvent->id}/sections/{$subSection->id}/shifts",
|
||||
[
|
||||
'time_slot_id' => $festivalSlot->id,
|
||||
'title' => 'Opbouw shift',
|
||||
'slots_total' => 5,
|
||||
'slots_open_for_claiming' => 0,
|
||||
],
|
||||
);
|
||||
|
||||
$response->assertCreated();
|
||||
}
|
||||
|
||||
public function test_create_shift_in_cross_event_section_with_child_time_slot_succeeds(): 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,
|
||||
]);
|
||||
$subEventSlot = TimeSlot::factory()->create(['event_id' => $subEvent->id]);
|
||||
$crossSection = FestivalSection::factory()->create([
|
||||
'event_id' => $festival->id,
|
||||
'type' => 'cross_event',
|
||||
]);
|
||||
|
||||
Sanctum::actingAs($this->orgAdmin);
|
||||
|
||||
$response = $this->postJson(
|
||||
"/api/v1/organisations/{$this->organisation->id}/events/{$festival->id}/sections/{$crossSection->id}/shifts",
|
||||
[
|
||||
'time_slot_id' => $subEventSlot->id,
|
||||
'title' => 'EHBO Post',
|
||||
'slots_total' => 3,
|
||||
'slots_open_for_claiming' => 2,
|
||||
],
|
||||
);
|
||||
|
||||
$response->assertCreated();
|
||||
}
|
||||
|
||||
public function test_create_shift_with_unrelated_event_time_slot_fails_422(): void
|
||||
{
|
||||
$unrelatedEvent = Event::factory()->create([
|
||||
'organisation_id' => $this->organisation->id,
|
||||
]);
|
||||
$unrelatedSlot = TimeSlot::factory()->create(['event_id' => $unrelatedEvent->id]);
|
||||
|
||||
Sanctum::actingAs($this->orgAdmin);
|
||||
|
||||
$response = $this->postJson(
|
||||
"/api/v1/organisations/{$this->organisation->id}/events/{$this->event->id}/sections/{$this->section->id}/shifts",
|
||||
[
|
||||
'time_slot_id' => $unrelatedSlot->id,
|
||||
'title' => 'Invalid shift',
|
||||
'slots_total' => 1,
|
||||
'slots_open_for_claiming' => 0,
|
||||
],
|
||||
);
|
||||
|
||||
$response->assertUnprocessable()
|
||||
->assertJsonValidationErrors('time_slot_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user