<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>List Data Pasien</title>
    <!-- Link to Bootstrap CSS for styling -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<div class="container mt-5">
    <h2 class="mb-4 text-center">Registrasi Data Pasien</h2>
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1 class="h4 text-gray-800">Data Pasien</h1>
        <a href="home1.php" class="btn btn-primary btn-sm">Kembali</a>
    </div>
    <!-- Patient List using Card Views -->
    <div class="row row-cols-1 g-4">
        <?php 
include 'koneksi.php';
$no=1;
$data = mysqli_query($koneksi, "SELECT tbl_jadwal.id_jadwal, tbl_jadwal.no_pendaftaran, tbl_jadwal.tgl_berobat, tbl_jadwal.hari, tbl_jadwal.keterangan, tbl_pasien.nama_pasien, tbl_dokter.nama_dokter, tbl_poli.nama_poli
        FROM tbl_jadwal 
        INNER JOIN tbl_pasien ON tbl_jadwal.id_pasien = tbl_pasien.id_pasien 
        INNER JOIN tbl_dokter ON tbl_jadwal.id_dokter = tbl_dokter.id_dokter 
        INNER JOIN tbl_poli ON tbl_jadwal.id_poli = tbl_poli.id_poli ORDER BY tbl_jadwal.id_jadwal");

while ($d = mysqli_fetch_array($data)) {
?>
        <!-- More Cards for additional patients -->
        <div class="col">
            <div class="card shadow-sm">
                <div class="card-body">
                    <h5 class="card-title">Nomor Pendaftaran: <?php echo $d['no_pendaftaran']; ?></h5>
                    <h5 class="card-title">Nama Pasien: <?php echo $d['nama_pasien']; ?></h5>
                    <p class="card-text"><strong>Tanggal Berobat:</strong> <?php echo $d['tgl_berobat']; ?></p>
                    <p class="card-text"><strong>Hari:</strong> <?php echo $d['hari']; ?></p>
                    <p class="card-text"><strong>Keterangan:</strong> <?php echo $d['keterangan']; ?></p>
                    <p class="card-text"><strong>Dokter:</strong> <?php echo $d['nama_dokter']; ?></p>
                    <p class="card-text"><strong>Poli:</strong> <?php echo $d['nama_poli']; ?></p>
                </div>
            </div>
        </div>
<?php 
}
?>
        <!-- Repeat the card structure for more patients -->
    </div>
</div>

<!-- Link to Bootstrap JS for interactivity -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
