@for($i = 1; $i <= $daysInMonth; $i++) @endfor @for($i = 1; $i <= $daysInMonth; $i++) @php $isHoliday = in_array($i, $nationalHolidays); @endphp @endfor @for($i = 1; $i <= $daysInMonth; $i++) @php $isSunday = \Carbon\Carbon::createFromDate($year, $month, $i)->isSunday(); @endphp @endfor @foreach($employees as $employee) @for($i = 1; $i <= $daysInMonth; $i++) @php $dateKey = $year . '-' . str_pad($month, 2, '0', STR_PAD_LEFT) . '-' . str_pad($i, 2, '0', STR_PAD_LEFT); $status = isset($employee['attendance'][$dateKey]) ? $employee['attendance'][$dateKey] : ''; // Logic Warna Cell (Hijau, Kuning, Biru, Merah) $bgColor = '#ffffff'; // default putih $textColor = '#000000'; if($status == 'H') { $bgColor = '#00b050'; $textColor = '#000000'; } // Hadir (Hijau) elseif($status == 'I') { $bgColor = '#ffff00'; $textColor = '#000000'; } // Izin (Kuning) elseif($status == 'C') { $bgColor = '#00b0f0'; $textColor = '#000000'; } // Cuti (Biru) elseif($status == 'S') { $bgColor = '#ff0000'; $textColor = '#ffffff'; } // Sakit (Merah) elseif($status == 'A') { $bgColor = '#d9d9d9'; $textColor = '#000000'; } // Absen (Abu-abu) @endphp @endfor @endforeach
ABSENSI KARYAWAN PT MAJU JAYA
PERIODE {{ strtoupper(\Carbon\Carbon::now()->translatedFormat('F Y')) }}
Nama Jabatan Tanggal Jumlah
Hari Kerja
Keterangan
{{ $i }}H I C S A
Libur Nasional {{ $isHoliday ? 'Libur Nasional' : '' }}
Minggu {{ $isSunday ? 'Minggu' : '' }}
{{ $employee['name'] }} {{ $employee['position'] }} {{ $status }} {{ $employee['total_hari_kerja'] ?? 0 }} {{ $employee['total_H'] ?? 0 }} {{ $employee['total_I'] ?? 0 }} {{ $employee['total_C'] ?? 0 }} {{ $employee['total_S'] ?? 0 }} {{ $employee['total_A'] ?? 0 }}
Keterangan:
H    Hadir
I    Izin
C    Cuti
S    Sakit
A    Abstain