{{-- resources/views/livewire/kepala-sekolah/dashboard.blade.php --}} {{-- Pastikan TailwindCSS & Bootstrap Icons sudah ada di layout --}}
{{-- Header + Filter (Range & Periode) --}}

Dashboard Kepala Sekolah

Ringkasan data siswa, pelanggaran, konseling, dan bimbingan offline

Rentang: @foreach (['7'=>'7H','30'=>'30H','90'=>'90H','365'=>'1T','all'=>'Semua'] as $k => $label) @endforeach
{{-- Separator --}} {{-- Filter Periode (khusus memfilter data pelanggaran) --}}
{{-- Stat Cards --}}
Total Siswa
{{ number_format($totalSiswa) }}
Seluruh waktu
Total Kelas
{{ number_format($totalKelas) }}
Seluruh waktu
Pelanggaran @if($filterPeriode) (Periode) @endif
{{ number_format($totalPelanggaran) }}
@php $r = $pelByJenis['ringan'] ?? 0; $s = $pelByJenis['sedang'] ?? 0; $b = $pelByJenis['berat'] ?? 0; $sum = max(1, $r + $s + $b); @endphp
Ringan
{{ $r }}
Sedang
{{ $s }}
Berat
{{ $b }}
Dalam rentang {{ $range === 'all' ? 'semua waktu' : $range.' hari' }} @if($filterPeriode) · Periode terpilih @endif
Bimbingan
{{ number_format($totalKonseling + $totalOffline) }}
Online: {{ number_format($totalKonseling) }} · Offline: {{ number_format($totalOffline) }}
Dalam rentang {{ $range === 'all' ? 'semua waktu' : $range.' hari' }}
{{-- Tren Pelanggaran 6 Bulan (ikut filter Periode)
Pelanggaran — 6 Bulan Terakhir @if($filterPeriode) (Periode) @endif
Total max: {{ $trendMax }}
@foreach ($trend as $t) @php $h = $trendMax ? max(4, round(($t['count'] / $trendMax) * 100)) : 4; @endphp
{{ $t['label'] }}
{{ $t['count'] }}
@endforeach
--}} {{-- Tiga kolom: terbaru --}}
{{-- Pelanggaran Terbaru (ikut filter Periode) --}}
Pelanggaran Terbaru
Lihat semua
@forelse($latestPelanggaran as $row)
{{ ucfirst($row->jenis) }}
{{ $row->siswa->nama ?? '—' }} {{ $row->siswa->kelas->nama ?? '—' }}
{{ $row->deskripsi }}
{{ optional($row->created_at)->format('d M Y H:i') }}
{{ ucfirst($row->status) }}
@empty
Belum ada data.
@endforelse
{{-- Konseling Terbaru --}}
Bimbingan Online Terbaru
Lihat semua
@forelse($latestKonseling as $row) @php $hk = $row->hasilKonselings->sortByDesc('created_at')->first(); @endphp
{{ $row->siswa->pengguna->nama ?? '—' }} {{ $row->kategori->nama ?? '—' }}
{{ $row->judul }}
@if($hk) {{ ucfirst($hk->status) }} Pertemuan: {{ optional($hk->tanggal_pertemuan)->format('d M Y H:i') }} @else Belum ada tindak lanjut @endif {{ optional($row->created_at)->format('d M Y H:i') }}
@empty
Belum ada data.
@endforelse
{{-- Bimbingan Offline Terbaru --}}
Bimbingan Offline Terbaru
Lihat semua
@forelse($latestOffline as $row)
{{ ucfirst($row->status) }}
{{ $row->siswa->nama ?? '—' }} {{ $row->siswa->kelas->nama ?? '—' }}
{{ $row->topik ?? '(Tanpa topik)' }}
{{ optional($row->tanggal)->format('d M Y H:i') }}
@empty
Belum ada data.
@endforelse