@extends('layouts.app')
@section('content')
<div class="container mt-4">
    <div class="card max-w-xl mx-auto p-6">
        <h2 class="text-xl font-bold text-primary mb-4">Edit Guru</h2>
        <form action="{{ route('gurus.update', $guru) }}" method="POST">
            @csrf
            @method('PUT')
            <div class="mb-3">
                <label class="font-semibold">Nama</label>
                <input type="text" name="nama" class="form-control rounded" value="{{ old('nama', $guru->nama) }}" required>
                @error('nama')<div class="text-red-600 text-sm mt-1">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
                <label class="font-semibold">CODE GURU</label>
                <input type="text" name="code_guru" class="form-control rounded" value="{{ old('code_guru', $guru->code_guru) }}" required>
                @error('code_guru')<div class="text-red-600 text-sm mt-1">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
                <label class="font-semibold">Alamat</label>
                <input type="text" name="alamat" class="form-control rounded" value="{{ old('alamat', $guru->alamat) }}">
                @error('alamat')<div class="text-red-600 text-sm mt-1">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
                <label class="font-semibold">Tanggal Lahir</label>
                <input type="date" name="tanggal_lahir" class="form-control rounded" value="{{ old('tanggal_lahir', $guru->tanggal_lahir) }}">
                @error('tanggal_lahir')<div class="text-red-600 text-sm mt-1">{{ $message }}</div>@enderror
            </div>
            <div class="mb-3">
                <label class="font-semibold">Jenis Kelamin</label>
                <select name="jenis_kelamin" class="form-control rounded" required>
                    <option value="L" {{ old('jenis_kelamin', $guru->jenis_kelamin)=='L'?'selected':'' }}>Laki-laki</option>
                    <option value="P" {{ old('jenis_kelamin', $guru->jenis_kelamin)=='P'?'selected':'' }}>Perempuan</option>
                </select>
                @error('jenis_kelamin')<div class="text-red-600 text-sm mt-1">{{ $message }}</div>@enderror
            </div>
            <div class="flex gap-2 mt-4">
                <button type="submit" class="btn-primary">Update</button>
                <a href="{{ route('gurus.index') }}" class="btn-accent">Kembali</a>
            </div>
        </form>
    </div>
</div>
@endsection 