@extends('layouts.app', ['title' => 'Karakter & Sanksi', 'eyebrow' => 'Poin, pelanggaran, prestasi, dan tindakan otomatis']) @section('content')

Daftar Siswa dan Poin Karakter

@if(auth()->user()->role === 'guru' && auth()->user()->class_name) Menampilkan siswa perwalian {{ auth()->user()->class_name }}. @else Menampilkan rekap poin, pelanggaran, prestasi, dan status siswa. @endif

@if(auth()->user()->hasRole(['admin','guru'])) Tambah Prestasi / Pelanggaran @endif
@forelse($students as $student) @php $score = (int) ($student->total_points ?? 0); $color = $score <= -100 ? 'rose' : ($score <= -20 ? 'amber' : 'emerald'); $label = $score <= -100 ? 'Bahaya' : ($score <= -20 ? 'Peringatan' : 'Baik'); $latestViolation = $student->relationLoaded('studentPoints') ? $student->studentPoints->firstWhere('type', 'pelanggaran') : null; @endphp @empty @endforelse
Siswa Kelas Total Poin Pelanggaran Pelanggaran Terakhir Prestasi Status Laporan Surat Panggilan

{{ $student->name }}

NIS: {{ $student->nis ?? '-' }}

{{ $student->class_name ?? 'Tanpa kelas' }} {{ $score }} poin {{ $student->violation_count ?? 0 }} @if($latestViolation)

{{ $latestViolation->title }}

{{ $latestViolation->occurred_at->format('d M Y') }} / {{ $latestViolation->point }} poin

@else Tidak ada @endif
{{ $student->achievement_count ?? 0 }} {{ $label }} PDF @php $studentSanc = $studentSanctions->get($student->id); $panggilanSanc = $studentSanc ? $studentSanc->firstWhere('sanction_type', 'Panggilan orang tua') : null; @endphp @if($panggilanSanc && $panggilanSanc->pdf_path) 📄 SP @else - @endif
Belum ada siswa yang sesuai.

Riwayat Poin

@foreach($points as $point) @endforeach
SiswaJenisKategoriPoinDeskripsiGuruTanggal
{{ $point->student->name }} {{ ucfirst($point->type) }} {{ $point->category }} {{ $point->point }} {{ $point->title }} {{ optional($point->teacher)->name ?? '-' }} {{ $point->occurred_at->format('d M Y') }}
{{ $points->links() }}
@endsection