<table class="table table-bordered">
    <thead>
        <tr>
            <th>No</th>
            <th>Nama Barang</th>
            <th>Qty</th>
            <th>Aksi</th>
        </tr>
    </thead>
    <tbody>
        <?php 
        // Query untuk mengambil detail barang berdasarkan nomor PO
        $queryDetail = "SELECT pd.*, b.barang_nama 
                        FROM po_detail pd 
                        JOIN barang b ON pd.id_barang = b.id_barang 
                        WHERE pd.no_po = '$no_po'";
        $detailBarang = query($queryDetail);
        $no = 1;

        if ($detailBarang) :
            foreach ($detailBarang as $d) : ?>
                <tr>
                    <td><?= $no++; ?></td>
                    <td><?= $d['barang_nama']; ?></td>
                    <td><?= $d['qty']; ?></td>
                    <td>
                        <a href="aksi/hapus_detail_po.php?id=<?= $d['id_detail']; ?>" class="btn btn-danger btn-sm">
                            <i class="fa fa-trash"></i>
                        </a>
                    </td>
                </tr>
            <?php endforeach; 
        else : ?>
            <tr><td colspan="4" class="text-center">Belum ada barang ditambahkan</td></tr>
        <?php endif; ?>
    </tbody>
</table>