@foreach ($jadwalbk as $data)
    <div class="modal fade" id="exampleModal_{{ $data->id_jadwal }}" tabindex="-1"
        aria-labelledby="exampleModalLabel_{{ $data->id_jadwal }}" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h1 class="modal-title fs-5 font-bold" id="exampleModalLabel_{{ $data->id_jadwal }}">EDIT DATA JADWAL
                        BK</h1>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <form method="post" action="{{ route('jadwalbk.update', $data->id_jadwal) }}"
                        enctype="multipart/form-data" class="mt-6 space-y-6">
                        @csrf
                        @method('PATCH')
                        <div class="max-w-xl">
                            <x-input-label for="id_guru" value="NAMA GURU BK" />
                            <x-select-input id="id_guru" name="id_guru" class="mt-1 block w-full" required>
                                <option value="">Pilih Guru BK</option>
                                @foreach (\App\Models\Guru::where('jabatan', 'Guru BK')->get() as $guru)
                                    <option value="{{ $guru->id_guru }}"
                                        {{ old('id_guru', $data->id_guru) == $guru->id_guru ? 'selected' : '' }}>
                                        {{ $guru->nama_guru }}
                                    </option>
                                @endforeach
                            </x-select-input>
                        </div>
                        <div class="max-w-xl">
                            <x-input-label for="hari_mulai" value="HARI PERTAMA" />
                            <x-select-input id="hari_mulai" name="hari_mulai" class="mt-1 block w-full" required>
                                <option value="">Pilih Hari</option>
                                <option value="Senin"
                                    {{ old('hari_mulai', $data->hari_mulai) === 'Senin' ? 'selected' : '' }}>Senin
                                </option>
                                <option value="Selasa"
                                    {{ old('hari_mulai', $data->hari_mulai) === 'Selasa' ? 'selected' : '' }}>Selasa
                                </option>
                                <option value="Rabu"
                                    {{ old('hari_mulai', $data->hari_mulai) === 'Rabu' ? 'selected' : '' }}>Rabu
                                </option>
                                <option value="Kamis"
                                    {{ old('hari_mulai', $data->hari_mulai) === 'Kamis' ? 'selected' : '' }}>Kamis
                                </option>
                                <option value="Jumat"
                                    {{ old('hari_mulai', $data->hari_mulai) === 'Jumat' ? 'selected' : '' }}>Jumat
                                </option>
                            </x-select-input>
                            <x-input-error class="mt-2" :messages="$errors->get('hari_mulai')" />
                        </div>
                        <div class="max-w-xl">
                            <x-input-label for="hari_selesai" value="HARI KEDUA" />
                            <x-select-input id="hari_selesai" name="hari_selesai" class="mt-1 block w-full" required>
                                <option value="">Pilih Hari</option>
                                <option value="Senin"
                                    {{ old('hari_selesai', $data->hari_selesai) === 'Senin' ? 'selected' : '' }}>Senin
                                </option>
                                <option value="Selasa"
                                    {{ old('hari_selesai', $data->hari_selesai) === 'Selasa' ? 'selected' : '' }}>
                                    Selasa
                                </option>
                                <option value="Rabu"
                                    {{ old('hari_selesai', $data->hari_selesai) === 'Rabu' ? 'selected' : '' }}>Rabu
                                </option>
                                <option value="Kamis"
                                    {{ old('hari_selesai', $data->hari_selesai) === 'Kamis' ? 'selected' : '' }}>Kamis
                                </option>
                                <option value="Jumat"
                                    {{ old('hari_selesai', $data->hari_selesai) === 'Jumat' ? 'selected' : '' }}>Jumat
                                </option>
                            </x-select-input>
                        </div>
                        <div class="max-w-xl">
                            <x-input-label for="jam" value="JAM" />
                            <x-text-input id="jam" type="time" name="jam" class="mt-1 block w-full"
                                value="{{ old('jam', $data->jam) }}" required />
                            <x-input-error class="mt-2" :messages="$errors->get('jam')" />
                        </div>
                        <div class="modal-footer">
                            <x-secondary-button tag="a" data-bs-dismiss="modal">Batal</x-secondary-button>
                            <x-primary-button name="save" value="true">Simpan</x-primary-button>
                        </div>
                    </form>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endforeach
@section('scripts')
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.10.2/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"></script>
@endsection
