@extends('layouts.guru')
@section('content')
    <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('guru.catatan_kesehatans.update', $catatanKesehatan) }}" method="POST">
        @csrf
        @method('PUT')
        <div class="mb-3">
            <label for="santri_id" class="form-label">Santri</label>
            <select name="santri_id" id="santri_id" class="form-control" 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="form-label">Kelas</label>
            <select name="kelas_id" id="kelas_id" class="form-control" 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="form-label">Keluhan</label>
            <input type="text" name="keluhan" id="keluhan" class="form-control" value="{{ old('keluhan', $catatanKesehatan->keluhan) }}" required>
        </div>
        <div class="mb-3">
            <label for="diagnosis" class="form-label">Diagnosis</label>
            <input type="text" name="diagnosis" id="diagnosis" class="form-control" value="{{ old('diagnosis', $catatanKesehatan->diagnosis) }}" required>
        </div>
        <div class="mb-3">
            <label for="saran" class="form-label">Saran</label>
            <input type="text" name="saran" id="saran" class="form-control" value="{{ old('saran', $catatanKesehatan->saran) }}">
        </div>
        <button type="submit" class="btn btn-primary">Update</button>
        <a href="{{ route('guru.catatan_kesehatans.index') }}" class="btn btn-secondary">Batal</a>
    </form>

                </div>
            </div>
        </div>
    </div>
@endsection 
