@extends('layouts.app') @section('title', 'Dashboard') @section('content')

Dashboard

Ringkasan pelanggaran siswa

{{-- Stats Cards --}}

Pelanggaran Hari Ini

{{ $stats['today_violations'] }}

Total Pelanggaran

{{ $stats['total_violations'] }}

Siswa Aktif

{{ $stats['total_students'] }}

SP Aktif (Draft)

{{ $stats['active_sp'] }}

{{-- Recent Violations --}} {{-- Top Students + SP Alerts --}}
{{-- Notifikasi Ambang SP --}} @if($spThresholds->count() > 0)

Ambang SP

@foreach($spThresholds as $threshold) @php $studentsAtRisk = \App\Models\Student::where('is_active', true)->get()->filter(function($s) use ($threshold) { $pts = $s->total_points; $maxOk = $threshold->max_points ?? 9999; return $pts >= $threshold->min_points && $pts <= $maxOk; }); @endphp

{{ $threshold->name }}

{{ $threshold->min_points }}-{{ $threshold->max_points ?? '~' }} poin

{{ $studentsAtRisk->count() }}
@endforeach
@endif {{-- Top 5 Siswa Poin Tertinggi --}}

Poin Tertinggi

@forelse($topStudents as $student)
{{ $loop->iteration }}

{{ $student->full_name }}

{{ $student->class_name }}

{{ $student->total_points }}
@empty
Belum ada data
@endforelse
@endsection