<?php 
	include "php_class/class_mysql.php";
	include "php_class/class_dosen.php";
	include "php_class/class_tupoksi.php";
	include "php_class/class_pegawai.php";
	$DataPegawai = new DataPegawai;
	$DataDosen = new dataDosen;
	$DataTupoksi = new dataTupoksi;

?>

<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);?>;
		$("#namaPejabat").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-proposal">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 Data Penilaian Pegawai</h3>
                </div>
                <div class="box-body">
                        
                        <div class="peringatan">
                        </div>
					<?php
						$id = $xcode;
						$idPegawai = $DataPegawai->get_Tupoksi_single_by_id('idPegawai', $id);
						$Nama = $DataPegawai->get_Tupoksi_single_by_id('Nama', $id);
						$NIP = $DataPegawai->get_Tupoksi_single_by_id('NIP', $id);
                    	$tupoksi1 = $DataPegawai->get_Tupoksi_single_by_id('tupoksi1', $id);
						$tupoksi2 = $DataPegawai->get_Tupoksi_single_by_id('tupoksi2', $id);
						$tupoksi3 = $DataPegawai->get_Tupoksi_single_by_id('tupoksi3', $id);
						$tupoksi4 = $DataPegawai->get_Tupoksi_single_by_id('tupoksi4', $id);
						$tupoksi5 = $DataPegawai->get_Tupoksi_single_by_id('tupoksi5', $id);
					?>
                	<form method="post" action="<?php echo $base?>query-add-nilai-pegawai">
                    	<input type="hidden" name="idPegawai" id="idPegawai" value="<?php echo $idPegawai?>">
                        <input type="hidden" name="idPejabat" id="idPejabat">
                        <input type="hidden" name="tupoksi1" value="<?php echo $tupoksi1?>">
                        <input type="hidden" name="tupoksi2" value="<?php echo $tupoksi2?>">
                        <input type="hidden" name="tupoksi3" value="<?php echo $tupoksi3?>">
                        <input type="hidden" name="tupoksi4" value="<?php echo $tupoksi4?>">
                        <input type="hidden" name="tupoksi5" value="<?php echo $tupoksi5?>">
                        <div class="form-group">
                            <label class="control-label">Nama Pegawai</label>
                            <input type="text" name="nama"  class="form-control"  disabled="disabled" placeholder="nama pegawai" 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 class="control-label">Tanggal Penilaian</label>
                                <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd" data-link-field="tgl">
                                    <input required="required" class="form-control" type="text" placeholder="tanggal penilaian" readonly id="tgl" value="">
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                                    <input type="hidden" id="tgl" name="tanggal" value="" />
                                    <script type="text/javascript">
                                        $('.form_date').datetimepicker({
                                            language:  'id',
                                            weekStart: 1,
                                            todayBtn:  1,
                                            autoclose: 1,
                                            todayHighlight: 1,
                                            startView: 2,
                                            minView: 2,
                                            forceParse: 0
                                        });
                                    </script>  
                                </div>
                             </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Nama Pejabat Penilai</label>
                            <input type="text" name="namaPejabat"  class="form-control" placeholder="nama pegawai" id="namaPejabat">
                        </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">NIK Pejabat Penilai</label>
                            <input type="text" name="nik" required="required" class="form-control"  disabled="disabled" placeholder="NIK" id="nikPejabat">
                         </div>
                            <label for="Operator" style="margin-bottom:25px; border-bottom:#999 solid thin; margin-top:25px;" class="control-label">Silahkan pilih nilai untuk masing-masing tupoksi!</label>

                         <div class="form-group" style="margin-bottom:25px; border-bottom:#999 solid thin">
                            <label for="Operator" class="control-label"><?php echo $tupoksi1?></label>
                            <div class="radio">
                            	<label><input type="radio" value="SK" name="nilai1">Sangat Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="K" name="nilai1">Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="S" name="nilai1">Sedang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="B" name="nilai1">Baik</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="SB" name="nilai1">Sangat Baik</label>
                            </div>
                         </div>
                         <div class="form-group" style="margin-bottom:25px; border-bottom:#999 solid thin">
                            <label for="Operator" class="control-label"><?php echo $tupoksi2?></label>
                            <div class="radio">
                            	<label><input type="radio" value="SK" name="nilai2">Sangat Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="K" name="nilai2">Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="S" name="nilai2">Sedang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="B" name="nilai2">Baik</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="SB" name="nilai2">Sangat Baik</label>
                            </div>
                         </div>
                         <div class="form-group" style="margin-bottom:25px; border-bottom:#999 solid thin">
                            <label for="Operator" class="control-label"><?php echo $tupoksi3?></label>
                            <div class="radio">
                            	<label><input type="radio" value="SK" name="nilai3">Sangat Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="K" name="nilai3">Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="S" name="nilai3">Sedang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="B" name="nilai3">Baik</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="SB" name="nilai3">Sangat Baik</label>
                            </div>
                         </div>
                         <div class="form-group" style="margin-bottom:25px; border-bottom:#999 solid thin">
                            <label for="Operator" class="control-label"><?php echo $tupoksi4?></label>
                            <div class="radio">
                            	<label><input type="radio" value="SK" name="nilai4">Sangat Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="K" name="nilai4">Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="S" name="nilai4">Sedang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="B" name="nilai4">Baik</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="SB" name="nilai4">Sangat Baik</label>
                            </div>
                         </div>
                         <div class="form-group" style="margin-bottom:25px; border-bottom:#999 solid thin">
                            <label for="Operator" class="control-label"><?php echo $tupoksi5?></label>
                            <div class="radio">
                            	<label><input type="radio" value="SK" name="nilai5">Sangat Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="K" name="nilai5">Kurang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="S" name="nilai5">Sedang</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="B" name="nilai5">Baik</label>
                            </div>
                            <div class="radio">
                            	<label><input type="radio" value="SB" name="nilai5">Sangat Baik</label>
                            </div>
                         </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];
				
			$('#idPejabat').val(kodeDosen);
			$('#namaPejabat').val(bendahara);
			$('#nikPejabat').val(nip);			
			$('#myModal1').modal('hide')
		});
	});
</script>
