@extends('layouts.admin.app') @section('content')
{{-- Page Header --}}

Rekap Kehadiran

Monitor dan analisis data kehadiran siswa & guru

{{-- Filter Card --}}

Filter & Pencarian Data

{{-- Jenis Rekap --}}
{{-- Tanggal Mulai --}}
{{-- Tanggal Selesai --}}
{{-- Filter Kelas --}} @php $kelasId = request('kelas'); @endphp {{-- Status --}}
{{-- Action Buttons --}}
Export Excel Reset
{{-- Statistik Cards --}} @php $statusUI = [ 'hadir' => [ 'label' => ['guru' => 'Hadir', 'siswa' => 'hadir'], 'color' => 'green', 'icon' => 'check-circle-fill', 'desc' => 'Total kehadiran' ], 'izin' => [ 'label' => ['guru' => 'Izin', 'siswa' => 'izin'], 'color' => 'yellow', 'icon' => 'exclamation-circle-fill', 'desc' => 'Dengan surat' ], 'sakit' => [ 'label' => ['guru' => 'Sakit', 'siswa' => 'sakit'], 'color' => 'blue', 'icon' => 'thermometer-half', 'desc' => 'Kondisi kesehatan' ], 'alpha' => [ 'label' => ['guru' => 'Alpha', 'siswa' => 'alpha'], 'color' => 'red', 'icon' => 'x-circle-fill', 'desc' => 'Tanpa keterangan' ], ]; $colorMap = [ 'green' => ['card' => 'from-green-50 to-emerald-50 border-green-100', 'num' => 'text-green-700', 'label' => 'text-green-600', 'icon_bg' => 'bg-green-100', 'icon' => 'text-green-600', 'border' => 'text-green-100'], 'yellow' => ['card' => 'from-yellow-50 to-amber-50 border-yellow-100', 'num' => 'text-yellow-700', 'label' => 'text-yellow-600', 'icon_bg' => 'bg-yellow-100', 'icon' => 'text-yellow-600', 'border' => 'text-yellow-100'], 'blue' => ['card' => 'from-blue-50 to-sky-50 border-blue-100', 'num' => 'text-blue-700', 'label' => 'text-blue-600', 'icon_bg' => 'bg-blue-100', 'icon' => 'text-blue-600', 'border' => 'text-blue-100'], 'red' => ['card' => 'from-red-50 to-rose-50 border-red-100', 'num' => 'text-red-700', 'label' => 'text-red-600', 'icon_bg' => 'bg-red-100', 'icon' => 'text-red-600', 'border' => 'text-red-100'], ]; $mode = in_array($jenisRekap, ['guru']) ? 'guru' : 'siswa'; @endphp @if ($statistik)
@foreach(['hadir','izin','sakit','alpha'] as $key) @php $cfg = $statusUI[$key]; $cm = $colorMap[$cfg['color']]; @endphp

{{ $statistik[$key] ?? 0 }}

{{ $cfg['label'][$mode] }}

{{ $cfg['desc'] }}

@endforeach
@endif {{-- Data Table --}}

Data Kehadiran

@forelse ($dataRekap as $row) {{-- Tanggal --}} {{-- Nama --}} {{-- Kelas --}} {{-- Status --}} {{-- Keterangan --}} @empty @endforelse
Tanggal
Nama
Kelas
Status
Keterangan

{{ \Carbon\Carbon::parse($row->tanggal)->format('d M Y') }}

{{ \Carbon\Carbon::parse($row->tanggal)->translatedFormat('l') }}

@if ($row instanceof \App\Models\KehadiranSiswa) {{ strtoupper(substr($row->siswa->nama_siswa ?? '?', 0, 1)) }} @else {{ strtoupper(substr($row->guru->nama_guru ?? '?', 0, 1)) }} @endif

@if ($row instanceof \App\Models\KehadiranSiswa) {{ $row->siswa->nama_siswa ?? '-' }} @else {{ $row->guru->nama_guru ?? '-' }} @endif

@if ($row instanceof \App\Models\KehadiranSiswa) Siswa @else Tenaga Pengajar @endif

@if ($row instanceof \App\Models\KehadiranSiswa) {{ $row->siswa->kelas->nama_kelas ?? '-' }} @else Guru @endif @php $rawStatus = trim($row->status); $statusKey = strtolower($rawStatus); $siswaStatus = [ 'hadir' => ['color' => 'bg-gradient-to-r from-green-100 to-emerald-100 text-green-700 border border-green-200', 'icon' => 'check-circle-fill'], 'izin' => ['color' => 'bg-gradient-to-r from-yellow-100 to-amber-100 text-yellow-700 border border-yellow-200', 'icon' => 'exclamation-circle-fill'], 'sakit' => ['color' => 'bg-gradient-to-r from-blue-100 to-sky-100 text-blue-700 border border-blue-200', 'icon' => 'thermometer-half'], 'alpha' => ['color' => 'bg-gradient-to-r from-red-100 to-rose-100 text-red-700 border border-red-200', 'icon' => 'x-circle-fill'], ]; $guruStatus = [ 'hadir' => ['color' => 'bg-gradient-to-r from-green-100 to-emerald-100 text-green-700 border border-green-200', 'icon' => 'check-circle-fill'], 'izin' => ['color' => 'bg-gradient-to-r from-yellow-100 to-amber-100 text-yellow-700 border border-yellow-200', 'icon' => 'exclamation-circle-fill'], 'sakit' => ['color' => 'bg-gradient-to-r from-blue-100 to-sky-100 text-blue-700 border border-blue-200', 'icon' => 'thermometer-half'], 'alpha' => ['color' => 'bg-gradient-to-r from-red-100 to-rose-100 text-red-700 border border-red-200', 'icon' => 'x-circle-fill'], ]; $isGuru = isset($row->id_guru) || isset($row->guru); $configSource = $isGuru ? $guruStatus : $siswaStatus; $config = $configSource[$statusKey] ?? ['color' => 'bg-gray-200 text-gray-600', 'icon' => 'question-circle']; @endphp {{ $row->status }} @if($row->keterangan)
{{ $row->keterangan }}
@else Tidak ada keterangan @endif

Tidak ada data kehadiran

Pilih filter untuk menampilkan data

@endsection