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:
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('username')->unique();
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->string('role')->default('staff'); // admin, bk, wali_kelas, staff
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sessions');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->bigInteger('expiration')->index();
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->bigInteger('expiration')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedSmallInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->string('connection');
|
||||
$table->string('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
|
||||
$table->index(['connection', 'queue', 'failed_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('classes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('source_id')->nullable()->index();
|
||||
$table->string('name');
|
||||
$table->string('level'); // X, XI, XII
|
||||
$table->string('department_code')->nullable();
|
||||
$table->string('department_name')->nullable();
|
||||
$table->string('academic_year_name')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('classes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('students', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('source_id')->nullable()->index();
|
||||
$table->string('nisn')->unique();
|
||||
$table->string('student_number')->nullable()->index();
|
||||
$table->string('full_name');
|
||||
$table->string('gender')->nullable();
|
||||
$table->string('place_of_birth')->nullable();
|
||||
$table->date('date_of_birth')->nullable();
|
||||
$table->string('address')->nullable();
|
||||
$table->string('phone_number')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('class_name')->nullable();
|
||||
$table->string('class_level')->nullable();
|
||||
$table->string('department_code')->nullable();
|
||||
$table->string('department_name')->nullable();
|
||||
$table->string('academic_year_name')->nullable();
|
||||
$table->string('status')->default('active');
|
||||
$table->string('photo_path')->nullable();
|
||||
$table->foreignId('class_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamp('synced_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('students');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('violation_categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name'); // Ringan, Sedang, Berat
|
||||
$table->string('slug')->unique();
|
||||
$table->string('color')->default('#22c55e'); // green default
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('violation_categories');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('violation_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('category_id')->constrained('violation_categories')->cascadeOnDelete();
|
||||
$table->string('name');
|
||||
$table->string('slug')->unique();
|
||||
$table->integer('points')->default(0);
|
||||
$table->text('default_sanction')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('violation_types');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('violations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('student_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('violation_type_id')->constrained('violation_types')->cascadeOnDelete();
|
||||
$table->foreignId('recorded_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->text('description')->nullable();
|
||||
$table->integer('points')->default(0);
|
||||
$table->string('sanction')->nullable();
|
||||
$table->string('location')->nullable();
|
||||
$table->date('violation_date');
|
||||
$table->time('violation_time')->nullable();
|
||||
$table->boolean('is_verified')->default(false);
|
||||
$table->foreignId('verified_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('verified_at')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index('violation_date');
|
||||
$table->index(['student_id', 'violation_date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('violations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('violation_evidences', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('violation_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('file_path');
|
||||
$table->string('original_name');
|
||||
$table->integer('file_size')->nullable();
|
||||
$table->string('mime_type')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('violation_evidences');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sp_thresholds', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name'); // SP 1, SP 2, SP 3
|
||||
$table->string('slug')->unique();
|
||||
$table->integer('min_points'); // ambang poin minimal
|
||||
$table->integer('max_points')->nullable(); // null = unlimited
|
||||
$table->string('color')->default('#ef4444');
|
||||
$table->text('default_description')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sp_thresholds');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sp_letters', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('student_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('sp_threshold_id')->constrained('sp_thresholds')->cascadeOnDelete();
|
||||
$table->foreignId('generated_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('letter_number')->unique();
|
||||
$table->string('title');
|
||||
$table->text('body')->nullable();
|
||||
$table->integer('total_points_at_time')->default(0);
|
||||
$table->json('violations_included')->nullable();
|
||||
$table->string('status')->default('draft'); // draft, printed, signed, delivered
|
||||
$table->string('file_path')->nullable();
|
||||
$table->timestamp('printed_at')->nullable();
|
||||
$table->timestamp('delivered_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sp_letters');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete();
|
||||
$table->string('type'); // violation_recorded, sp_generated, threshold_reached
|
||||
$table->string('title');
|
||||
$table->text('body')->nullable();
|
||||
$table->json('data')->nullable();
|
||||
$table->string('icon')->nullable();
|
||||
$table->string('color')->nullable();
|
||||
$table->string('action_url')->nullable();
|
||||
$table->boolean('is_read')->default(false);
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->foreignId('violation_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('sp_letter_id')->nullable()->constrained('sp_letters')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'is_read']);
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->unique();
|
||||
$table->text('value')->nullable();
|
||||
$table->string('group')->default('general');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('students', function (Blueprint $table) {
|
||||
$table->string('nisn')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// Cannot reliably revert nullable without data loss
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\ViolationCategory;
|
||||
use App\Models\ViolationType;
|
||||
use App\Models\SpThreshold;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
// Admin user
|
||||
User::create([
|
||||
'name' => 'Administrator',
|
||||
'username' => 'admin',
|
||||
'email' => 'admin@ketertiban.local',
|
||||
'password' => Hash::make('Admin123!'),
|
||||
'role' => 'admin',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
User::create([
|
||||
'name' => 'BK Sekolah',
|
||||
'username' => 'bk',
|
||||
'email' => 'bk@ketertiban.local',
|
||||
'password' => Hash::make('Bk123!'),
|
||||
'role' => 'bk',
|
||||
'is_active' => true,
|
||||
]);
|
||||
|
||||
// Categories
|
||||
$ringan = ViolationCategory::create(['name' => 'Ringan', 'slug' => 'ringan', 'color' => '#22c55e', 'description' => 'Pelanggaran ringan — poin 1-15', 'sort_order' => 1, 'is_active' => true]);
|
||||
$sedang = ViolationCategory::create(['name' => 'Sedang', 'slug' => 'sedang', 'color' => '#eab308', 'description' => 'Pelanggaran sedang — poin 15-50', 'sort_order' => 2, 'is_active' => true]);
|
||||
$berat = ViolationCategory::create(['name' => 'Berat', 'slug' => 'berat', 'color' => '#ef4444', 'description' => 'Pelanggaran berat — poin 50-100', 'sort_order' => 3, 'is_active' => true]);
|
||||
|
||||
$this->createTypes($ringan->id, [
|
||||
['Terlambat datang ke sekolah', 2, 'Teguran lisan, catat nama'],
|
||||
['Terlambat masuk kelas setelah jam istirahat', 2, 'Teguran lisan'],
|
||||
['Tidak memakai ikat pinggang', 3, 'Teguran, pinjam ikat pinggang'],
|
||||
['Tidak memakai dasi', 3, 'Teguran, pinjam dasi'],
|
||||
['Tidak memakai topi sekolah (hari topi)', 3, 'Teguran lisan'],
|
||||
['Baju tidak dimasukkan', 3, 'Dimasukkan saat itu juga'],
|
||||
['Celana/rok digulung', 4, 'Dibetulkan saat itu juga'],
|
||||
['Sepatu tidak sesuai ketentuan', 4, 'Teguran, catat nama'],
|
||||
['Kaos kaki tidak sesuai ketentuan', 3, 'Teguran lisan'],
|
||||
['Rambut tidak rapi', 5, 'Teguran, potong rambut'],
|
||||
['Rambut dicat/diwarnai', 10, 'Cat rambut hitam kembali'],
|
||||
['Kuku panjang / dicat', 3, 'Potong kuku saat itu juga'],
|
||||
['Make-up / kosmetik berlebihan', 5, 'Bersihkan saat itu juga'],
|
||||
['Aksesoris tidak sesuai aturan', 5, 'Lepas, aksesoris disita'],
|
||||
['Makan/minum di kelas saat jam pelajaran', 3, 'Teguran lisan'],
|
||||
['Membuang sampah sembarangan', 5, 'Bersihkan area sekitarnya'],
|
||||
['Berkata tidak sopan / kotor', 5, 'Teguran, menulis pernyataan'],
|
||||
['Berteriak / ribut di dalam kelas', 3, 'Teguran lisan'],
|
||||
['Di koridor saat jam pelajaran tanpa izin', 4, 'Kembali ke kelas'],
|
||||
['Tidak membawa buku/catatan pelajaran', 3, 'Teguran, catat nama'],
|
||||
['Tidak mengerjakan PR/tugas', 5, 'Kerjakan saat istirahat'],
|
||||
['Mencontek saat ulangan', 10, 'Nilai dikurangi, teguran'],
|
||||
['Tidak ikut upacara tanpa keterangan', 8, 'Teguran, catat nama'],
|
||||
]);
|
||||
|
||||
$this->createTypes($sedang->id, [
|
||||
['Membolos jam pelajaran', 20, 'Panggilan orang tua, surat pernyataan'],
|
||||
['Meninggalkan sekolah tanpa izin', 25, 'Panggilan orang tua'],
|
||||
['Tidak masuk tanpa keterangan (alpha)', 15, 'Panggilan orang tua via wali kelas'],
|
||||
['Memalsukan surat izin / tanda tangan', 30, 'Panggilan orang tua, surat pernyataan'],
|
||||
['Merokok di lingkungan sekolah', 35, 'Skorsing 1 hari, panggilan orang tua'],
|
||||
['HP menyala/dipakai saat jam pelajaran', 20, 'HP disita 1 minggu'],
|
||||
['Merekam/memfoto teman tanpa izin', 25, 'HP disita, hapus rekaman'],
|
||||
['Berkelahi ringan (dorong, adu mulut fisik)', 30, 'Skorsing 1 hari, panggilan orang tua'],
|
||||
['Mengancam / mengintimidasi verbal', 30, 'Konseling BK, panggilan orang tua'],
|
||||
['Mengejek / membully teman', 25, 'Surat pernyataan, panggilan orang tua'],
|
||||
['Membawa alat perjudian', 40, 'Skorsing 3 hari, panggilan orang tua'],
|
||||
['Membawa barang terlarang (petasan dll)', 30, 'Barang disita, panggilan orang tua'],
|
||||
['Corat-coret fasilitas sekolah', 20, 'Bersihkan / cat ulang'],
|
||||
['Merusak fasilitas sekolah ringan', 25, 'Ganti rugi + perbaiki'],
|
||||
['Menyontek massal / menyebar jawaban', 30, 'Nilai 0, panggilan orang tua'],
|
||||
]);
|
||||
|
||||
$this->createTypes($berat->id, [
|
||||
['Berkelahi/tawuran berat', 75, 'Skorsing 1 minggu, panggilan orang tua'],
|
||||
['Membawa senjata tajam', 100, 'Dikeluarkan dari sekolah, laporan polisi'],
|
||||
['Membawa/mengonsumsi minuman keras', 100, 'Dikeluarkan, laporan polisi'],
|
||||
['Membawa/menggunakan narkoba', 100, 'Dikeluarkan, laporan polisi'],
|
||||
['Pencurian', 80, 'Skorsing, panggilan orang tua, laporan polisi'],
|
||||
['Perusakan fasilitas sekolah berat', 60, 'Ganti rugi penuh, skorsing 3 hari'],
|
||||
['Penganiayaan', 100, 'Dikeluarkan, laporan polisi'],
|
||||
['Pemerasan / perampasan barang', 80, 'Skorsing, panggilan orang tua, laporan polisi'],
|
||||
['Perbuatan asusila / pelecehan seksual', 100, 'Dikeluarkan, laporan polisi'],
|
||||
['Mengedarkan konten pornografi', 80, 'Skorsing, panggilan orang tua'],
|
||||
['Ancaman kekerasan serius', 100, 'Dikeluarkan, laporan polisi'],
|
||||
['Merusak sistem informasi sekolah', 90, 'Skorsing, panggilan orang tua'],
|
||||
]);
|
||||
|
||||
// SP Thresholds
|
||||
SpThreshold::create(['name' => 'SP 1', 'slug' => 'sp1', 'min_points' => 50, 'max_points' => 99, 'color' => '#eab308', 'default_description' => 'Surat Peringatan 1: Teguran resmi pertama']);
|
||||
SpThreshold::create(['name' => 'SP 2', 'slug' => 'sp2', 'min_points' => 100, 'max_points' => 149, 'color' => '#f97316', 'default_description' => 'Surat Peringatan 2: Panggilan orang tua wajib']);
|
||||
SpThreshold::create(['name' => 'SP 3', 'slug' => 'sp3', 'min_points' => 150, 'max_points' => null, 'color' => '#ef4444', 'default_description' => 'Surat Peringatan 3: Ancaman dikeluarkan']);
|
||||
|
||||
// School settings
|
||||
Setting::setValue('school_name', 'SMK Negeri 1 Contoh', 'school', 'Nama sekolah');
|
||||
Setting::setValue('school_address', 'Jl. Contoh No. 1, Kota', 'school', 'Alamat sekolah');
|
||||
Setting::setValue('school_phone', '(021) 1234567', 'school', 'No. telepon sekolah');
|
||||
Setting::setValue('school_logo', null, 'school', 'Logo sekolah');
|
||||
Setting::setValue('kepala_sekolah_name', 'Drs. H. Contoh', 'school', 'Nama Kepala Sekolah');
|
||||
Setting::setValue('kepala_sekolah_nip', '196001011990011001', 'school', 'NIP Kepala Sekolah');
|
||||
Setting::setValue('bk_koordinator_name', 'Drs. BK', 'school', 'Nama Koordinator BK');
|
||||
}
|
||||
|
||||
private function createTypes(int $categoryId, array $types): void
|
||||
{
|
||||
foreach ($types as [$name, $points, $sanction]) {
|
||||
ViolationType::create([
|
||||
'category_id' => $categoryId,
|
||||
'name' => $name,
|
||||
'slug' => Str::slug($name),
|
||||
'points' => $points,
|
||||
'default_sanction' => $sanction,
|
||||
'is_active' => true,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user