<?php
	include "php_class/class_mysql.php";
	include "php_class/class_pegawai.php";
	$DataPegawai = new DataPegawai;
	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 type="text/javascript">
  $(document).ready(function(){
	var base = <?php echo json_encode($base);?>;
	
	$("#example1").dataTable();

	$('.context').click(function(e){
		var kode = $(this).attr('id');
		var ids = $(this).attr('ids');
		$('#kodekunci').val(kode);
		$('#ids').val(ids);
   		$("#menuklik").modal('show');
	});
	
	$('#editdata').click(function(){
		var kode = $('#kodekunci').val();
		window.location=''+base+'edit-tupoksi-pegawai/'+ kode +'';
	});
	$('#detil').click(function(){
		var kode = $('#ids').val();
		window.location=''+base+'data-penilaian-perpegawai/'+ 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 Pegawai Yang Dinilai</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 Pegawai yang dinilai</h3>
          <a style="float:right"  href="<?php echo $base?>add-tupoksi-pegawai" 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" style="margin-top:30px;">
          <table id="example1" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Pegawai</th>
                    <th>NIP</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataPegawai->get_Tupoksi_Pegawai('',$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 = $DataPegawai->get_Tupoksi_Pegawai('id',$a,'');
						$idPegawai = $DataPegawai->get_Tupoksi_Pegawai('idPegawai',$a,'');
						$Nama = $DataPegawai->get_Tupoksi_Pegawai('Nama', $a, '');
						$NIP = $DataPegawai->get_Tupoksi_Pegawai('NIP', $a, '');

						echo "<tr id='".$id."' ids='".$idPegawai."' class='odd gradeX context'>";
						echo "<td>".$a."</td>";
						echo "<td>".$Nama."</td>";
						echo "<td>".$NIP."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
          </div>
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!-- /.col -->
  </div><!-- /.row -->
  
</section>
		    <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">
                             <input type="hidden" value="" id="ids">
                            <div align="center">
                            <p><button type="button" class="btn btn-default" id="editdata">Edit Data</button></p>
                            </div>
                            
                         </div>
                    </div>
                </div>
              </div>
 
<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();
	
  });
	$("#nama").click(function(){
		$("#myModal1").modal('show');
	});

</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>
