<?php include 'header.php'; ?>

<div class="container-fluid px-4">
    <h1 class="mt-4">Data Dokter</h1>
    <ol class="breadcrumb mb-4">
        <li class="breadcrumb-item active">Table</li>
    </ol>
    
    <!-- Table Section -->
    <div class="card mb-4">
        <div class="card-header">
            <a href="home.php" class="btn btn-secondary"> &nbsp Home</a>
    <a href="dokter_tambah.php" class="btn btn-danger"></i> &nbsp TAMBAH</a>
        </div>
        <div class="card-body">
            <table id="datatablesSimple" class="table table-striped">
                <thead>
                    <tr>
                        <th>NO</th>
                        <th>Nama Dokter</th>
                        <th>Spesialis</th>
                        <th>Keterangan</th>
                        <th>Nama Poli</th>
                        <th>Aksi</th>
                    </tr>
                </thead>
                <?php 
include '../koneksi.php';
$no=1;
$data = mysqli_query($koneksi, "SELECT tbl_dokter.id_dokter, tbl_dokter.nama_dokter, tbl_dokter.spesialis, tbl_dokter.keterangan, tbl_poli.nama_poli
        FROM tbl_dokter 
        INNER JOIN tbl_poli ON tbl_dokter.id_poli = tbl_poli.id_poli ORDER BY tbl_dokter.id_dokter");

while ($d = mysqli_fetch_array($data)) {
?>
                    <tr>
                      <td><?php echo $no++; ?></td>
                      <td><?php echo $d['nama_dokter']; ?></td>
                      <td><?php echo $d['spesialis']; ?></td>
                      <td><?php echo $d['keterangan']; ?></td>
                       <td><?php echo $d['nama_poli']; ?></td>
                      <td>                        
                        <a class="btn btn-warning btn-sm" href="dokter_edit.php?id=<?php echo $d['id_dokter'] ?>"><i class="bi bi-check-circle text-success"></i>Edit</a>
                        <a class="btn btn-danger btn-sm" href="dokter_hapus_konfir.php?id=<?php echo $d['id_dokter'] ?>"><i class="bi bi-trash-fill"></i>Hapus</a>
                      </td>
                    </tr>
                    <?php 
                  }
                  ?>
                </tbody>
                
            </table>
        </div>
    </div>
</div>

<?php include 'footer.php'; ?>
