@extends('layouts.app') @section('title', $student->full_name) @push('styles') @endpush @section('content')
{{-- Header --}}

Profil Siswa

Kembali
{{-- ===== HERO CARD ===== --}}
@if($student->photo_path) {{ $student->full_name }} @else {{ strtoupper(substr($student->full_name, 0, 1)) }} @endif

{{ $student->full_name }}

{{ $student->nisn ?? '—' }} {{ $student->class_name ?? '—' }} {{ $student->department_name ?? $student->department_code ?? '—' }}
@if($student->is_active) Aktif @else Tidak Aktif @endif
{{-- SP Level Badge --}} @if($currentSpLevel)
{{ $currentSpLevel->name }} — {{ $currentSpLevel->min_points }}+ poin
@endif {{-- Gradient Stat Cards --}}

Total Poin

{{ $totalPoints }}

Pelanggaran

{{ $violationCount }}x

SP Terbit

{{ $activeSpLetters }}

Terakhir

@if($lastViolation) {{ $lastViolation->violation_date->diffForHumans() }} @else — @endif

{{-- ===== SP PROGRESS ===== --}} @if($spThresholds->count() > 0)

Progress Ambang SP

{{ $totalPoints }} / {{ $nextSpThreshold ? $nextSpThreshold->min_points : $spThresholds->last()->min_points }} poin

@php $maxPoints = $nextSpThreshold ? $nextSpThreshold->min_points : $spThresholds->last()->min_points; $progressPercent = $totalPoints >= $spThresholds->last()->min_points ? 100 : min(100, ($totalPoints / $maxPoints) * 100); @endphp
@foreach($spThresholds as $threshold) @php $tsReached = $totalPoints >= $threshold->min_points; @endphp
{{ $threshold->min_points }}
{{ $threshold->name }}
@endforeach
@if($currentSpLevel)

{{ $currentSpLevel->name }} Sudah Tercapai

Siswa telah mencapai ambang {{ $currentSpLevel->min_points }} poin. Surat peringatan telah diterbitkan.

@elseif($nextSpThreshold && $violationCount > 0)

Menuju {{ $nextSpThreshold->name }}

{{ $nextSpThreshold->min_points - $totalPoints }} poin lagi untuk mencapai {{ $nextSpThreshold->name }}

@endif
@endif {{-- ===== VIOLATIONS TIMELINE ===== --}}

Riwayat Pelanggaran

{{ $violationCount }} catatan pelanggaran

@forelse($student->violations as $v) @php $handleStatusLabels = [ 'unhandled' => ['label' => 'Belum Ditangani', 'class' => 'bg-red-50 text-red-600 border-red-200'], 'in_progress' => ['label' => 'Dalam Proses', 'class' => 'bg-yellow-50 text-yellow-600 border-yellow-200'], 'resolved' => ['label' => 'Selesai', 'class' => 'bg-green-50 text-green-600 border-green-200'], ]; $hs = $handleStatusLabels[$v->handling_status] ?? ['label' => $v->handling_status, 'class' => 'bg-gray-50 text-gray-600']; @endphp
{{-- Timeline dot --}}
{{-- Top row: violation name + badges --}}
{{ $v->violationType->name ?? '—' }} {{-- Verification badge --}} @if($v->is_verified) Terverifikasi @endif {{-- Handling badge --}} {{ $hs['label'] }}
@if($v->description)

{{ $v->description }}

@endif
{{-- Poin --}}
+{{ $v->points }} @if($v->sanction) {{ $v->sanction }} @endif
{{-- Metadata row --}}
{{ $v->violation_date->format('d M Y') }} @if($v->violation_time) {{ \Carbon\Carbon::parse($v->violation_time)->format('H:i') }} @endif @if($v->location) {{ $v->location }} @endif {{ $v->recorder->name ?? '—' }}
{{-- Evidence thumbs --}} @if($v->evidences && $v->evidences->count() > 0)
@foreach($v->evidences->take(3) as $ev) Bukti @endforeach @if($v->evidences->count() > 3)
+{{ $v->evidences->count() - 3 }}
@endif
@endif {{-- Handlings --}} @if($v->handlings && $v->handlings->count() > 0)
@foreach($v->handlings as $h)
{{ $h->handling_type }} {{ $h->handling_date->format('d/m') }} @if($h->participants->count() > 0) @foreach($h->participants as $p) {{ strtoupper(substr($p->user->name ?? '?', 0, 1)) }} {{ $p->user->name }} @if($p->role) {{ $p->role }} @endif @endforeach @endif
@endforeach
@endif {{-- Detail link --}}
@empty

Belum Ada Pelanggaran

Siswa ini belum memiliki catatan pelanggaran

@endforelse
{{-- ===== SP LETTERS ===== --}} @if($student->spLetters->count() > 0)

Surat Peringatan

{{ $student->spLetters->count() }} surat diterbitkan

@foreach($student->spLetters as $sp)

{{ $sp->spThreshold?->name ?? 'SP' }} @if($sp->status === 'draft') Draft @elseif($sp->status === 'issued') Terbit @endif

{{ $sp->letter_number }} • {{ $sp->created_at->format('d M Y') }}

@endforeach
@endif {{-- ===== INFO DETAILS ===== --}}

Informasi Lengkap

Data diri siswa

@php // Identitas: kiri $identityLeft = [ ['NISN', $student->nisn, 'fa-id-card'], ['NIS', $student->student_number, 'fa-hashtag'], ]; // Identitas: kanan $identityRight = [ ['Jenis Kelamin', $student->gender === 'L' ? 'Laki-laki' : ($student->gender === 'P' ? 'Perempuan' : '—'), 'fa-venus-mars'], ['Tempat Lahir', $student->place_of_birth, 'fa-map-pin'], ['Tanggal Lahir', $student->date_of_birth ? $student->date_of_birth->format('d M Y') : '—', 'fa-cake-candles'], ]; // Akademik $academic = [ ['Kelas', $student->class_name, 'fa-building'], ['Jurusan', $student->department_name ?? $student->department_code, 'fa-graduation-cap'], ['Tahun Akademik', $student->academic_year_name, 'fa-calendar'], ]; // Kontak $contact = [ ['Telepon', $student->phone_number, 'fa-phone'], ['Email', $student->email, 'fa-envelope'], ]; // Sistem $system = [ ['Terakhir Sinkron', $student->synced_at ? $student->synced_at->format('d M Y H:i') : '—', 'fa-cloud-arrow-down'], ]; @endphp
{{-- Row: Identitas --}}
{{-- Identitas Kiri --}}
Identitas
@foreach($identityLeft as $f) @if($f[1])
{{ $f[0] }} {{ $f[1] }}
@endif @endforeach
{{-- Identitas Kanan --}}
Pribadi
@foreach($identityRight as $f) @if($f[1])
{{ $f[0] }} {{ $f[1] }}
@endif @endforeach
{{-- Row: Akademik --}} @php $academicHasValue = collect($academic)->filter(fn($f) => $f[1] !== '—' && $f[1] !== null)->count() > 0; @endphp @if($academicHasValue)
Akademik
@foreach($academic as $f) @if($f[1])

{{ $f[0] }}

{{ $f[1] }}

@endif @endforeach
@endif {{-- Row: Kontak --}}
Kontak
@foreach($contact as $f)

{{ $f[0] }}

{{ $f[1] ?: '—' }}

@endforeach
{{-- Alamat --}}
Alamat

{{ $student->address ?: '—' }}

{{-- Row: Sistem --}}
Sistem
@foreach($system as $f) @if($f[1])

{{ $f[0] }}

{{ $f[1] }}

@endif @endforeach
{{-- Edit Modal --}}
@endsection