@foreach(array_chunk($appointment_dates, 5) as $chunk)
@foreach($chunk as $appointment_date) @if($holidays->has($appointment_date)) @php $holiday = $holidays->get($appointment_date); @endphp
{{ agendaDisplayDate($holiday->holiday_date) }}
@else {{-- Appointments section --}} @php $visit_date_free_hours = $grouped_free_hours->get($appointment_date) ?? collect([]); @endphp
@foreach($time_blocks as $time_block)
{{ agendaDisplayDate($appointment_date) }} - {{ $time_block->start_time }} - {{ $time_block->end_time }}
@if($appointments->has($appointment_date)) @if($appointments->get($appointment_date)->has($time_block->id)) @foreach($appointments->get($appointment_date)->get($time_block->id) as $driver_id => $driver_appointments) @php $driver = $drivers->get($driver_id); $driver_appointments = $driver_appointments->sortBy('visit_time'); $filtered_appointments = []; foreach($driver_appointments as $key => $driver_appointment) { if ($driver_appointment->article) { $key = $driver_appointment->article->supplier_id . '-' . $driver_appointment->article->task_time; if (array_key_exists($key, $filtered_appointments)) { $filtered_appointments[$key]->total_count++; } else { $driver_appointment->total_count = 1; $filtered_appointments[$key] = $driver_appointment; } } else { $filtered_appointments[] = $driver_appointment; } } @endphp
@foreach($filtered_appointments as $driver_appointment) @php $col_parts = 12; // switch (count($filtered_appointments)) { // case 1: // $col_parts = 12; // break; // case 2: // $col_parts = 6; // break; // default: // $col_parts = 4; // break; // } @endphp
@endforeach
@endforeach @endif @endif @include('agendas.agenda.free-hour', [ 'appointments' => $appointments, 'appointment_date' => $appointment_date, 'visit_date_free_hours' => $visit_date_free_hours, 'visit_time_block' => $time_block ])
@endforeach
@endif @endforeach
@endforeach