<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Edit catatan kesehatan') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6">


<div class="container">
    <h1 class="mb-4">Edit Catatan Kesehatan</h1>
    <form action="{{ route('catatan_kesehatans.update', $catatanKesehatan) }}" method="POST">
        @csrf
        @method('PUT')
        <div class="mb-3">
            <label for="santri_id" class="font-semibold text-gray-700 mb-1 block">Santri</label>
            <select name="santri_id" id="santri_id" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors" required>
                <option value="">Pilih Santri</option>
                @foreach($santris as $santri)
                    <option value="{{ $santri->id }}" {{ (old('santri_id', $catatanKesehatan->santri_id) == $santri->id) ? 'selected' : '' }}>{{ $santri->nama }}</option>
                @endforeach
            </select>
        </div>
        <div class="mb-3">
            <label for="kelas_id" class="font-semibold text-gray-700 mb-1 block">Kelas</label>
            <select name="kelas_id" id="kelas_id" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors" required>
                <option value="">Pilih Kelas</option>
                @foreach($kelas as $k)
                    <option value="{{ $k->id }}" {{ (old('kelas_id', $catatanKesehatan->kelas_id) == $k->id) ? 'selected' : '' }}>{{ $k->nama_kelas }}</option>
                @endforeach
            </select>
        </div>
        <div class="mb-3">
            <label for="keluhan" class="font-semibold text-gray-700 mb-1 block">Keluhan</label>
            <input type="text" name="keluhan" id="keluhan" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors" value="{{ old('keluhan', $catatanKesehatan->keluhan) }}" required>
        </div>
        <div class="mb-3">
            <label for="diagnosis" class="font-semibold text-gray-700 mb-1 block">Diagnosis</label>
            <input type="text" name="diagnosis" id="diagnosis" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors" value="{{ old('diagnosis', $catatanKesehatan->diagnosis) }}" required>
        </div>
        <div class="mb-3">
            <label for="saran" class="font-semibold text-gray-700 mb-1 block">Saran</label>
            <input type="text" name="saran" id="saran" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-green-500 focus:border-green-500 transition-colors" value="{{ old('saran', $catatanKesehatan->saran) }}">
        </div>
        <div class="flex gap-2 mt-4">
            <button type="submit" class="inline-flex items-center px-6 py-3 text-sm font-medium text-white bg-green-600 rounded-lg hover:bg-green-700 transition-colors">
                <i class="fas fa-save mr-2"></i>
                Update
            </button>
            <a href="{{ route('catatan_kesehatans.index') }}" class="inline-flex items-center px-6 py-3 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors">
                <i class="fas fa-arrow-left mr-2"></i>
                Batal
            </a>
        </div>
    </form>

        </div>
    </div>
</x-app-layout> 
