                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        Manage Cetak KRS Mahasiswa Feeder
                    </h1>
                        <ol class="breadcrumb">
                        <li><a href="<?=base_index();?>"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="<?=base_index();?>download-krs-mahasiswa">Downloa Krs Mahasiswa</a></li>
                        <li class="active">Cetak Krs Mahasiswa List</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
<div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                             
                                <div class="box-body table-responsive">
<div class="box box-danger" >
            <div class="box-header with-border">
              <h3 class="box-title">Filter</h3>
            </div>
            <div class="box-body" ><!-- 
            action="<?=base_admin();?>modul/download_mahasiswa/download_mahasiswa_file.php" -->
           <form class="form-horizontal" onsubmit="return false">
                 <div class="form-group">
                        <label for="Kode Matakuliah" class="control-label col-lg-2">NIM/NIPD</label>
                        <div class="col-lg-5">
                    <input type="text" name="nim" id="nim" class="form-control" placeholder="NIM Mahasiswa">
                      </div>
                      <div id="error_nim"></div>
                      </div><!-- /.form-group -->
 <div class="form-group">
                                        <label for="Semester" class="control-label col-lg-2">Program Studi</label>
                                        <div class="col-lg-5">
                                        <select id="jurusan" name="jurusan" data-placeholder="Pilih Semester ..." class="form-control chzn-select" tabindex="2">
                            <?php 
                                $jurusan_sms = "";
                                if ($_SESSION['level']!=1) {
                                  $jurusan_sms = "where id_sms='".$_SESSION['id_sms']."'";
                                } 
                               foreach ($db->fetch_custom("select * from jurusan $jurusan_sms") as $isi) {
                                  echo "<option value='$isi->id_sms'>$isi->jenjang $isi->nama_jurusan</option>";
                               } ?>
                              </select>
 <div id="error_prodi"></div>
                 </div>
                                      </div><!-- /.form-group -->

                      <div class="form-group">
                        <label for="tags" class="control-label col-lg-2">&nbsp;</label>
                        <div class="col-lg-10">
                        <span class="btn btn-primary" id="filter_data"><i class="fa fa-search"></i> Cari</span>
                        </div>
                      </div><!-- /.form-group -->
                    </form>
            </div>
            <!-- /.box-body -->
                    <span style="color:#f00">Template Bisa di edit di C:\importer\app\admina\modul\download_krs_khs\down_krs.xlxs</span>
          </div>
                                    <table id="dtb_hapus_kelas" class="table table-bordered table-striped" width="100%">
                                   <thead>
                                     <tr>    
                          <th>No</th>
                          <th>Semester</th>
                          <th>NIM</th>
                          <th>Nama</th>
                          <th>IPS</th>
                          <th>IPK</th>
                          <th>Status</th>            
                          <th>Prodi</th>
                          <th>Download</th>
                         
                        </tr>
                                      </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                                       <div class="row">
        <!-- /.col-lg-12 -->

    </div>
                                </div><!-- /.box-body -->
                            </div><!-- /.box -->
                        </div>
                    </div>
<div class="modal modal-primary" id="mass_info" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog"> 
<form method="post" action="<?=base_admin();?>modul/download_krs_khs/download_krs_mahasiswa_file.php">
<div class="modal-content"><div class="modal-header"> <h4 class="modal-title">Download KRS Mahasiswa</h4> </div> <div class="modal-body"> 

<div class="form-group" style="margin-bottom:32px">
                        <label style="padding-top:6px" for="Jurusan" class="control-label col-lg-2">Periode</label>
                        <div class="col-lg-10">
                          <select  name="periode" id="periode"  class="form-control " tabindex="2" required>
                             <?php 
               $semester = $db->fetch_custom('select * from semester order by semester desc');
                    foreach ($semester as $isi) {
                  echo "<option value='".$isi->semester."'>".$isi->nama_semester."</option>";
               } ?>
              </select>
                        </div>
<input name="id_reg_pd" type="hidden" id="id_reg_pd">

                      </div><!-- /.form-group -->
 </div> <div class="modal-footer"> <button type="submit" class="btn btn-success">Download</button> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> 

 </div> </div>
 </form><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
        <?php
      
  foreach ($db->fetch_all("sys_menu") as $isi) {

  //jika url = url dari table menu
  if ($path_url==$isi->url) {
  if ($role_act['del_act']=='Y') {
  $del = '<a href="'.base_admin()."modul/download_krs_khs/download_krs_mahasiswa_file.php?id_reg='+aData[indek]+'".'" class="btn btn-primary btn-flat"><i class="fa fa-download"></i> KRS</a> <a href="'.base_admin()."modul/download_krs_khs/download_khs_mahasiswa_file.php?id_reg='+aData[indek]+'".'" class="btn btn-success btn-flat"><i class="fa fa-download"></i> KHS</a>';
  } else {
    $del="";
  }
                   } 
  }
  
?>  
                </section><!-- /.content -->
        <script type="text/javascript">
$(document).ready(function() {



$("#filter_data").click(function(){

    dataTable = $("#dtb_hapus_kelas").DataTable({
           "fnCreatedRow": function( nRow, aData, iDataIndex ) {
            var indek = aData.length-1;           
     $('td:eq('+indek+')', nRow).html('<?=$del;?>');
       $(nRow).attr('id', 'line_'+aData[indek]);
   },
    destroy: true,
           'bProcessing': true,
            'bServerSide': true,
            'searching' : false,
               "ordering": false,
                 "columnDefs": [ {
              "targets": [0,8],
              "orderable": false,
              "searchable": true

            } ],
            "ajax":{
                 url :"<?=base_admin();?>modul/download_krs_khs/download_krs_khs_data.php",
            type: "post",  // method  , by default get
            data: function ( d ) {
              
                      d.nim =  $("#nim").val();
                      d.jurusan =  $("#jurusan").val();
                  },
          error: function (xhr, error, thrown) {
            console.log(xhr);
              $(".dtb_akm-error").html("");
              $("#dtb_akm").append('<tbody class="dtb_akm-error"><tr><th colspan="9">No data found in the server</th></tr></tbody>');
              $("#dtb_akm_processing").css("display","none");

            }
          },
          "language": {
             searchPlaceholder: "Pencarian dengan NIM atau Nama",
          "processing": "<i class=\"fa fa-spinner fa-spin\"></i> Loading data, please wait..." //add a loading image,simply putting <img src="loader.gif" /> tag.
   },

        });


});

$("#bulkDelete").on('click',function() { // bulk checked
          var status = this.checked;
          $(".deleteRow").each( function() {
            $(this).prop("checked",status);
          });
        });

$('#deleteTriger').on("click", function(event){
          if( $('.deleteRow:checked').length > 0 ){
            event.preventDefault();


            var ids = [];
            $('.deleteRow').each(function(){
              if($(this).is(':checked')) {
                ids.push($(this).val());
              }
            });
            var ids_string = ids.toString();


            $('#ucing')
        .modal({ keyboard: false })
        .one('click', '#delete', function (e) {

          $("#loadnya").show();
          $.ajax({
              type: "POST",
              url: "<?=base_admin();?>modul/hapus_mahasiswa/hapus.php?act=del_massal",
              data: {data_ids:ids_string},
               async: true,
              success: function(result) {
                console.log(result);
                $("#loadnya").hide();
                window.location.reload();
              },
              async:true
            });
          $('#ucing').modal('hide');



        });


          }
        });



});



</script>  
            