@extends('layouts.guru')
@section('content')
<x-slot name="header">
    <h2 class="font-semibold text-xl text-gray-800 leading-tight">
        {{ __('Edit Pelanggaran') }}
    </h2>
</x-slot>

<div class="py-10">
    <div class="max-w-2xl mx-auto sm:px-6 lg:px-8">
        <div class="bg-white shadow-xl rounded-xl p-8">
            <form action="{{ route('guru_pelanggarans.update', $pelanggaran->id) }}" method="POST">
                @csrf
                @method('PUT')

                <div class="mb-3">
                    <label>Santri</label>
                    <select name="santri_id" class="form-control" required>
                        @foreach($santris as $santri)
                            <option value="{{ $santri->id }}" {{ $pelanggaran->santri_id == $santri->id ? 'selected' : '' }}>
                                {{ $santri->nama }}
                            </option>
                        @endforeach
                    </select>
                </div>

                <div class="mb-3">
                    <label>Kelas</label>
                    <select name="kelas_id" class="form-control" required>
                        @foreach($kelas as $k)
                            <option value="{{ $k->id }}" {{ $pelanggaran->kelas_id == $k->id ? 'selected' : '' }}>
                                {{ $k->nama }}
                            </option>
                        @endforeach
                    </select>
                </div>

                <div class="mb-3">
                    <label>Jenis Pelanggaran</label>
                    <input type="text" name="jenis_pelanggaran" value="{{ old('jenis_pelanggaran', $pelanggaran->jenis_pelanggaran) }}" class="form-control" required>
                </div>

                <div class="mb-3">
                    <label>Poin Pelanggaran</label>
                    <input type="number" name="point_pelanggaran" min="1" value="{{ old('point_pelanggaran', $pelanggaran->point_pelanggaran) }}" class="form-control" required>
                </div>

                <div class="mb-3">
                    <label>Keterangan</label>
                    <textarea name="keterangan" class="form-control">{{ old('keterangan', $pelanggaran->keterangan) }}</textarea>
                </div>

                <div class="mb-3">
                    <label>Saran</label>
                    <textarea name="saran" class="form-control">{{ old('saran', $pelanggaran->saran) }}</textarea>
                </div>

                <button class="btn btn-primary">Update</button>
            </form>
        </div>
    </div>
</div>
@endsection
