<?php include('../_partials/top.php') ?>

<h1 class="page-header">Data Pelatih Silat</h1>
<?php include('_partials/menu.php') ?>

<?php include('data-index.php') ?>
<?php include('../dasbor/data-index.php') ?>

<table class="table table-striped table-condensed table-hover" id="datatable">
  <thead>
    <tr>
      <th>#</th>
      <th>Foto</th>
      <th>Nama Pelatih</th>
      <th>Alamat</th>
      <th>Asal Ranting</th>
      <th>Aksi</th>
    </tr>
  </thead>
  <tbody>
    <?php $nomor = 1; ?>
    <?php foreach ($data_pelatih as $pelatih) : ?>
    <tr>
      <td><?php echo $nomor++ ?>.</td>
      <td>
        <?php if (!empty($pelatih['foto_pelatih'])) : ?>
          <img src="../../uploads/<?php echo $pelatih['foto_pelatih'] ?>" alt="Foto " width="100" height="100"  class="img-thumbnail">
        <?php else : ?>
          <img src="../../uploads/default-avatar.png" alt="Default Avatar" width="50" height="50"  class="img-thumbnail">
        <?php endif; ?>
      </td>
      <td><?php echo $pelatih['nama_pelatih'] ?></td>
      <td><?php echo $pelatih['alamat'] ?></td>
      <td><?php echo $pelatih['asal_ranting'] ?></td>
      <td>
        <!-- Single button -->
        <div class="btn-group pull-right">
          <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
          <span class="caret"></span>
          </button>
          <ul class="dropdown-menu pull-right" role="menu">
          <li>
              <a href="show.php?id_pelatih=<?php echo $pelatih['id_pelatih'] ?>"><i class="glyphicon glyphicon-sunglasses"></i> Detail</a>
            </li>
            <li>
              <a href="edit.php?id_pelatih=<?php echo $pelatih['id_pelatih'] ?>"><i class="glyphicon glyphicon-edit"></i> Ubah</a>
            </li>
            <li>
              <a href="delete.php?id_pelatih=<?php echo $pelatih['id_pelatih'] ?>" onclick="return confirm('Yakin hapus data ini?')">
                <i class="glyphicon glyphicon-trash"></i> Hapus
              </a>
            </li>
          </ul>
        </div>
      </td>
    </tr>
    <?php endforeach ?>
  </tbody>
</table>
<?php include('../_partials/bottom.php') ?>
