<div class="row">
    <div class="col-md-12 mb-4">
        <div class="card shadow mb-4">
            <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
                <h6 class="m-0 font-weight-bold">Data Gejala Penyakit</h6>
                <a href="index.php?halaman=nilaigejalapenyakittambah" class="btn btn-sm btn-primary shadow-sm">
                    <i class="fas fa-plus fa-sm text-white-50"></i> Tambah Data Gejala Penyakit
                </a>
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-bordered" id="tabel">
                        <thead class="bg-white text-dark">
                            <tr>
                                <th>No</th>
                                <th>Kode Gejala</th>
                                <th>Nama Gejala</th>
                                <th>Nama Penyakit</th>
                                <th>Nilai Interpretasi</th>
                                <th>Aksi</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $nomor = 1; ?>
                            <?php
                            $ambil = $koneksi->query("SELECT 
                                                        pg.id_penyakit_gejala,
                                                        pg.nilai, 
                                                        g.kodegejala, 
                                                        g.gejala AS nama_gejala, 
                                                        p.kode_penyakit, 
                                                        p.namapenyakit AS nama_penyakit, 
                                                        f.nilai_interpretasi, 
                                                        f.kategori
                                                    FROM 
                                                        penyakit_gejala pg
                                                    JOIN 
                                                        gejala g ON pg.kode_gejala = g.kodegejala
                                                    JOIN 
                                                        penyakit p ON pg.kode_penyakit = p.kode_penyakit
                                                    JOIN 
                                                        interpretasi_fuzzy f ON pg.nilai = f.nilai_interpretasi;
                            ");
                            ?>
                            <?php while ($data = $ambil->fetch_assoc()) { ?>
                                <tr>
                                    <td><?php echo $nomor; ?></td>
                                    <td><?php echo $data["kodegejala"]; ?></td>
                                    <td><?php echo $data["nama_gejala"]; ?></td>
                                    <td>(<?= $data["kode_penyakit"]; ?>) <?= $data["nama_penyakit"]; ?></td>
                                    <td><?= $data["kategori"]; ?> (<?= $data["nilai"]; ?>)</td>
                                    <td>
                                        <a href="index.php?halaman=nilaigejalapenyakitedit&id=<?php echo $data['id_penyakit_gejala']; ?>" class="btn btn-warning btn-sm m-1">Ubah</a>
                                        <a href="index.php?halaman=nilaigejalapenyakithapus&id=<?php echo $data['id_penyakit_gejala']; ?>" class="btn btn-danger btn-sm m-1" onclick="return confirm('Apakah Anda Yakin Ingin Menghapus Data?')">Hapus</a>
                                    </td>
                                </tr>
                                <?php $nomor++; ?>
                            <?php } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>