Initial commit: Aplikasi Ketertiban Siswa

- Fitur: input pelanggaran, sistem poin, surat peringatan otomatis, SP progress
- Realtime notifikasi via Laravel Reverb + Echo
- Dashboard statistik, manajemen user, manajemen master data
- Login 2 kolom premium, user dropdown, pengaturan akun
- Tema biru kalem, logo sekolah dinamis, sidebar brand dinamis
- Sinkronisasi siswa dari Database Kesiswaan via API
This commit is contained in:
Bro
2026-07-21 22:43:13 +07:00
commit 1c35734f7b
116 changed files with 19664 additions and 0 deletions
@@ -0,0 +1,67 @@
@extends('layouts.app')
@section('title', 'Surat Peringatan')
@section('content')
<div class="mb-6">
<h1 class="text-2xl font-bold text-gray-900">Surat Peringatan</h1>
<p class="text-sm text-gray-500">Daftar surat peringatan siswa</p>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">No. Surat</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Siswa</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Jenis SP</th>
<th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase">Poin</th>
<th class="px-4 py-3 text-center text-xs font-medium text-gray-500 uppercase">Status</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Tanggal</th>
<th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($letters as $sp)
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 text-sm font-mono text-gray-700">{{ $sp->letter_number }}</td>
<td class="px-4 py-3 text-sm font-medium text-gray-900">{{ $sp->student->full_name ?? '-' }}</td>
<td class="px-4 py-3">
<span class="inline-flex px-2 py-1 text-xs font-medium rounded-full" style="color: {{ $sp->spThreshold->color ?? '#ef4444' }}; background-color: {{ $sp->spThreshold->color ?? '#ef4444' }}20;">
{{ $sp->spThreshold->name ?? '-' }}
</span>
</td>
<td class="px-4 py-3 text-center text-sm text-gray-700">{{ $sp->total_points_at_time }}</td>
<td class="px-4 py-3 text-center">
@php
$statusColors = ['draft' => 'yellow', 'printed' => 'blue', 'signed' => 'green', 'delivered' => 'purple'];
$color = $statusColors[$sp->status] ?? 'gray';
@endphp
<span class="inline-flex px-2 py-0.5 text-xs font-medium rounded-full bg-{{ $color }}-100 text-{{ $color }}-800 capitalize">
{{ $sp->status }}
</span>
</td>
<td class="px-4 py-3 text-sm text-gray-500">{{ $sp->created_at->format('d/m/Y') }}</td>
<td class="px-4 py-3 text-right space-x-2">
<a href="{{ route('sp-letters.show', $sp->id) }}" class="text-blue-600 hover:text-blue-800 text-sm font-medium">Detail</a>
<a href="{{ route('sp-letters.print', $sp->id) }}" class="text-blue-600 hover:text-blue-800 text-sm font-medium" target="_blank">Cetak</a>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-4 py-12 text-center text-gray-500">
<p>Belum ada surat peringatan yang digenerate</p>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if($letters->hasPages())
<div class="px-4 py-3 border-t border-gray-100">
{{ $letters->links() }}
</div>
@endif
</div>
@endsection
@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="utf-8">
<title>Cetak SP - {{ $spLetter->student->full_name }}</title>
<style>
@page { margin: 2cm; size: A4; }
body { font-family: 'Times New Roman', Times, serif; font-size: 12pt; line-height: 1.5; color: #000; }
.kop-surat { text-align: center; margin-bottom: 30px; }
.kop-surat h1 { font-size: 16pt; font-weight: bold; margin: 0; text-transform: uppercase; }
.kop-surat p { font-size: 11pt; margin: 2px 0; }
.kop-surat .line { border-top: 2px solid #000; margin-top: 8px; }
.kop-surat .sub-line { border-top: 1px solid #000; margin-top: 2px; }
.letter-number { text-align: center; margin: 25px 0; font-weight: bold; font-size: 13pt; }
.to-title { margin-bottom: 15px; }
.body-text { text-align: justify; margin-bottom: 20px; }
.violation-list { margin: 15px 0 15px 20px; }
.violation-list li { margin-bottom: 3px; }
.signature { margin-top: 50px; }
.signature .date { text-align: center; margin-bottom: 5px; }
.signature .title { text-align: center; margin-bottom: 60px; }
.signature .name { text-align: center; font-weight: bold; }
.signature .nip { text-align: center; font-size: 11pt; }
</style>
</head>
<body>
<div class="kop-surat">
<h1>{{ $school['name'] }}</h1>
<p>{{ $school['address'] }}</p>
<p>Telp: {{ $school['phone'] }}</p>
<div class="line"></div>
<div class="sub-line"></div>
</div>
<div class="letter-number">
<p>SURAT PERINGATAN</p>
<p>Nomor: {{ $spLetter->letter_number }}</p>
</div>
<div class="to-title">
<p>Kepada Yth.</p>
<p><strong>Saudara/i {{ $spLetter->student->full_name }}</strong></p>
<p>Kelas: {{ $spLetter->student->class_name ?? '-' }}</p>
<p>NISN: {{ $spLetter->student->nisn }}</p>
<p>di tempat</p>
</div>
<div class="body-text">
<p>Berdasarkan pencatatan pelanggaran yang telah dilakukan, dengan ini kami menyampaikan Surat Peringatan {{ $spLetter->spThreshold->name }} kepada Saudara/i dengan rincian sebagai berikut:</p>
</div>
<div class="body-text">
<p>Total akumulasi poin pelanggaran: <strong>{{ $spLetter->total_points_at_time }} poin</strong></p>
<p>Daftar pelanggaran:</p>
<ul class="violation-list">
@php $violations = is_array($spLetter->violations_included) ? $spLetter->violations_included : json_decode($spLetter->violations_included, true); @endphp
@if($violations)
@foreach($violations as $v)
<li>{{ $v['violation_date'] ?? '-' }} - {{ $v['description'] ?? '-' }} ({{ $v['points'] ?? 0 }} poin)</li>
@endforeach
@endif
</ul>
</div>
<div class="body-text">
<p>Dengan adanya Surat Peringatan ini, Saudara/i diharapkan dapat memperbaiki sikap dan perilaku serta tidak mengulangi pelanggaran yang telah dilakukan. Apabila Saudara/i kembali melakukan pelanggaran, maka pihak sekolah akan memberikan sanksi yang lebih tegas.</p>
</div>
<div class="signature">
<div class="date">
<p>{{ \Carbon\Carbon::now()->locale('id')->isoFormat('D MMMM Y') }}</p>
</div>
<div class="title">
<p>Kepala {{ $school['name'] }},</p>
</div>
<div class="name">
<p><u><strong>{{ $school['kepala_sekolah'] }}</strong></u></p>
</div>
<div class="nip">
<p>NIP. {{ $school['kepala_sekolah_nip'] }}</p>
</div>
</div>
<script>
window.onload = function() { window.print(); };
</script>
</body>
</html>
+77
View File
@@ -0,0 +1,77 @@
@extends('layouts.app')
@section('title', 'Detail SP')
@section('content')
<div>
<div class="mb-6 flex items-center justify-between">
<div>
<h1 class="text-2xl font-bold text-gray-900">Detail Surat Peringatan</h1>
<p class="text-sm text-gray-500">{{ $spLetter->letter_number }}</p>
</div>
<div class="flex space-x-2">
<a href="{{ route('sp-letters.index') }}" class="px-4 py-2 text-sm border border-gray-300 rounded-lg hover:bg-gray-50 transition">Kembali</a>
<a href="{{ route('sp-letters.print', $spLetter->id) }}" target="_blank" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition">Cetak</a>
</div>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6 space-y-6">
<div>
<p class="text-xs text-gray-500 uppercase tracking-wider">No. Surat</p>
<p class="text-sm font-mono font-medium text-gray-900 mt-1">{{ $spLetter->letter_number }}</p>
</div>
<div>
<p class="text-xs text-gray-500 uppercase tracking-wider">Siswa</p>
<p class="text-sm font-medium text-gray-900 mt-1">{{ $spLetter->student->full_name ?? '-' }}</p>
<p class="text-xs text-gray-500">{{ $spLetter->student->nisn ?? '' }} - {{ $spLetter->student->class_name ?? '' }}</p>
</div>
<div>
<p class="text-xs text-gray-500 uppercase tracking-wider">Jenis SP</p>
<p class="text-sm font-medium text-gray-900 mt-1">{{ $spLetter->spThreshold->name ?? '-' }}</p>
</div>
<div>
<p class="text-xs text-gray-500 uppercase tracking-wider">Total Poin Saat Generate</p>
<p class="text-lg font-bold text-blue-600 mt-1">{{ $spLetter->total_points_at_time }} poin</p>
</div>
<div>
<p class="text-xs text-gray-500 uppercase tracking-wider">Status</p>
<p class="text-sm font-medium text-gray-900 mt-1 capitalize">{{ $spLetter->status }}</p>
</div>
<div>
<p class="text-xs text-gray-500 uppercase tracking-wider">Dibuat Oleh</p>
<p class="text-sm text-gray-900 mt-1">{{ $spLetter->generator->name ?? 'Sistem' }}</p>
</div>
<div>
<p class="text-xs text-gray-500 uppercase tracking-wider">Dibuat Pada</p>
<p class="text-sm text-gray-900 mt-1">{{ $spLetter->created_at->format('d F Y H:i') }}</p>
</div>
@if($spLetter->violations_included)
<div class="border-t border-gray-100 pt-6">
<p class="text-xs text-gray-500 uppercase tracking-wider mb-3">Daftar Pelanggaran Terkait</p>
<div class="bg-gray-50 p-3 rounded-lg">
@php $violations = is_array($spLetter->violations_included) ? $spLetter->violations_included : json_decode($spLetter->violations_included, true); @endphp
@if($violations)
<ul class="space-y-1">
@foreach($violations as $v)
<li class="text-sm text-gray-700">• {{ $v['violation_date'] ?? '-' }} — {{ $v['description'] ?? '(deskripsi)' }} <span class="text-red-500 font-medium">(+{{ $v['points'] ?? 0 }})</span></li>
@endforeach
</ul>
@else
<p class="text-sm text-gray-500">Data tidak tersedia</p>
@endif
</div>
</div>
@endif
@if($school['kepala_sekolah'])
<div class="border-t border-gray-100 pt-6">
<div class="text-right">
<p class="text-sm text-gray-900">{{ $school['kepala_sekolah'] }}</p>
<p class="text-xs text-gray-500">Kepala {{ $school['name'] }}</p>
</div>
</div>
@endif
</div>
</div>
@endsection