<?php 
	include "php_class/class_mysql.php";
	include "php_class/class_dosen.php";
	$DataDosen = new dataDosen;

?>

<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');
		});
		$("#namaPendamping2").click(function(){
			$("#myModal2").modal('show');
		});
		$("#namaPendamping3").click(function(){
			$("#myModal3").modal('show');
		});
		$("#namaPendamping4").click(function(){
			$("#myModal4").modal('show');
		});
		$("#namaPendamping5").click(function(){
			$("#myModal5").modal('show');
		});
		$("#wadek2").click(function(){
			$("#myModal6").modal('show');
		});
		$("#bendahara").click(function(){
			$("#myModal7").modal('show');
		});
		$("#wadek1").click(function(){
			$("#myModal8").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>
<section class="content-header">
  <h1>
   Data SAP
  </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?>data-skripsi">Data SAP</a></li>
    <li class="active">Setting Tugas Mengajar</li>
  </ol>
</section>
<section class="content">
 	<div class="row">
    	<div class="col-md-12">
        	 <div class="box box-info">
                <div class="box-body">
                        
                        <div class="peringatan">
                        </div>
					<?php
            include "php_class/class_jadwal.php";
			$DataJadwal = new dataJadwal;
			$DataJadwal1 = new dataJadwal;
			$DataJadwal2 = new dataJadwal;
			$id =  $xcode;
			$program =  $xcode2;
			//echo $program;
			$dosen = $DataJadwal->get_sk_by_id('dosen',$id);
			$sm = $DataJadwal->get_sk_by_id('sm',$id);
			$tahunset = $DataJadwal2->get_setting('tahun');
			$semester = $DataJadwal2->get_setting('semester');
			$tahunset = $DataJadwal2->get_setting('tahun');
			$tanggalrapat = $DataJadwal2->get_setting('tanggalrapat');
			$tanggalmulai = $DataJadwal2->get_setting('tanggalmulai');
			$tanggalakhir = $DataJadwal2->get_setting('tanggalakhir');
			$tanggalsurat = $DataJadwal2->get_setting('tanggalsurat');
			$nidn = $DataJadwal1->get_temp_nama('nidn', $dosen);
			$pangkat = $DataJadwal1->get_temp_nama('pangkat', $dosen);
			$nip = $DataJadwal1->get_temp_nama('nip', $dosen);
			$namas = $DataJadwal1->get_temp_nama('namas', $dosen);
			$nosk = $DataJadwal2->get_setting('nosk');
			
			if ($namas == ''){
				$namas = $dosen;	
			}
			
			
			$nosk = "/UW-FE/PD-10/";
			
					?>
                	<form method="post" action="<?php echo $base?>query-set-tugas-mengajar">
                    	<input type="hidden" name="id" value="<?php echo $id?>">
                        <input type="hidden" name="nama" value="<?php echo $dosen?>">
                        <input type="hidden" name="program" value="<?php echo $program?>">
                        <input type="hidden" name="namas" value="<?php echo $namas?>" id="namas">
                        <div class="form-group">
                            <label class="control-label">Semester</label>
                            <select class="form-control" name="semester">
                            	<option value="<?php echo $sm?>"><?php echo $sm?></option>
                                <option value="GANJIL">GANJIL</option>
                                <option value="GENAP">GENAP</option>
                            </select>
                        </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">No SK</label>
                            <input type="text" name="nosk" required="required" class="form-control"  placeholder="No SK." value="<?php echo $nosk?>">
                         </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Tahun (contoh : 2016/2017)</label>
                            <input type="text" name="tahun" required="required" class="form-control"  placeholder="tahun" value="<?php echo $tahunset?>">
                         </div>
                         <div class="form-group">
                            <label class="control-label">Tanggal Rapat (contoh: 1 Januari 2017)</label>
                            <input type="text" name="tanggalrapat" required="required" class="form-control"  placeholder="tanggal rapat" value="<?php echo $tanggalrapat?>">
                         </div>
                         <div class="form-group">
                            <label class="control-label">Tanggal Mulai Ajaran (contoh: 1 Januari )</label>
                            <input type="text" name="tanggalmulai" required="required" class="form-control"  placeholder="tanggal mulai" value="<?php echo $tanggalmulai?>">
                         </div>
                         <div class="form-group">
                            <label class="control-label">Tanggal Akhir Ajaran (contoh: 1 Januari tahun 2017)</label>
                            <input type="text" name="tanggalakhir" required="required" class="form-control"  placeholder="tanggal akhir" value="<?php echo $tanggalakhir?>">
                         </div>
                         <div class="form-group">
                            <label class="control-label">Tanggal Surat (contoh: 1 Januari 2017)</label>
                            <input type="text" name="tanggalsurat" required="required" class="form-control"  placeholder="tanggal surat" value="<?php echo $tanggalsurat?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">NIP/NIK Dosen - <?php echo $dosen?></label>
                            <div class="input-group">
                                <input type="text" name="nip" required="required" class="form-control"  placeholder="NIP/NIK" id="nip" value="<?php echo $nip?>">
                                <span class="input-group-addon">
                                    <i class="glyphicon glyphicon-search" id="cari"></i>
                                </span>
							</div>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Pangkat/Golongan</label>
                            <input type="text" name="pangkat" required="required" class="form-control"  placeholder="pangkat / golongan" id="jabatan" value="<?php echo $pangkat?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">NIDN</label>
                            <input type="text" name="nidn" required="required" class="form-control"  placeholder="NIDN" id="nidn" value="<?php echo $nidn?>">
                         </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>
                    <th>Jabatan</th>
                    <th>Golongan</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 "<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,'');
						$JABATAN = $DataDosen->get_data_dosen('JABATAN',$a,'');
						$GOL = $DataDosen->get_data_dosen('GOL',$a,'');
						
						echo "<tr ids='".$id."-".$Nama."-".$NIK."-".$JABATAN." / ".$GOL."-".$NIDN."' class='odd gradeX context pilih1'>";
						echo "<td>".$id."</td>";
						echo "<td>".$Nama."</td>";
						echo "<td>".$NIK."</td>";
						echo "<td>".$JABATAN."</td>";
						echo "<td>".$GOL."</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];
				nama = pecah[1];
				nip = pecah[2];
				jabatan = pecah[3];
				nidn = pecah[4];
				
			$('#nip').val(nip);
			$('#namas').val(nama);
			$('#jabatan').val(jabatan);
			$('#nidn').val(nidn);
			$('#myModal1').modal('hide')
		});
	});
</script>
   
