{{ __('admin.page_overview_monthly') }} {{-- Month navigation --}}
{{ __('overview.prev') }}
{{ $month->locale(app()->getLocale())->isoFormat('MMMM YYYY') }} @unless($month->isSameMonth(now())) {{ __('overview.this_month') }} @endunless @if($activeMonths->count() > 1) @endif
{{ __('overview.next') }}
@if($monthTotal > 0) {{-- Summary bar --}}
{{ __('overview.total_jobs') }}
{{ $monthTotal }}
{{ __('overview.total_duration') }}
@php $h = intdiv($totalMinutes, 60); $m = $totalMinutes % 60; @endphp {{ $h > 0 ? $h . 'h ' . $m . 'min' : $m . 'min' }}
{{ __('overview.active_drivers') }}
{{ $activeDriverCount }}
{{-- Calendar grid with Alpine.js drill-down --}}
@php $firstDay = $month->copy()->startOfMonth(); $startDow = $firstDay->dayOfWeekIso; $daysInMonth = $month->daysInMonth; $leadingBlanks = $startDow - 1; $today = now()->format('Y-m-d'); @endphp {{-- Day name headers --}}
@foreach(['day_mo', 'day_di', 'day_mi', 'day_do', 'day_fr', 'day_sa', 'day_so'] as $dayKey)
{{ __('overview.' . $dayKey) }}
@endforeach
{{-- Calendar cells --}}
{{-- Leading blank cells --}} @for($i = 0; $i < $leadingBlanks; $i++)
@endfor {{-- Day cells --}} @for($day = 1; $day <= $daysInMonth; $day++) @php $dateStr = $month->format('Y-m') . '-' . str_pad($day, 2, '0', STR_PAD_LEFT); $count = $dailyCounts->get($dateStr)?->job_count ?? 0; $isToday = $dateStr === $today; $isFuture = $dateStr > $today; $cellPos = $leadingBlanks + $day; $isLastRow = $cellPos > ($daysInMonth + $leadingBlanks - 7); @endphp
0) @click=" if (expandedDay === '{{ $dateStr }}') { expandedDay = null; dayHtml = ''; } else { expandedDay = '{{ $dateStr }}'; loading = true; dayHtml = ''; fetch('{{ route('admin.overview.day-detail') }}?date={{ $dateStr }}') .then(r => r.text()) .then(html => { dayHtml = html; loading = false; }) .catch(() => { loading = false; }); } " @endif class="min-h-[4rem] p-2 border-b border-r border-gray-100 flex flex-col items-start {{ $count > 0 ? 'bg-blue-50 cursor-pointer hover:bg-blue-100 transition-colors' : '' }} {{ $isToday ? 'ring-2 ring-inset ring-blue-500' : '' }} {{ $isFuture && $count === 0 ? 'text-gray-400' : '' }}" > {{ $day }} @if($count > 0) {{ $count }} @endif
@endfor {{-- Trailing blank cells --}} @php $trailingBlanks = (7 - (($leadingBlanks + $daysInMonth) % 7)) % 7; @endphp @for($i = 0; $i < $trailingBlanks; $i++)
@endfor
{{-- Inline drill-down area --}}
@else @endif