
<script src="<?= BASE_ASSET; ?>/js/jquery.hotkeys.js"></script>

<script type="text/javascript">
//This page is a result of an autogenerated content made by running test.html with firefox.
function domo(){
 
   // Binding keys
   $('*').bind('keydown', 'Ctrl+a', function assets() {
       window.location.href = BASE_URL + '/administrator/Form_pengajuan_pinjam_barang/add';
       return false;
   });

   $('*').bind('keydown', 'Ctrl+f', function assets() {
       $('#sbtn').trigger('click');
       return false;
   });

   $('*').bind('keydown', 'Ctrl+x', function assets() {
       $('#reset').trigger('click');
       return false;
   });

   $('*').bind('keydown', 'Ctrl+b', function assets() {

       $('#reset').trigger('click');
       return false;
   });
}

jQuery(document).ready(domo);
</script>
<!-- Content Header (Page header) -->
<section class="content-header">
   <h1>
      Pengajuan Pinjam Barang<small>List All</small>
   </h1>
   <ol class="breadcrumb">
      <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
      <li class="active">Pengajuan Pinjam Barang</li>
   </ol>
</section>
<!-- Main content -->
<section class="content">
   <div class="row" >
      
      <div class="col-md-12">
         <div class="box box-warning">
            <div class="box-body ">
               <!-- Widget: user widget style 1 -->
               <div class="box box-widget widget-user-2">
                  <!-- Add the bg color to the header using any of the bg-* classes -->
                  <div class="widget-user-header ">
                     <div class="row pull-right">
                        <?php is_allowed('form_pengajuan_pinjam_barang_export', function(){?>
                        <a class="btn btn-flat btn-success" title="export Form Pengajuan Pinjam Barang" href="<?= site_url('administrator/form_pengajuan_pinjam_barang/export'); ?>"><i class="fa fa-file-excel-o" ></i> Export</a>
                        <?php }) ?>
                     </div>
                     <div class="widget-user-image">
                        <img class="img-circle" src="<?= BASE_ASSET; ?>/img/list.png" alt="User Avatar">
                     </div>
                     <!-- /.widget-user-image -->
                     <h3 class="widget-user-username">Pengajuan Pinjam Barang</h3>
                     <h5 class="widget-user-desc">List All Pengajuan Pinjam Barang <i class="label bg-yellow"><?= $form_pengajuan_pinjam_barang_counts; ?>  items</i></h5>
                  </div>

                  <form name="form_form_pengajuan_pinjam_barang" id="form_form_pengajuan_pinjam_barang" action="<?= base_url('administrator/form_pengajuan_pinjam_barang/index'); ?>">
                  
                  <div class="table-responsive">
                  <table class="table table-bordered table-striped dataTable">
                     <thead>
                        <tr class="">
                           <th>
                            <input type="checkbox" class="flat-red toltip" id="check_all" name="check_all" title="check all">
                           </th>
                           <th>Nik/Nidn/Nim</th>
                           <th>Nama Peminjam</th>
                           <th>No Telp/Hp</th>
                           <th>Nama Barang</th>
                           <th>Dipakai Di</th>
                           <th>Digunakan Untuk</th>
                           <th>Jumlah</th>
                           <th>Tanggal Pinjam</th>
                           <th>Tanggal Kembali</th>
                           <th>Action</th>
                        </tr>
                     </thead>
                     <tbody id="tbody_form_pengajuan_pinjam_barang">
                     <?php foreach($form_pengajuan_pinjam_barangs as $form_pengajuan_pinjam_barang): ?>
                        <tr>
                           <td width="5">
                              <input type="checkbox" class="flat-red check" name="id[]" value="<?= $form_pengajuan_pinjam_barang->id; ?>">
                           </td>
                           <td><?= _ent($form_pengajuan_pinjam_barang->nik_nidn_nim); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->nama_peminjam); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->no_telp_hp); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->nama_barang); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->dipakai_di); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->digunakan_untuk); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->jumlah); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->tanggal_pinjam); ?></td> 
                           <td><?= _ent($form_pengajuan_pinjam_barang->tanggal_kembali); ?></td> 
                           <td width="200">
                              <?php is_allowed('form_pengajuan_pinjam_barang_view', function($option_form_pengajuan_pinjam_barang) use ($form_pengajuan_pinjam_barang){?>
                              <a href="<?= site_url('administrator/form_pengajuan_pinjam_barang/view/' . $form_pengajuan_pinjam_barang->id); ?>" class="label-default"><i class="fa fa-newspaper-o"></i> View
                              <?php }) ?>
                              <?php is_allowed('form_pengajuan_pinjam_barang_update', function($option_form_pengajuan_pinjam_barang) use ($form_pengajuan_pinjam_barang){?>
                              <a href="<?= site_url('administrator/form_pengajuan_pinjam_barang/edit/' . $form_pengajuan_pinjam_barang->id); ?>" class="label-default"><i class="fa fa-edit "></i> Update</a>
                              <?php }) ?>
                              <?php is_allowed('form_pengajuan_pinjam_barang_delete', function($option_form_pengajuan_pinjam_barang) use ($form_pengajuan_pinjam_barang){?>
                              <a href="javascript:void(0);" data-href="<?= site_url('administrator/form_pengajuan_pinjam_barang/delete/' . $form_pengajuan_pinjam_barang->id); ?>" class="label-default remove-data"><i class="fa fa-close"></i> Remove</a>
                               <?php }) ?>
                           </td>
                        </tr>
                      <?php endforeach; ?>
                      <?php if ($form_pengajuan_pinjam_barang_counts == 0) :?>
                         <tr>
                           <td colspan="100">
                           Form Pengajuan Pinjam Barang data is not available
                           </td>
                         </tr>
                      <?php endif; ?>
                     </tbody>
                  </table>
                  </div>
               </div>
               <hr>
               <!-- /.widget-user -->
               <div class="row">
                  <div class="col-md-8">
                     <div class="col-sm-2 padd-left-0 " >
                        <select type="text" class="form-control chosen chosen-select" name="bulk" id="bulk" placeholder="Site Email" >
                           <option value="">Bulk</option>
                           <option value="delete">Delete</option>
                        </select>
                     </div>
                     <div class="col-sm-2 padd-left-0 ">
                        <button type="button" class="btn btn-flat" name="apply" id="apply" title="apply bulk actions">Apply</button>
                     </div>
                     <div class="col-sm-3 padd-left-0  " >
                        <input type="text" class="form-control" name="q" id="filter" placeholder="Filter" value="<?= $this->input->get('q'); ?>">
                     </div>
                     <div class="col-sm-3 padd-left-0 " >
                        <select type="text" class="form-control chosen chosen-select" name="f" id="field" >
                           <option value="">All</option>
                            <option <?= $this->input->get('f') == 'nik_nidn_nim' ? 'selected' :''; ?> value="nik_nidn_nim">Nik Nidn Nim</option>
                           <option <?= $this->input->get('f') == 'nama_peminjam' ? 'selected' :''; ?> value="nama_peminjam">Nama Peminjam</option>
                           <option <?= $this->input->get('f') == 'no_telp_hp' ? 'selected' :''; ?> value="no_telp_hp">No Telp Hp</option>
                           <option <?= $this->input->get('f') == 'nama_barang' ? 'selected' :''; ?> value="nama_barang">Nama Barang</option>
                           <option <?= $this->input->get('f') == 'dipakai_di' ? 'selected' :''; ?> value="dipakai_di">Dipakai Di</option>
                           <option <?= $this->input->get('f') == 'digunakan_untuk' ? 'selected' :''; ?> value="digunakan_untuk">Digunakan Untuk</option>
                           <option <?= $this->input->get('f') == 'jumlah' ? 'selected' :''; ?> value="jumlah">Jumlah</option>
                           <option <?= $this->input->get('f') == 'tanggal_pinjam' ? 'selected' :''; ?> value="tanggal_pinjam">Tanggal Pinjam</option>
                           <option <?= $this->input->get('f') == 'tanggal_kembali' ? 'selected' :''; ?> value="tanggal_kembali">Tanggal Kembali</option>
                          </select>
                     </div>
                     <div class="col-sm-1 padd-left-0 ">
                        <button type="submit" class="btn btn-flat" name="sbtn" id="sbtn" value="Apply" title="filter search">
                        Filter
                        </button>
                     </div>
                     <div class="col-sm-1 padd-left-0 ">
                        <a class="btn btn-default btn-flat" name="reset" id="reset" value="Apply" href="<?= base_url('administrator/form_pengajuan_pinjam_barang');?>" title="reset filters">
                        <i class="fa fa-undo"></i>
                        </a>
                     </div>
                  </div>
                  </form>                  <div class="col-md-4">
                     <div class="dataTables_paginate paging_simple_numbers pull-right" id="example2_paginate" >
                        <?= $pagination; ?>
                     </div>
                  </div>
               </div>
            </div>
            <!--/box body -->
         </div>
         <!--/box -->
      </div>
   </div>
</section>
<!-- /.content -->

<!-- Page script -->
<script>
  $(document).ready(function(){
   
    $('.remove-data').click(function(){

      var url = $(this).attr('data-href');

      swal({
          title: "Are you sure?",
          text: "data to be deleted can not be restored!",
          type: "warning",
          showCancelButton: true,
          confirmButtonColor: "#DD6B55",
          confirmButtonText: "Yes, delete it!",
          cancelButtonText: "No, cancel plx!",
          closeOnConfirm: true,
          closeOnCancel: true
        },
        function(isConfirm){
          if (isConfirm) {
            document.location.href = url;            
          }
        });

      return false;
    });


    $('#apply').click(function(){

      var bulk = $('#bulk');
      var serialize_bulk = $('#form_form_pengajuan_pinjam_barang').serialize();

      if (bulk.val() == 'delete') {
         swal({
            title: "Are you sure?",
            text: "data to be deleted can not be restored!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            cancelButtonText: "No, cancel plx!",
            closeOnConfirm: true,
            closeOnCancel: true
          },
          function(isConfirm){
            if (isConfirm) {
               document.location.href = BASE_URL + '/administrator/form_pengajuan_pinjam_barang/delete?' + serialize_bulk;      
            }
          });

        return false;

      } else if(bulk.val() == '')  {
          swal({
            title: "Upss",
            text: "Please choose bulk action first!",
            type: "warning",
            showCancelButton: false,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Okay!",
            closeOnConfirm: true,
            closeOnCancel: true
          });

        return false;
      }

      return false;

    });/*end appliy click*/


    //check all
    var checkAll = $('#check_all');
    var checkboxes = $('input.check');

    checkAll.on('ifChecked ifUnchecked', function(event) {   
        if (event.type == 'ifChecked') {
            checkboxes.iCheck('check');
        } else {
            checkboxes.iCheck('uncheck');
        }
    });

    checkboxes.on('ifChanged', function(event){
        if(checkboxes.filter(':checked').length == checkboxes.length) {
            checkAll.prop('checked', 'checked');
        } else {
            checkAll.removeProp('checked');
        }
        checkAll.iCheck('update');
    });

  }); /*end doc ready*/
</script>