@extends('layouts.app', ['title' => 'Dashboard', 'eyebrow' => 'Ringkasan peran '.ucfirst(str_replace('_', ' ', auth()->user()->role))]) @section('content') @php $characterColor = function ($score) { return $score <= -100 ? 'rose' : ($score <= -20 ? 'amber' : 'emerald'); }; $showSidePanel = auth()->user()->hasRole('admin'); $studentModalData = $students->map(function ($student) { return [ 'id' => $student->id, 'name' => $student->name, 'nis' => $student->nis, 'class_name' => $student->class_name, 'total_points' => (int) ($student->total_points ?? 0), 'pdf_url' => route('character.report', $student), 'points' => $student->studentPoints->map(function ($point) { return [ 'type' => $point->type, 'category' => $point->category, 'point' => $point->point, 'title' => $point->title, 'description' => $point->description, 'teacher' => optional($point->teacher)->name, 'date' => optional($point->occurred_at)->format('d M Y'), ]; })->values(), 'sanctions' => $student->sanctions->map(function ($sanction) { return [ 'type' => $sanction->sanction_type, 'total_points' => $sanction->total_points, 'note' => $sanction->note, 'date' => optional($sanction->created_at)->format('d M Y'), ]; })->values(), ]; })->values(); @endphp @if(auth()->user()->hasRole('admin'))
@foreach([ ['Siswa', $stats['students'], 'from-emerald-50 via-green-50 to-teal-100', 'text-ocean'], ['Guru', $stats['teachers'], 'from-emerald-50 via-green-50 to-teal-100', 'text-brand'], ['Hadir', $stats['attendance'], 'from-emerald-50 via-green-50 to-teal-100', 'text-emerald-700'], ['Pelanggaran', $stats['violations'], 'from-emerald-50 via-green-50 to-teal-100', 'text-teal-700'], ['Sanksi', $stats['sanctions'], 'from-emerald-50 via-green-50 to-teal-100', 'text-green-800'], ['Berita', $stats['news'], 'from-emerald-50 via-green-50 to-teal-100', 'text-teal-700'], ] as [$label, $value, $bg, $text])

{{ $label }}

{{ $value }}

@endforeach
@endif @if(auth()->user()->hasRole('admin'))

Import Data Siswa

Unduh template tabel Excel, isi data siswa pada kolom yang tersedia, lalu upload kembali untuk menambah atau memperbarui data siswa.

Unduh Template
@if($errors->has('student_file'))
{{ $errors->first('student_file') }}
@endif
@csrf

Kolom wajib: nama_siswa, nis, kelas. Kolom opsional: email_siswa, nama_orang_tua, email_orang_tua, telepon, password. Jika email siswa kosong atau duplikat, sistem membuat email otomatis dari NIS.

@endif
@if(auth()->user()->hasRole('admin'))
@csrf @method('delete') @endif

Monitoring Karakter Siswa

Total poin otomatis dari prestasi dan pelanggaran.

@if(auth()->user()->hasRole('admin')) @endif @if(auth()->user()->hasRole(['admin','guru'])) Input Poin @endif
@if($errors->has('student_ids'))
{{ $errors->first('student_ids') }}
@endif
@if(auth()->user()->hasRole('admin')) @endif @forelse($students as $student) @php $score = (int) ($student->total_points ?? $student->characterScore()); $color = $characterColor($score); $label = $score <= -100 ? 'Bahaya' : ($score <= -20 ? 'Perlu tindak lanjut' : 'Kondisi baik'); @endphp @if(auth()->user()->hasRole('admin')) @endif @empty @endforelse
PilihSiswa Kelas Total Poin Status

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

{{ $student->class_name ?? 'Belum ada kelas' }} {{ $score }} poin {{ $label }}
Belum ada data siswa.
@if(auth()->user()->hasRole('admin'))
@endif
@if($showSidePanel)

Sanksi Terbaru

@forelse($sanctions as $sanction)

{{ $sanction->sanction_type }}

{{ $sanction->student->name }}: {{ $sanction->total_points }} poin

@empty

Belum ada sanksi.

@endforelse
@endif
@if(auth()->user()->hasRole('guru'))

Respons Tindak Lanjut Perwalian

Kirim respons pembinaan kepada siswa perwalian yang membutuhkan tindak lanjut. Pesan juga dikirim ke orang tua jika akun orang tua tersedia.

{{ $followUpStudents->count() }} siswa
@if($errors->has('body'))
{{ $errors->first('body') }}
@endif
@forelse($followUpStudents as $student) @php $score = (int) ($student->total_points ?? 0); $latestViolation = $student->studentPoints->firstWhere('type', 'pelanggaran'); $latestSanction = $student->sanctions->first(); @endphp

{{ $student->name }}

NIS: {{ $student->nis ?? '-' }} / {{ $student->class_name ?? 'Belum ada kelas' }}

{{ $score }} poin

Ringkasan terakhir

{{ optional($latestViolation)->title ?? 'Belum ada catatan pelanggaran terbaru.' }} @if($latestSanction) / {{ $latestSanction->sanction_type }} @endif

@csrf
@empty
Belum ada siswa perwalian yang membutuhkan tindak lanjut saat ini.
@endforelse
@endif

Aktivitas Karakter Terbaru

@foreach($recentPoints as $point) @endforeach
SiswaJenisKategoriPoinCatatanTanggal
{{ $point->student->name }} {{ ucfirst($point->type) }} {{ $point->category }} {{ $point->point }} {{ $point->title }} {{ $point->occurred_at->format('d M Y') }}
@if(auth()->user()->hasRole('admin')) @endif @endsection