Files
crewli/api/app/Http/Requests/Api/V1/UpdateShiftRequest.php
bert.hausmans 7bc0f1a0c7 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>
2026-04-14 22:07:37 +02:00

59 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Requests\Api\V1;
use App\Models\Event;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
final class UpdateShiftRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
/** @return array<string, mixed> */
public function rules(): array
{
return [
'time_slot_id' => ['sometimes', 'ulid', Rule::exists('time_slots', 'id')->where(function ($query) {
$event = $this->route('event');
$section = $this->route('section');
$eventIds = [$event->id];
// Sub-event: also accept parent festival time slots
if ($event->isSubEvent() && $event->parent_event_id) {
$eventIds[] = $event->parent_event_id;
}
// Cross_event section: also accept all sub-event time slots
if ($section && $section->type === 'cross_event') {
$childIds = Event::where('parent_event_id', $event->id)
->pluck('id')->toArray();
$eventIds = array_merge($eventIds, $childIds);
}
$query->whereIn('event_id', $eventIds);
})],
'location_id' => ['nullable', 'ulid', Rule::exists('locations', 'id')->where('event_id', $this->route('event')->id)],
'title' => ['nullable', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'instructions' => ['nullable', 'string'],
'coordinator_notes' => ['nullable', 'string'],
'slots_total' => ['sometimes', 'integer', 'min:1'],
'slots_open_for_claiming' => ['sometimes', 'integer', 'min:0'],
'report_time' => ['nullable', 'date_format:H:i'],
'actual_start_time' => ['nullable', 'date_format:H:i'],
'actual_end_time' => ['nullable', 'date_format:H:i'],
'end_date' => ['nullable', 'date'],
'is_lead_role' => ['nullable', 'boolean'],
'allow_overlap' => ['nullable', 'boolean'],
'events_during_shift' => ['nullable', 'array'],
'status' => ['sometimes', 'in:draft,open,full,in_progress,completed,cancelled'],
];
}
}