@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 --}}
{{ __('overview.loading') }}
@else