<?php echo form_open('DataStunting/delete'); ?>

<div class="row">
  <div class="col-12">
    <div class="card card-cascade narrower z-depth-1">
      <div
        class="view view-cascade gradient-card-header peach-gradient narrower py-2 mx-4 mb-3 d-flex justify-content-between align-items-center">
        <div>
          <button type="button" class="btn btn_hapus btn-outline-white btn-rounded btn-sm px-2" data-toggle="tooltip"
            data-placement="top" title="" data-original-title="Hapus Data"><i class="ti-trash mt-0"></i></button>
          <button type="button" class="btn btn-outline-white btn-rounded btn-sm px-2" data-toggle="tooltip"
            data-placement="top" title="" data-original-title="Jumlah Item Terpilih"><span
              id="jumlah_pilih">0</span></button>
        </div>
        <a href="" class="white-text mx-3">Daftar Stunting</a>
        <div>
        <!-- <a href="<?php base_url(); ?>DataStunting/import" class="float-right">
            <button type="button" class="btn btn-outline-white btn-rounded btn-sm px-2" data-toggle="tooltip"
              data-placement="top" title="" data-original-title="Import Data Baru"><i
                class="fa fa-file m-1"></i></button>
          </a> -->
          <a href="<?php base_url(); ?>DataStunting/input" class="float-right">
            <button type="button" class="btn btn-outline-white btn-rounded btn-sm px-2" data-toggle="tooltip"
              data-placement="top" title="" data-original-title="Tambah Data Baru"><i
                class="fa fa-plus m-1"></i></button>
          </a>
        </div>
      </div>
      <div class="card-body">
        <div class="table-responsive">
          <table id="myTable" class="table table-striped table-bordered ">
            <thead>
              <tr>
                <th width="10%"><input type="checkbox" class="form-check-input select-all" id="tableMaterialChec">
                  <label class="form-check-label" for="tableMaterialChec"></label>
                </th>
                <th>Nama Desa</th>
                <th>Tahun</th>
                <th>Total</th>
                <th width="10%">Opsi</th>
              </tr>
            </thead>
            <tbody>
              <?php $no = 1;
              foreach ($stunting as $data) { ?>
                <?php $id_check = $data->id_stunting; ?>
                <tr>
                  <td><input type="checkbox" class="form-check-input id_checkbox"
                      id="tableMaterialCheck<?php echo $id_check ?>" name="id_stunting[]" value="<?php echo $id_check ?>">
                    <label class="form-check-label" for="tableMaterialCheck<?php echo $id_check ?>"></label>
                  </td>
                  <td>
                    <?php echo $data->nama_desa ?>
                  </td>
                  <td>
                    <?php echo $data->tahun ?>
                  </td>
                  <td>
                    <?php echo $data->total ?>
                  </td>
                  </td>
                  <td><a href="<?php base_url() ?>DataStunting/edit/<?php echo $id_check; ?>">
                      <button type="button" class="btn btn-warning btn-sm btn-circle" data-toggle="tooltip"
                        data-placement="top" title="" data-original-title="Ubah">
                        <i class="fa fa-edit"></i>
                      </button>
                    </a></td>
                </tr>
                <?php
                $no++;
              } ?>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>
<div id="alert">
  <?php echo $this->Core->Hapus_disable(); ?>
</div>
<div id="modal">
  <?php echo $this->Core->Hapus_aktif(); ?>
</div>
<?php echo form_close(); ?>

<script>
  $(document).ready(function () {
    var table = $('#myTable').DataTable({
      columns: [
        {
          name: 'no',
          title: 'No',
        },
        {
          name: 'id_desa',
          title: 'Nama Desa',
        },
        {
          name: 'tahun',
          title: 'Tahun',
        },
        {
          name: 'total',
          title: 'Total',
        },
        {
          name: 'opsi',
          title: 'Opsi',
        },
      ],
      rowsGroup: [
        'id_desa:name',
      ],
      pageLength: '20',
    });
  });
</script>