
<div class="box box-danger">
            <div class="box-header with-border">
              <h3 class="box-title">Filter</h3>
            </div>
            <div class="box-body">
           <form class="form-horizontal" method="post" action="<?=base_admin();?>modul/akm/download_data.php">
      <div class="form-group">
                        <label for="Semester" class="control-label col-lg-2">Program Studi</label>
                        <div class="col-lg-6">
                        <select id="jur_filter_lewat" name="jur_filter" data-placeholder="Pilih Program Studi ..." class="form-control chzn-select" tabindex="2">
                           <option value="all">Semua</option>
 <?php 
 $jurusan_sem = "";
        if ($_SESSION['level']!=1) {
              $jurusan_sem = "where kode_jurusan='".$_SESSION['jurusan']."'";
        }
foreach ($db->fetch_custom("select kode_jurusan,concat(jenjang,' ',nama_jurusan) as nama_jurusan from jurusan $jurusan_sem order by nama_jurusan asc") as $isi) {
                  echo "<option value='$isi->kode_jurusan'>$isi->nama_jurusan</option>";

                }
        ?>
                       
              </select>

 </div>
  </div><!-- /.form-group -->
      <div class="form-group">
                        <label for="Semester" class="control-label col-lg-2">Jenjang</label>
                        <div class="col-lg-6">
                        <select id="jur_filter_jenjang" name="jur_filter_jenjang" data-placeholder="Pilih Jenjang ..." class="form-control chzn-select" tabindex="2">
                           <option value="all">Semua</option>
 <?php 
foreach ($db->fetch_custom("select id_jenj_didik,jenjang from jurusan group by id_jenj_didik") as $isi) {
                  echo "<option value='$isi->id_jenj_didik'>$isi->jenjang</option>";

                }
        ?>
                       
              </select>

 </div>
  </div><!-- /.form-group -->
      <div class="form-group">
                        <label for="Semester" class="control-label col-lg-2">Hitung Periode s/d</label>
                        <div class="col-lg-6">
                        <select id="jur_filter_sem_akhir" name="jur_filter_sem_akhir" data-placeholder="Pilih Periode ..." class="form-control" tabindex="2">
 <?php 
 //get one prodi for checking
 $id_sms = $db->fetch_custom_single("select id_sms from jurusan where status='A'");
$token = get_token();
   $data_req_periode = [
    'act' => 'GetPeriode',
      'token' => $token,
      'filter' => "id_prodi='$id_sms->id_sms'",
      'order' => 'periode_pelaporan desc',
      'limit' => 3,
      'offset' => 0
       
  ];
  $get_periode = service_request($data_req_periode);
foreach ($get_periode->data as $isi) {
  if (substr($isi->periode_pelaporan, 0,3)=='1') {
    echo "<option value='$isi->periode_pelaporan' selected>$isi->periode_pelaporan</option>";
  } else {
    echo "<option value='$isi->periode_pelaporan'>$isi->periode_pelaporan</option>";
  }
  
}
        ?>
                       
              </select>

 </div>
  </div><!-- /.form-group -->
                        <div class="form-group">
                        <label for="Semester" class="control-label col-lg-2">Lama Studi (Semester)</label>
                        <div class="col-lg-3" >
                        <select id="masa_studi_awal" name="masa_studi_awal" data-placeholder="Pilih Angkatan ..." class="form-control chzn-select" tabindex="2" style="z-index: 1" required="">
                        <?php
                          for ($i=4; $i < 15; $i++) { 
                            ?>
                             <option value="<?=$i?>"><?=$i?> Semester</option>  
                             <?php
                          }
                          ?>
                          <option value="15">Lebih dari 14 Semester</option>  
                        </select>
                      </div> 
                      <div class="col-lg-2" style="width: 20px;padding: 0;padding-top: 7px;">S/D</div>
                        <div class="col-lg-3" >
                        <select id="masa_studi_akhir" name="masa_studi_akhir" data-placeholder="Pilih Angkatan ..." class="form-control chzn-select" tabindex="2" style="z-index: 1" required="">
                       <?php
                          for ($i=4; $i < 15; $i++) { 
                            ?>
                             <option value="<?=$i?>"> <?=$i?> Semester</option>  
                             <?php
                          }
                          ?>
                          <option value="15">Lebih dari 14 Semester</option>  
                        </select>
                      </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 id="filter_lewat" class="btn btn-primary"><i class="fa fa-refresh"></i> Filter</span>
                      </div>
                      </div><!-- /.form-group -->
                    </form>
            </div>
            <!-- /.box-body -->
          </div>
<div id="content-lewat">
  
</div>
<script type="text/javascript">
$(document).ready(function() {

  $('#filter_lewat').on('click', function() {
    $("#show_progress").show();
    var jurusan = $("#jur_filter_lewat").val();
    var masa_studi_awal = $("#masa_studi_awal").val();
    var masa_studi_akhir = $("#masa_studi_akhir").val();
    var jenjang = $("#jur_filter_jenjang").val();
    var sem_akhir = $("#jur_filter_sem_akhir").val();

    $.ajax({
      type: "POST",
      url: "<?=base_admin();?>modul/rekapitulasi/get_lewat_studi.php",
      data: {jurusan: jurusan,jenjang:jenjang,masa_studi_awal:masa_studi_awal,masa_studi_akhir:masa_studi_akhir,sem_akhir:sem_akhir},
      success: function(result) {
        $("#show_progress").hide();
        
        $('#content-lewat').html(result);
      }
    });
  });
});

</script>