<?php
$judul = "KRS Belum set Nilai ".ucwords($_POST['data_nilai']);
?>
<table id="table_kelas_not_set" class="table table-bordered table-striped">
<thead>
<tr>
<th>No</th>
<th>NIM</th>
<th>NAMA</th>

<th>Semester</th>
<th>Kode MK</th>
<th>Nama MK</th>

<th>Kelas</th>
<th>Nilai Angka</th>
<th>Nilai Bobot</th>
<th>Nilai Huruf</th>
<th>Prodi Kelas</th>
</tr>
</thead>
<tbody>
<?php
session_start();
include "../../inc/config.php";
$and_jurusan = "and id_sms='".$_POST['id_data']."'";
$jurusan = $db->fetch_custom_single("select * from jurusan where status='A' $and_jurusan");
$no=1;
$token = get_token();

if ($_POST['data_nilai']=='angka') {
  $and_nilai = "nilai_angka is null";
} else {
  $and_nilai = "nilai_huruf is null";
}


  $data_req = [
    'act' => 'GetDetailNilaiPerkuliahanKelas',
      'token' => $token,
      'filter' => "id_prodi='".$_POST['id_data']."' and id_semester='".$_POST['sem_id']."' and $and_nilai"
  ];
$get_mahasiswa = service_request($data_req);
foreach ($get_mahasiswa->data as $mhs_data) {
?>

  <tr> 
  <td><?=$no;?></td>
  <td><?=$mhs_data->nim;?></td>
  <td><?=$mhs_data->nama_mahasiswa;?></td>

  <td><?=$mhs_data->id_semester;?></td>
  <td><?=$mhs_data->kode_mata_kuliah;?></td>
  <td><?=$mhs_data->nama_mata_kuliah;?></td>

  <td><?=$mhs_data->nama_kelas_kuliah;?></td>
      <td><?=$mhs_data->nilai_angka;?></td>
  <td><?=$mhs_data->nilai_indeks;?></td>
  <td><?=$mhs_data->nilai_huruf;?></td>
  <td><?=$mhs_data->nama_program_studi;?></td>
  </tr>
  <?php
  $no++;
}
?>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
  $('#table_kelas_not_set').DataTable({
    "dom": "<'row'<'col-sm-12'B>>" + "<'row'<'col-sm-6'l><'col-sm-6'f>>" +"<'row'<'col-sm-12'tr>>" +"<'row'<'col-sm-5'i><'col-sm-7'p>>",
    "lengthMenu": [10, 25, 50, 100,200,300,500,1000],
    buttons: [
      {
        extend: 'collection',
        text: 'Export Data',
               buttons: [
          {
            extend: 'print',
            title: '<?=$judul;?>'
          },
          {
            extend: 'pdfHtml5',
            title: '<?=$judul;?>'
          },
          {
            extend: 'csvHtml5',
            title: '<?=$judul;?>'
          },
          {
            extend: 'copyHtml5',
            title: '<?=$judul;?>'
          },
          {
            extend: 'excelHtml5',
            title: '<?=$judul;?>'
          }
        ]
      }
    ]
  });
});

</script>