@foreach(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as $dayName)
{{ $dayName }}
@endforeach
{{-- Empty cells for days before month starts --}}
@for($i = 0; $i < $startDate->dayOfWeek; $i++)
@endfor
{{-- Actual days --}}
@foreach($calendarData as $day => $leaves)
@php
$date = Carbon\Carbon::create($year, $month, $day);
$isToday = $date->isToday();
$isWeekend = in_array($date->dayOfWeek, [5, 6]); // Fri, Sat for Oman
@endphp
{{ $day }}
@if(count($leaves) > 0)
{{ count($leaves) }}
@endif
@foreach(array_slice($leaves, 0, 3) as $leave)
{{ $leave->employee->first_name }}
@endforeach
@if(count($leaves) > 3)
+{{ count($leaves) - 3 }} more
@endif
@endforeach
{{-- Empty cells for remaining --}}
@php
$totalCells = $startDate->dayOfWeek + $endDate->day;
$remainingCells = (7 - ($totalCells % 7)) % 7;
@endphp
@for($i = 0; $i < $remainingCells; $i++)
@endfor