{{-- Vue Gantt pour une heure avec gestion des chevauchements --}} @props(['hour', 'layout', 'selectedDate', 'overlapMode' => 'allowed_with_warning', 'allAppointments' => collect()]) @php $timeLabel = sprintf('%dh', $hour); $tracks = isset($layout[$hour]) ? $layout[$hour] : []; $hasAppointments = count($tracks) > 0; $statusColors = [ 'scheduled' => 'text-blue-600', 'in_progress' => 'text-orange-600', 'complete' => 'text-green-600', 'cancelled' => 'text-red-600', 'late' => 'text-red-600', ]; @endphp
{{ $timeLabel }}
{{-- Grille de fond avec créneaux de 15min cliquables (toujours présente) --}}
@foreach([0, 15, 30, 45] as $min) @php $timeSlot = sprintf('%02d:%02d', $hour, $min); $slotStart = $selectedDate->copy()->setTime($hour, $min, 0); $slotEnd = $slotStart->copy()->addMinutes(15); $isBlocked = false; if ($overlapMode !== 'allowed' and $overlapMode !== 'allowed_with_warning') { foreach ($allAppointments as $apt) { $aptStart = \Carbon\Carbon::parse($apt->start_time); $aptEnd = \Carbon\Carbon::parse($apt->end_time); if ($slotStart->lessThan($aptEnd) && $slotEnd->greaterThan($aptStart)) { $isBlocked = true; break; } } } @endphp @if($isBlocked)
{{ $hour }}h{{ str_pad($min, 2, '0', STR_PAD_LEFT) }}
@else {{ $hour }}h{{ str_pad($min, 2, '0', STR_PAD_LEFT) }} @endif @endforeach
@if($hasAppointments) {{-- Barres de RDV empilées --}} @endif