  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>Produk</h1>            
          </div>          
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item active">List Produk</li>
            </ol>
          </div>
        </div>               
      </div><!-- /.container-fluid -->
      
    </section>

    <!-- Main content -->
     
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            
              <div class="card">
                <div class="card-header">
                  
                  <h3 class="card-title"></h3>
                 <a href="tambah.php" class="btn btn-primary btn-sm">Tambah Data</a> 
                </div>
                <!-- /.card-header -->
                <div class="card-body">
  <table id="example1" class="table table-bordered table-striped">
    <thead>
      <tr>
        <th>No</th>
        <th>ID</th>
        <th>Gambar</th>
        <th>Nama Produk</th>
        <th>Deskripsi</th>
        <th>Stok</th>
        <th>Harga</th>
        <th>Edit</th>
        <th>Hapus</th>
      </tr>
    </thead>
    <tbody>
      <?php
      include 'config/koneksi.php'; 
      $no = 1;
      $query = mysqli_query($conn, "SELECT * FROM products");
      while ($data = mysqli_fetch_array($query)) {
      ?>
        <tr>
          <td><?= $no++ ?></td>
          <td><?= $data['product_id'] ?></td>
          <td>
            <img src="data:image/jpeg;base64,<?= base64_encode($data['foto_produk']) ?>" width="60" height="60" style="object-fit: cover; border-radius: 50%;">
          </td>
          <td><?= $data['nama_produk'] ?></td>
          <td><?= $data['deskripsi'] ?></td>
          <td><?= $data['stok'] ?></td>
          <td><?= $data['harga'] ?></td>

          <!-- Tombol Edit -->
          <td>
            <a href="edit_produk.php?id=<?= $data['product_id'] ?>" class="btn btn-warning btn-sm">Edit</a>
          </td>

          <!-- Tombol Hapus -->
          <td>
            <a href="hapus_produk.php?id=<?= $data['product_id'] ?>" class="btn btn-danger btn-sm" onclick="return confirm('Yakin ingin menghapus produk ini?')">Hapus</a>
          </td>
        </tr>
      <?php } ?>
    </tbody>
  </table>
</div>



                      </tbody>

                  </table>
                  
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->


                  </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

