{{-- Calendar Header --}}
{{-- Top Row: Title and Today Button --}}

{{ $currentPeriodLabel }}

{{-- Bottom Row: Controls --}}
{{-- Left Side: Technician Filter --}}
{{-- Right Side: View Controls and Navigation --}}
{{-- View Type Toggles --}}
{{-- Navigation --}}
{{-- Calendar Content --}}
@if($viewType === 'month') {{-- Month View --}}
{{-- Day Headers --}}
@foreach(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as $day)
{{ $day }}
@endforeach
{{-- Calendar Days --}}
@foreach($calendarDays as $day)
{{ $day['day'] }}
{{-- Appointments for this day --}} @if(isset($appointments[$day['date']]))
@foreach(array_slice($appointments[$day['date']], 0, 3) as $appointment)
{{ \Carbon\Carbon::parse($appointment['scheduled_datetime'])->format('g:i A') }}
{{ $appointment['customer']['first_name'] ?? 'Unknown' }}
@endforeach @if(count($appointments[$day['date']]) > 3)
+{{ count($appointments[$day['date']]) - 3 }} more
@endif
@endif
@endforeach
@elseif($viewType === 'week') {{-- Week View --}}
{{-- Time Column --}}
@foreach($timeSlots as $slot)
{{ $slot['label'] }}
@endforeach
{{-- Days Columns --}}
@foreach($calendarDays as $day)
{{-- Day Header --}}
{{ $day['dayName'] }}
{{ $day['day'] }}
{{-- Time Slots --}}
@foreach($timeSlots as $slot)
{{-- Appointments for this time slot --}} @if(isset($appointments[$day['date']])) @foreach($appointments[$day['date']] as $appointment) @php $appointmentTime = \Carbon\Carbon::parse($appointment['scheduled_datetime'])->format('H:i'); @endphp @if($appointmentTime === $slot['time'])
{{ $appointment['customer']['first_name'] ?? '' }} {{ $appointment['customer']['last_name'] ?? '' }}
{{ $appointment['service_requested'] }}
@endif @endforeach @endif
@endforeach
@endforeach
@else {{-- Day View --}}
{{-- Time Column --}}
{{ $calendarDays[0]['fullDate'] ?? '' }}
@foreach($timeSlots as $slot)
{{ $slot['label'] }}
@endforeach
{{-- Day Content --}}
Schedule
@foreach($timeSlots as $slot)
{{-- Appointments for this time slot --}} @if(isset($appointments[$selectedDate])) @foreach($appointments[$selectedDate] as $appointment) @php $appointmentTime = \Carbon\Carbon::parse($appointment['scheduled_datetime'])->format('H:i'); @endphp @if($appointmentTime === $slot['time'])
{{ $appointment['customer']['first_name'] ?? '' }} {{ $appointment['customer']['last_name'] ?? '' }}
{{ $appointment['service_requested'] }}
{{ $appointment['assigned_technician']['first_name'] ?? '' }} {{ $appointment['assigned_technician']['last_name'] ?? '' }}
{{ \Carbon\Carbon::parse($appointment['scheduled_datetime'])->format('g:i A') }}
@endif @endforeach @endif
@endforeach
@endif
{{-- Appointment Details Modal --}} @if($showAppointmentModal && $selectedAppointment)

Appointment Details

{{ ucfirst(str_replace('_', ' ', $selectedAppointment->status)) }}

{{ $selectedAppointment->customer->first_name }} {{ $selectedAppointment->customer->last_name }}

{{ $selectedAppointment->vehicle->year }} {{ $selectedAppointment->vehicle->make }} {{ $selectedAppointment->vehicle->model }}

{{ $selectedAppointment->assignedTechnician->first_name }} {{ $selectedAppointment->assignedTechnician->last_name }}

{{ $selectedAppointment->formatted_date_time }}

{{ $selectedAppointment->service_requested }}

@if($selectedAppointment->customer_notes)

{{ $selectedAppointment->customer_notes }}

@endif
@endif