<?php
	include "php_class/class_mysql.php";
	include "php_class/class_pegawai.php";
	$DataPegawai = new DataPegawai;
	$id = $xcode;
?>
<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(){
	var base = <?php echo json_encode($base);?>;
	
	$("#example1").dataTable();
	
	$('.context').click(function(e){
		var kode = $(this).attr('id');
		$('#kodekunci').val(kode);
   		$("#menuklik").modal('show');
	});
	
	/*$('.context').bind('contextmenu', function(e){
		e.preventDefault();
    	var kode = $(this).attr('id');
		$('#kodekunci').val(kode);
   		$("#menuklik").modal('show');
	});*/
	
	$('#editdata').click(function(){
		var kode = $('#kodekunci').val();
		window.location=''+base+'edit-nilai-pegawai/'+ kode +'';
	});
	
	$('#nonaktif').click(function(){
		var kode = $('#kodekunci').val();
		if (confirm("Anda yakin me-nonaktifkan data dengan kode " + kode+"?")){
			window.location=''+base+'query-nonaktif-operator/'+ kode +'';	
		}
	});
	
	$('#newdata').click(function(){
		window.location=''+base+'add-operator';
	});

  });
   
</script>
<section class="content-header">
  <h1>
    Data Penilaian Pegawai
  </h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo $base?>index"><i class="fa fa-dashboard"></i> Home</a></li>
    <li class="active">Data Penilaian Pegawai</li>
  </ol>
</section>
<section class="content">
  <div class="row">
    <div class="col-xs-12">
     
      <div class="box">
        <div class="box-header">
          <h3 class="box-title">Data Penilaian Pegawai</h3>
          <a style="float:right"  href="<?php echo $base?>add-nilai-pegawai/<?php echo $id?>" class="btn btn-primary">
            <i class="glyphicon glyphicon-plus-sign"></i>
            Tambah Data
          </a>
        </div><!-- /.box-header -->
        <div class="box-body">
        <div class="table-responsive">
          <table id="example1" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Pegawai</th>
                    <th>Tanggal</th>
                    <th>Nilai 1</th>
                    <th>Nilai 2</th>
                    <th>Nilai 3</th>
                    <th>Nilai 4</th>
                    <th>Nilai 5</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataPegawai->get_Nilai_Pegawai('',$a,'jumlah', $id);
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $DataPegawai->get_Nilai_Pegawai('id',$a,'', $id);
						$idPegawai = $DataPegawai->get_Nilai_Pegawai('idPegawai', $a, '', $id);
						$tanggal = $DataPegawai->get_Nilai_Pegawai('tanggal', $a, '', $id);
						$nilai1 = $DataPegawai->get_Nilai_Pegawai('nilai1',$a,'', $id);
						$nilai2 = $DataPegawai->get_Nilai_Pegawai('nilai2',$a,'', $id);
						$nilai3 = $DataPegawai->get_Nilai_Pegawai('nilai3',$a,'', $id);
						$nilai4 = $DataPegawai->get_Nilai_Pegawai('nilai4',$a,'', $id);
						$nilai5 = $DataPegawai->get_Nilai_Pegawai('nilai5',$a,'', $id);
						$Nama = $DataPegawai->get_Nilai_Pegawai('Nama',$a,'', $id);

						echo "<tr id='".$id."' class='odd gradeX context'>";
						echo "<td>".$a."</td>";
						echo "<td>".$Nama."</td>";
						echo "<td>".$tanggal."</td>";
						echo "<td>".$nilai1."</td>";
						echo "<td>".$nilai2."</td>";
						echo "<td>".$nilai3."</td>";
						echo "<td>".$nilai4."</td>";
						echo "<td>".$nilai5."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
          </div>
          <div id="menuklik" class="modal fade" role="dialog">
          	<div class="modal-dialog modal-sm">
                <div class="modal-content">
                	<div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h5 class="modal-title">Aksi</h5>
                    </div>
                  	<div class="modal-body">
                        <input type="hidden" value="" id="kodekunci">
                        <div align="center">
                        <p><button type="button" class="btn btn-default" id="editdata">Edit Data</button></p>
                        </div>
                        
                     </div>
                </div>
            </div>
          </div>
          
          
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!-- /.col -->
  </div><!-- /.row -->
  
</section>
 
