@extends('layouts.app')
@section('title', 'Rekap Kehadiran')
@section('content')
@php
use Carbon\Carbon;
// Mem-build daftar bulan yg valid untuk semester (jika mau)
// Sesuai logic lama: $academicSemester, $tahunAjaranInput
if (isset($academicSemester)) {
if ($academicSemester === 'ganjil') {
$year = substr($tahunAjaranInput, 0, 4); // ex: "2024"
$fullStartDate = Carbon::createFromDate($year, 7, 1);
$fullEndDate = Carbon::createFromDate($year, 12, 31);
} else {
$year = substr($tahunAjaranInput, 5, 4); // ex: "2025"
$fullStartDate = Carbon::createFromDate($year, 1, 1);
$fullEndDate = Carbon::createFromDate($year, 6, 30);
}
$allBulanList = [];
$iterator = $fullStartDate->copy();
while ($iterator <= $fullEndDate) {
$allBulanList[] = $iterator->copy();
$iterator->addMonth();
}
}
// Dapetin filter bulan dari request (default: "semester")
$bulanFilter = request()->get('bulan', 'semester');
@endphp
| No |
No Induk |
Nama |
@if ($bulanFilter != 'semester' && isset($tanggalList))
@foreach ($tanggalList as $tanggal)
{{ date('d', strtotime($tanggal['tanggal'])) }} |
@endforeach
@endif
Hadir |
Izin |
Sakit |
Alpha |
@foreach ($rekap as $index => $data)
| {{ $index + 1 }} |
{{ $data['no_induk'] }} |
{{ $data['nama'] }} |
@if ($bulanFilter != 'semester' && isset($tanggalList))
@foreach ($tanggalList as $tanggal)
@php
if ($tanggal['is_holiday']) {
$value = 'L';
$cellClass = 'bg-secondary text-white';
} else {
$value = $data['kehadiran'][$tanggal['tanggal']] ?? '-';
$cellClass =
$value == 'A'
? 'bg-danger text-white'
: ($value == 'I'
? 'bg-warning'
: ($value == 'S'
? 'bg-primary'
: ''));
}
@endphp
{{ $value }} |
@endforeach
@endif
{{ $data['total']['Hadir'] ?? 0 }} |
{{ $data['total']['Izin'] ?? 0 }} |
{{ $data['total']['Sakit'] ?? 0 }} |
{{ $data['total']['Alpha'] ?? 0 }} |
@endforeach
@endsection
@section('script')
@endsection