<?php 
	include "php_class/class_mysql.php";
	include "php_class/class_dosen.php";
	$DataDosen = new dataDosen;
	include "php_class/class_semesterpendek.php";
	$datasp = new DataSemesterPendek;
	include "php_class/class_mahasiswa.php";
	$DataMahasiswa = new DataMahasiswa;

?>

<link href="<?php echo $base?>plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $base?>plugins/iCheck/all.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $base?>plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet"/>
<script src="<?php echo $base?>plugins/input-mask/jquery.inputmask.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/input-mask/jquery.inputmask.date.extensions.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/input-mask/jquery.inputmask.extensions.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/timepicker/bootstrap-timepicker.min.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/iCheck/icheck.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $base?>plugins/autocomplete/shieldui-all.css" />
<link href="<?php echo $base?>bootstrap/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="<?php echo $base?>bootstrap/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="<?php echo $base?>bootstrap/js/locales/bootstrap-datetimepicker.id.js" charset="UTF-8"></script>
<script type="text/javascript" src="<?php echo $base?>plugins/autocomplete/shieldui-all.min.js"></script>
<script>
	$(document).ready(function(){
	var base = <?php echo json_encode($base);?>;
		$("#cari").click(function(){
			$("#myModal1").modal('show');
		});
		$("#cari2").click(function(){
			$("#myModal2").modal('show');
		});
		$("#cari3").click(function(){
			$("#myModal3").modal('show');
		});

		$('#NPM').keyup(function(e){
	  		if(e.keyCode == 13){
				var npm = $('#NPM').val();
				var action = '3';
				var program = $('#program').val();
				var tahun = $('#tahun').val();
				var semester = $('#semester').val();
				var idgrup = $('#idgrup').val();
				if (npm==''){
					$('.peringatan').html('<div id="warning"><div class="alert alert-warning" role="alert">NPM Masih Kosong!</div></div>')			
				}else{
					$('.peringatan').html('<div id="warning"><img src="img/ld.gif"></div>')			
					$.ajax({
						type:"POST",
						data: "index=" + npm + "&program=" + program + "&tahun=" + tahun + "&semester=" + semester + "&grup=" + idgrup ,
						url:"<?php echo $base?>cek-data-proposal.php",     
						success: function(data){
							var tampung = data;
							if(tampung!=404){
								$('#form1').show();
								var pecah=tampung.split(":");
								$('#idMhs').val(pecah[9]);
								$('#namaMhs').val(pecah[1]);
								$('#judul').val(pecah[2]);
								$('#idPendamping1').val(pecah[3]);
								$('#namaPendamping1').val(pecah[4]);
								$('#idPendamping2').val(pecah[5]);
								$('#namaPendamping2').val(pecah[6]);
								$('#idPendamping3').val(pecah[7]);
								$('#namaPendamping3').val(pecah[8]);
								$('#kelas').val(pecah[11]);
								$('#jurusan').val(pecah[10]);
								$('#nipketuapenguji').val(pecah[12]);
								$('#nipsekretaris').val(pecah[13]);
								$('#bungkus').show();
								$('.peringatan').html('<div id="warning"><div role="alert"></div></div>')
							}else{
								$('.peringatan').html('<div id="warning"><div class="alert alert-warning" role="alert">Mahasiswa dengan NPM ini tidak ditemukan!</div></div>')
								$('#NPM').focus();	
								$('#simpan').hide();
								}
						}
					});
				}
			} 
		});

	});
</script>

<style>
	.checkbox2{	width:20px; height:20px; float:left; }
</style>
<body>
<section class="content-header">
  <h1>
   Data Surat-surat
  </h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo $base?>"><i class="fa fa-dashboard"></i> Home</a></li>
    <li><a href="<?php echo $base?>">Surat Ijin</a></li>
    <li class="active">Tambah Surat Aktif Keterangan Kuliah</li>
  </ol>
</section>
<section class="content">
 	<div class="row">
    	<div class="col-md-12">
        	 <div class="box box-info">
                <div class="box-header">
                  <h3 class="box-title">Surat Keterangan Aktif Kuliah</h3>
                </div>
                <div class="box-body">
                        
                        <div class="peringatan">
                        </div>

                	<form method="post" action="<?php echo $base?>query-add-surat-keterangan-aktif-kuliah">
                         <div class="form-group">
                            <label for="Operator" class="control-label">Nomer Surat</label>
                            <input type="text" name="nomer" required="required" class="form-control"  placeholder="nomer surat" value="/UW-FE/PD-10/">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Nama Mahasiswa</label>
                            <div class="input-group">
                                <input type="text" name="nama" required="required" class="form-control"  placeholder="nama mahasiswa" id="nama">
                                <span class="input-group-addon">
                                    <i class="glyphicon glyphicon-search" id="cari3"></i>
                                </span>
							</div>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">NPM</label>
                            <input type="text" name="npm" required="required" class="form-control"  placeholder="NPM" id="npm">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Tahun Akademik</label>
                            <input type="text" name="tahun" required="required" class="form-control"  placeholder="tahun kuliah">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">semester</label>
							<select name="semester" class="form-control" name="semester">
								<option value="I">I</option>
								<option value="II">II</option>
								<option value="III">III</option>
								<option value="IV">IV</option>
								<option value="V">V</option>
								<option value="VI">VI</option>
								<option value="VII">VII</option>
								<option value="VIII">VIII</option>
								<option value="IX">IX</option>
								<option value="X">X</option>
								<option value="XI">XI</option>
								<option value="XII">XII</option>
								<option value="XIII">XIII</option>
								<option value="XIV">XIV</option>
							</select>
						 </div>
                         <div class="form-group">
                            <button type="submit" class="btn btn-default"><i class='glyphicon glyphicon-ok'></i> Simpan</button>
                         </div>
                    </form>
                </div>
               </div>
         </div>
    </div>
</section>

    	
    	
<link href="<?php echo $base?>plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $base?>plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/datatables/dataTables.bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
  $(document).ready(function(){
	$("#example1").dataTable();
	
  });
</script>

<div id="myModal1" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Daftar Dosen</h4>
      </div>
      <div class="modal-body">
      	<div class="table-responsive">
          <table id="example1" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Dosen</th>
                    <th>NIK / NIP</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataDosen->get_data_dosen('',$a,'jumlah');
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $DataDosen->get_data_dosen('Id',$a,'');
						$NIDN = $DataDosen->get_data_dosen('NIDN', $a, '');
						$Nama = $DataDosen->get_data_dosen('Nama',$a,'');
						$NIK = $DataDosen->get_data_dosen('NIP',$a,'');
						
						echo "<tr ids='".$id."-".$Nama."-".$NIK."' class='odd gradeX context pilih1'>";
						echo "<td>".$id."</td>";
						echo "<td>".$Nama."</td>";
						echo "<td>".$NIK."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(document).ready(function(){
		$('.pilih1').click(function(){
			var kode = $(this).attr('ids');
			var pecah = kode.split("-");	
				kodeDosen = pecah[0];
				bendahara = pecah[1];
				nip = pecah[2];
				
			$('#dosen').val(bendahara);
			$('#nipdosen').val(nip);
			$('#myModal1').modal('hide')
		});
	});
</script>
   
   
<link href="<?php echo $base?>plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $base?>plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/datatables/dataTables.bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
  $(document).ready(function(){
	$("#example2").dataTable();
	
  });
</script>

<div id="myModal2" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Mata Kuliah</h4>
      </div>
      <div class="modal-body">
      	<div class="table-responsive">
          <table id="example2" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Mata Kuliah</th>
                    <th>Kode</th>
                    <th>SKS</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $datasp->get_matakuliah_all('',$a,'jumlah');
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $datasp->get_matakuliah_all('idmatakuliah',$a,'');
						$matakuliah = $datasp->get_matakuliah_all('matakuliah', $a, '');
						$sks = $datasp->get_matakuliah_all('sks',$a,'');
						$kode = $datasp->get_matakuliah_all('kode',$a,'');
						
						echo "<tr id='".$matakuliah."-".$kode."' class='odd gradeX context pilih2'>";
						echo "<td>".$id."</td>";
						echo "<td>".$matakuliah."</td>";
						echo "<td>".$kode."</td>";
						echo "<td>".$sks."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(document).ready(function(){
		$('.pilih2').click(function(){
			var kode = $(this).attr('id');
			var pecah = kode.split("-");	
				matakuliah = pecah[0];
				sandi = pecah[1];
				
			$('#matakuliah').val(matakuliah);
			$('#sandi').val(sandi);
			$('#myModal2').modal('hide')
		});
	});
</script>
   
<link href="<?php echo $base?>plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $base?>plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/datatables/dataTables.bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
  $(document).ready(function(){
	$("#example3").dataTable();
	
  });
</script>
<div id="myModal3" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Mahasiswa</h4>
      </div>
      <div class="modal-body">
      	<div class="table-responsive">
          <table id="example3" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>NPM</th>
                    <th>Nama</th>
                </tr>
            </thead>
            <tbody>
            <?php
		            	$JumlahData = $DataMahasiswa->get_mahasiswa_all('',$a,'jumlah');
						if ($JumlahData<=0){
							echo "<tr class='odd gradeX'>";
							echo "<td>No Data</td>";
							echo "<td></td>";
							echo "</tr>";	
						}else{
							for ($a=1;$a<=$JumlahData;$a++){
								$id = $DataMahasiswa->get_mahasiswa_all('id',$a,'');
								$NPM = $DataMahasiswa->get_mahasiswa_all('NPM',$a,'');
								$Nama = $DataMahasiswa->get_mahasiswa_all('Nama',$a,'');
								echo "<tr id='".$NPM."-".$Nama."' class='odd gradeX context pilih3'>";
								echo "<td>".$NPM."</td>";
								echo "<td>".$Nama."</td>";
								echo "</tr>";
							}
						}		
			?>
        	</tbody>
          </table>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(document).ready(function(){
		$('.pilih3').click(function(){
			var kode = $(this).attr('id');
			var pecah = kode.split("-");	
				NPM = pecah[0];
				nama = pecah[1];
				
			$('#npm').val(NPM);
			$('#nama').val(nama);
			$('#myModal3').modal('hide')
		});
	});
</script>
   
 
   
   
