@foreach(['Sen','Sel','Rab','Kam','Jum','Sab','Min'] as $hari)
{{ $hari }}
@endforeach
@for($i = 0; $i < $startOfMonth->dayOfWeekIso - 1; $i++)
@endfor
@for($d = 1; $d <= $daysInMonth; $d++)
@php
$tgl = $startOfMonth->copy()->day($d);
$tglStr = $tgl->format('Y-m-d');
$isToday = $tgl->isToday();
$status = 'Kosong';
if ($tgl->isWeekend()) {
$status = 'Libur';
} elseif (isset($absensiMap[$tglStr])) {
$data = $absensiMap[$tglStr];
// HANYA STATUS SAJA (BUANG TOTAL)
$hitungStatus = [
'Hadir' => $data['Hadir'],
'Izin' => $data['Izin'],
'Sakit' => $data['Sakit'],
'Alpha' => $data['Alpha'],
];
// AMBIL STATUS TERBANYAK
arsort($hitungStatus);
$status = array_key_first($hitungStatus);
}
$warna = match($status) {
'Hadir' => 'bg-green-500 text-white',
'Izin' => 'bg-yellow-500 text-white',
'Sakit' => 'bg-blue-500 text-white',
'Alpha' => 'bg-red-500 text-white',
'Libur' => 'bg-gray-400 text-white',
default => 'bg-white text-gray-400 border',
};
@endphp
{{ $d }}
@if($isToday)
HARI INI
@endif
@if($status !== 'Kosong')
{{ strtoupper(substr($status, 0, 1)) }}
@endif
@endfor