<?php 
	include "php_class/class_mysql.php";
	include "php_class/class_dosen.php";
	include "php_class/class_tupoksi.php";
	
	$DataDosen = new dataDosen;
	$DataTupoksi = new dataTupoksi;
	
	$id = $xcode;
?>

<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);?>;
		$("#nama").click(function(){
			$("#myModal1").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-npm-proposal.php",     
						success: function(data){
							var tampung = data;
							if(tampung!=404){
								$('#form1').show();
								var pecah=tampung.split(":");
								$('#namaMhs').val(pecah[0]);
								$('#namaMhs2').val(pecah[0]);
								$('#idMhs').val(pecah[3]);
								$('#kelas').val(pecah[7]);
								$('#jurusan').val(pecah[1]);
								$('#judul').val(pecah[8]);
								$('#idPendamping1').val(pecah[9]);
								$('#namaPendamping1').val(pecah[10]);																
								$('#idPendamping2').val(pecah[11]);
								$('#namaPendamping2').val(pecah[12]);																
								$('#idPendamping3').val(pecah[13]);
								$('#namaPendamping3').val(pecah[14]);	
								$('#nipPendamping1').val(pecah[15]);	
								$('#nipPendamping2').val(pecah[16]);	
								$('#nipPendamping3').val(pecah[17]);
								$('#tglProposal').val(pecah[18]);
								$('#tglProposal2').val(pecah[18]);
								$('#status').val(pecah[5]);	
																							
								
								$('#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 Penilaian Pegawai
  </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-tupoksi">Data Peilaian Pegawai</a></li>
    <li class="active">Tambah Data Penilaian Pegawai</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">Tambah Tupoksi Pegawai</h3>
                </div>
                <div class="box-body">
                        
                        <div class="peringatan">
                        </div>
					<?php
						$Nama = $DataTupoksi->get_tupoksi_by_id('Nama', $id);
						$NIP = $DataTupoksi->get_tupoksi_by_id('NIP', $id);
						$unit = $DataTupoksi->get_tupoksi_by_id('unitKerja', $id);
                    	$tupoksi1 = $DataTupoksi->get_tupoksi_by_id('tupoksi1', $id);
						$tupoksi2 = $DataTupoksi->get_tupoksi_by_id('tupoksi2', $id);
						$tupoksi3 = $DataTupoksi->get_tupoksi_by_id('tupoksi3', $id);
						$tupoksi4 = $DataTupoksi->get_tupoksi_by_id('tupoksi4', $id);
						$tupoksi5 = $DataTupoksi->get_tupoksi_by_id('tupoksi5', $id);
					?>
                	<form method="post" action="<?php echo $base?>query-edit-tupoksi">
                    	<input type="hidden" name="id" id="id" value="<?php echo $id?>">
                        <div class="form-group">
                            <label for="Operator" class="control-label">Nama Pegawai</label>
                            <input type="text" name="nama"  class="form-control"  placeholder="nama pegawai" disabled="disabled" id="nama" value="<?php echo $Nama?>">
                        </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">NIK</label>
                            <input type="text" name="nik" required="required" class="form-control"  disabled="disabled" placeholder="NIK" id="nik" value="<?php echo $NIP?>">
                         </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Unit Kerja</label>
                            <input type="text" name="unit"  class="form-control"  placeholder="unit kerja" value="<?php echo $unit?>">
                        </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Tupoksi 1</label>
                            <input type="text" name="tupoksi1"  class="form-control"  placeholder="tupoksi 1" value="<?php echo $tupoksi1?>">
                        </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Tupoksi 2</label>
                            <input type="text" name="tupoksi2" class="form-control"   placeholder="tupoksi 2" value="<?php echo $tupoksi2?>">
                         </div>
                         <div class="form-group">
    	                    <label for="Operator" class="control-label">Tupoksi 3</label>
                            <input type="text" name="tupoksi3" class="form-control"  placeholder="tupoksi 3" value="<?php echo $tupoksi3?>">
						</div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Tupoksi 4</label>
                            <input type="text" name="tupoksi4" class="form-control"   placeholder="tupoksi 4" value="<?php echo $tupoksi4?>">
                         </div>
                         <div class="form-group">
    	                    <label for="Operator" class="control-label">Tupoksi 5</label>
                            <input type="text" name="tupoksi5" class="form-control"  placeholder="tupoksi 5" value="<?php echo $tupoksi5?>">
						</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 Pegawai</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];
				
			$('#idPegawai').val(kodeDosen);
			$('#nama').val(bendahara);
			$('#nik').val(nip);			
			$('#myModal1').modal('hide')
		});
	});
</script>
