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

<h1 class="page-header">Data Warga 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 Lengkap</th>
      <th>Tempat</th>
      <th>Tanggal Lahir</th>
      <th>Jenis Kelamin</th>
      <th>Alamat</th>
      <th>Nama Orang Tua</th>
      <th>Asal Ranting</th>
      <th>Aksi</th>
    </tr>
  </thead>
  <tbody>
    <?php $nomor = 1; ?>
    <?php foreach ($data_warga as $warga) : ?>
    <tr>
      <td><?php echo $nomor++ ?>.</td>
      <td>
        <?php if (!empty($warga['foto'])) : ?>
          <img src="../../uploads/<?php echo $warga['foto'] ?>" 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 $warga['nama_warga'] ?></td>
      <td><?php echo $warga['tempat_lahir_warga'] ?></td>
      <td>
        <?php echo ($warga['tanggal_lahir_warga'] != '0000-00-00') ? date('d-m-Y', strtotime($warga['tanggal_lahir_warga'])) : ''?>
      </td> 
      <td><?php echo $warga['jenis_kelamin_warga'] ?></td>
      <td><?php echo $warga['desa_kelurahan_warga'] ?></td>
      <td><?php echo $warga['nama_orang_tua'] ?></td>
      <td><?php echo $warga['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_warga=<?php echo $warga['id_warga'] ?>"><i class="glyphicon glyphicon-sunglasses"></i> Detail</a>
            </li>
            <li>
              <a href="cetak-show.php?id_warga=<?php echo $warga['id_warga'] ?>" target="_blank"><i class="glyphicon glyphicon-print"></i> Cetak</a>
            <li>
              <a href="edit.php?id_warga=<?php echo $warga['id_warga'] ?>"><i class="glyphicon glyphicon-edit"></i> Ubah</a>
            </li>
            <li class="divider"></li>
            <li>
              <a href="delete.php?id_warga=<?php echo $warga['id_warga'] ?>" 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') ?>
