<?php
	include "php_class/class_mysql.php";
	include "php_class/class_proposal.php";
	$DataProposal = new DataProposal;
?>
<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-operator/'+ 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 +'';	
		}
	});
	
	$('#cetak').click(function(){
		var kode = $('#kodekunci').val();
		window.location=''+base+'cetak-surat-penugasan/'+ kode +'';
	});

  });
   
</script>
<section class="content-header">
  <h1>
    Data Penugasan
  </h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo $base?>index"><i class="fa fa-dashboard"></i> Home</a></li>
    <li class="active">Data Penugasan</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 Penugasan</h3>
          <a style="float:right"  href="<?php echo $base?>add-surat-penugasan" class="btn btn-primary">
            <i class="glyphicon glyphicon-plus-sign"></i>
            	Daftar Penugasan
          </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>NPM</th>
                    <th>Nama Mahasiswa</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataProposal->get_penugasan('',$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 = $DataProposal->get_penugasan('id',$a,'');
						$NPM = $DataProposal->get_penugasan('NPM',$a,'');
						$namaMhs = $DataProposal->get_penugasan('namaMhs',$a,'');
						$idMhs = $DataProposal->get_penugasan('idMhs',$a,'');
						$isAktif = $DataProposal->get_penugasan('isAktif',$a,'');
						
						if ($isAktif=='1'){
							$Status = 'Aktif';
						}else{
							$Status ='Non Aktif';
						}
						echo "<tr id='".$idMhs."' class='odd gradeX context'>";
						echo "<td>".$NPM."</td>";
						echo "<td>".$namaMhs."</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-primary" id="cetak"><i class='glyphicon glyphicon-print'></i>Cetak</button></p>
                        </div>
                        
                     </div>
                </div>
            </div>
          </div>
          
          
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!-- /.col -->
  </div><!-- /.row -->
  
</section>
 
