<?php
$query = "SELECT peminjam.*, buku.judul_buku 
          FROM peminjam 
          JOIN buku ON peminjam.id_buku = buku.id_buku";
$data = mysqli_query($koneksi, $query);
while ($d = mysqli_fetch_array($data)) {
?>
    <div id="detailpeminjam-<?php echo $d['id_peminjam']; ?>" tabindex="-1" aria-hidden="true"
        class="hidden fixed top-0 right-0 left-0 z-50 flex justify-center items-center w-full md:inset-0 h-screen bg-opacity-50">
        <div class="relative p-4 w-full max-w-md">
            <div class="relative bg-white rounded-lg shadow">
                <div class="flex items-center justify-between p-4 border-b rounded-t">
                    <h3 class="text-lg font-semibold text-gray-900">Detail Peminjam</h3>
                    <button type="button" data-modal-hide="detailpeminjam-<?php echo $d['id_peminjam']; ?>"
                        class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center">
                        <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
                            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
                                d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
                        </svg>
                        <span class="sr-only">Tutup</span>
                    </button>
                </div>
                <form class="p-4">
                    <div class="grid gap-4 mb-4">
                        <div class="col-span-2">
                            <label class="block mb-2 text-sm font-medium text-gray-900">Nama Peminjam</label>
                            <input type="text" value="<?php echo htmlspecialchars($d['nama_peminjam']); ?>"
                                class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg block w-full p-2.5" readonly>
                        </div>
                        <div class="col-span-2">
                            <label class="block mb-2 text-sm font-medium text-gray-900">Email</label>
                            <input type="text" value="<?php echo htmlspecialchars($d['email']); ?>"
                                class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg block w-full p-2.5" readonly>
                        </div>
                        <div class="col-span-2">
                            <label class="block mb-2 text-sm font-medium text-gray-900">Nomor Telepon</label>
                            <input type="text" value="<?php echo htmlspecialchars($d['no_telp']); ?>"
                                class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg block w-full p-2.5" readonly>
                        </div>
                        <div class="col-span-2">
                            <label class="block mb-2 text-sm font-medium text-gray-900">Buku yang Dipinjam</label>
                            <input type="text" value="<?php echo htmlspecialchars($d['judul_buku']); ?>"
                                class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg block w-full p-2.5" readonly>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
<?php } ?>