<div class="modal fade" id="openModel_{{ $data->id_siswa }}" tabindex="-1"
    aria-labelledby="openModalLabel_{{ $data->id_siswa }}" aria-hidden="true">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <h1 class="modal-title fs-5 font-bold" id="tambahModalLabel">DATA SISWA</h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>

            <div class="modal-body">

                <h1 class="fw-bold my-3 text-left text-xl">INFORMASI DATA SISWA</h1>
                <div class="row">
                    @php
                        $siswaData = [
                            'Nama' => $data->nama_siswa,
                            'NIS' => $data->nis,
                            'Tempat, Tanggal Lahir' => $data->tempat_lahir . ', ' . $data->tanggal,
                            'Jenis Kelamin' => $data->jenis_kelamin == 'L' ? 'Laki-Laki' : 'Perempuan',
                            'Agama' => $data->agama,
                            'Pendidikan Sebelumnya' => $data->pendik_sebelumnya,
                            'Anak Ke' => $data->jmlh_sodara,
                            'Alamat Siswa' => $data->alamat,
                            'Nama Ayah' => $data->nama_ayah,
                            'Nama Ibu' => $data->nama_ibu,
                            'Pekerjaan Ayah' => $data->pekerjaan_ayah,
                            'Pekerjaan Ibu' => $data->pekerjaan_ibu,
                            'Wali Siswa' => $data->wali_siswa,
                            'Kelas' => $data->kelas,
                            'Wali Kelas' => $data->guru->nama_guru ?? '-',
                            'Tahun Pelajaran' => $data->tahun_pelajaran,
                        ];
                    @endphp

                    @foreach ($siswaData as $label => $value)
                        <div class="col-sm-6 text-left my-2 flex">
                            <div class="text-muted">{{ $label }}</div>
                            <div class="fw-semibold pl-4">{{ $value }}</div>
                        </div>
                    @endforeach
                </div>

                <hr class="pt-2">
                <h1 class="fw-bold my-3 text-left text-xl">RIWAYAT BIMBINGAN KONSELING</h1>

                <div class="container">
                    <x-table :tableId="'myTable_' . uniqid()">
                        <x-slot name="header">
                            <tr class="bg-gray-400 text-center">
                                <th class="bg-gray-400 text-center">NO.</th>
                                <th class="bg-gray-400 text-center">TANGGAL</th>
                                <th class="bg-gray-400 text-center">JUDUL PENGADUAN</th>
                                <th class="bg-gray-400 text-center">JENIS PENGADUAN BK</th>
                                <th class="bg-gray-400 text-center">ISI KELUHAN</th>
                                <th class="bg-gray-400 text-center">DOKUMENTASI</th>
                                <th class="bg-gray-400 text-center">TINDAKAN BK</th>
                            </tr>
                        </x-slot>

                        @php $num = 1; @endphp
                        @foreach ($data->riwayat as $data)
                            <tr class="text-center">
                                <td>{{ $num++ }}</td>
                                <td>{{ $data->pengaduan->tanggal }}</td>
                                <td>{{ $data->pengaduan->judul_pengaduan }}</td>
                                <td>{{ $data->pengaduan->jenis_pengaduan }}</td>
                                <td>{{ $data->pengaduan->isi_keluhan }}</td>
                                <td>
                                    @if ($data->pengaduan->dokumentasi)
                                        <a class="text-blue-600 underline"
                                            href="{{ asset('storage/dokumentasi/' . $data->pengaduan->dokumentasi) }}"
                                            target="_blank">
                                            Lihat Dokumentasi
                                        </a>
                                    @else
                                        -
                                    @endif
                                </td>
                                <td>{{ $data->tindakan_bk }}</td>
                            </tr>
                        @endforeach
                    </x-table>
                </div>

                <div class="modal-footer">
                    <x-secondary-button tag="a" data-bs-dismiss="modal">BATAL</x-secondary-button>
                </div>
            </div>

        </div>
    </div>
</div>
