@extends('layouts.guru') @section('title', 'Detail Laporan Absensi') @section('page-title', 'Detail Laporan Absensi') @section('guru-content')
Filter Kembali
Hadir
{{ $stats['hadir'] }}
Sakit
{{ $stats['sakit'] }}
Izin
{{ $stats['izin'] }}
Alpha
{{ $stats['alpha'] }}
@php $tanggalDasar = request('tanggal_awal') ? \Illuminate\Support\Carbon::parse(request('tanggal_awal'), config('app.timezone')) : ($absensi->first()?->tanggal?->copy() ?? now(config('app.timezone'))); $awalBulan = $tanggalDasar->copy()->startOfMonth(); $akhirBulan = $tanggalDasar->copy()->endOfMonth(); $offsetAwal = (int) $awalBulan->dayOfWeekIso - 1; // Senin = 0 $jumlahHari = (int) $awalBulan->daysInMonth; $totalSlot = (int) (ceil(($offsetAwal + $jumlahHari) / 7) * 7); $absensiMap = $absensi->getCollection()->keyBy(fn ($row) => $row->tanggal->format('Y-m-d')); @endphp @if($absensi->count() > 0)
{{ $awalBulan->translatedFormat('F Y') }}
Sen
Sel
Rab
Kam
Jum
Sab
Min
@for($slot = 0; $slot < $totalSlot; $slot++) @php $nomorHari = $slot - $offsetAwal + 1; $validHari = $nomorHari >= 1 && $nomorHari <= $jumlahHari; $tanggalSel = $validHari ? $awalBulan->copy()->day($nomorHari) : null; $key = $tanggalSel ? $tanggalSel->format('Y-m-d') : null; $row = $key ? $absensiMap->get($key) : null; $isHadir = $row && ($row->status === 'hadir'); $isTidakMasuk = $row && ($row->status !== 'hadir'); @endphp
@if($validHari)
{{ $nomorHari }}
@if($isHadir) @elseif($isTidakMasuk) @else - @endif
@if($row && $row->keterangan)
{{ $row->keterangan }}
@endif @endif
@endfor
@else
Belum ada data absensi untuk siswa ini.
@endif
{{ $absensi->links() }}
@endsection