<?php 
	include "php_class/class_mysql.php";
	include "php_class/class_jadwal.php";
		include "php_class/class_dosen.php";
	$DataDosen = new dataDosen;

	$DataJadwal = new dataJadwal;

	$id = $xcode;
	$nama = $DataJadwal->get_data_beban_id('nama',$id);
	$nip = $DataJadwal->get_data_beban_id('nip',$id);
	$gol = $DataJadwal->get_data_beban_id('gol',$id);
	$pangkat = $DataJadwal->get_data_beban_id('pangkat',$id);
	$jabatan = $DataJadwal->get_data_beban_id('jabatan',$id);
	$statuspegawai = $DataJadwal->get_data_beban_id('statuspegawai',$id);
	$unitkerja = $DataJadwal->get_data_beban_id('unitkerja',$id);
	$subunitkerja = $DataJadwal->get_data_beban_id('subunitkerja',$id);
	$s3 = $DataJadwal->get_data_beban_id('s3',$id);
	$satub = $DataJadwal->get_data_beban_id('satub',$id);
	$satuc = $DataJadwal->get_data_beban_id('satuc',$id);
	$satud = $DataJadwal->get_data_beban_id('satud',$id);
	$duaa =$DataJadwal->get_data_beban_id('duaa',$id);
	$duab = $DataJadwal->get_data_beban_id('duab',$id);
	$duac = $DataJadwal->get_data_beban_id('duac',$id);
	$tiga = $DataJadwal->get_data_beban_id('tiga',$id);
	$empata = $DataJadwal->get_data_beban_id('empata',$id);
	$empatb = $DataJadwal->get_data_beban_id('empatb',$id);
	$empatc = $DataJadwal->get_data_beban_id('empatc',$id);
	$limaa = $DataJadwal->get_data_beban_id('limaa',$id);
	$limab = $DataJadwal->get_data_beban_id('limab',$id);
	$tahun = $DataJadwal->get_data_beban_id('tahun',$id);
	$semester = $DataJadwal->get_data_beban_id('semester',$id);
	$tgl = $DataJadwal->get_data_beban_id('tgl',$id);
	$norek = $DataJadwal->get_data_beban_id('norek',$id);
	$minimalmengajar = $DataJadwal->get_data_beban_id('minimalmengajar',$id);
	$namas = $DataJadwal->get_data_beban_id('namas',$id);
	$struktural = $DataJadwal->get_data_beban_id('struktural',$id);
	$formb = $DataJadwal->get_data_beban_id('formb',$id);

?>

<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);?>;
		$("#cari").click(function(){
			$("#myModal1").modal('show');
		});
		$("#dosen").click(function(){
			$("#myModal2").modal('show');
		});
		$("#setting").click(function(){
			$("#myModal").modal('show');
		});
		$("#cari").click(function(){
			$("#myModal1").modal('show');
		});

	});
</script>
<script type="text/javascript">
 function hourChange(selectObj) {
   var selectIndex=selectObj.selectedIndex;
   var selectValue=selectObj.options[selectIndex].text;
   if (selectIndex == 0){
		$('#subunitkerja').show();
		$('#subunitkerja2').hide();
   } else {
		$('#subunitkerja').hide();
		$('#subunitkerja2').show();	   }
 }

</script>
<style>
	.checkbox2{	width:20px; height:20px; float:left; }
</style>
<section class="content-header">
  <h1>
   Data SAP
  </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-skripsi">Data SAP</a></li>
    <li class="active">Setting Tugas Mengajar</li>
  </ol>
</section>
<section class="content">
 	<div class="row">
    	<div class="col-md-12">
        	 <div class="box box-info">
                <div class="box-body">
                    <div class="col-sm-7" >
                        <?php 
                        $tahun = $_POST['tahun'];
                        $semester = $_POST['semester'];
                        
                            if ($tahun == '' ){
                                $tahun = '2016/2017';
                            }
                            if ($semester == '' ){
                                $semester = 'GENAP';
                            }					
                            if ($program == '') {
                                $program = 'Reguler';	
                            }	
                                        
                                echo "<H5 style='margin-bottom:15px;'>Tahun Akademik : ".$tahun."</h5>";
                                echo "<H5 style='margin-bottom:15px;'>Semester Akademik : ".$semester."</h5>";
                                
                        ?>
                    </div>
                    <div class="col-sm-5">
                    </div>
             	</div>
                <div class="box-body">
                        <div class="peringatan">
                        </div>
                	<form method="post" action="<?php echo $base?>query-edit-beban-tugas">
                    	<input type="hidden" name="semester" value="<?php echo $semester?>">
                        <input type="hidden" name="tahun" value="<?php echo $tahun?>">
                        <input type="hidden" name="id" value="<?php echo $id?>">
                        <input type="hidden" name="namas" value="<?php echo $namas?>" id="namas">
                    	<div class="form-group">
                            <label for="Operator" class="control-label">Nama Dosen</label>
                            <input type="text" name="nama"  class="form-control"  placeholder="nama dosen" id="dosen" value="<?php echo $nama?>">
                        </div>
                     	<div class="form-group">
                            <label for="Operator" class="control-label">NIP/NIDN</label>
                            <div class="input-group">
                                <input type="text" name="nip"  class="form-control"  placeholder="NIP/NIK" id="nip" value="<?php echo $nip?>">
                                <span class="input-group-addon" id="cari">
                                    <i class="glyphicon glyphicon-search" ></i>
                                </span>
							</div>
                         </div>
                    	<div class="form-group">
                            <label for="Operator" class="control-label">Nama Dosen (dicetak)</label>
                            <input type="text" name="namas"  class="form-control"  placeholder="nama dosen yang dicetak" id="namas" value="<?php echo $namas?>">
                        </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Gol/Ruang</label>
                            <input type="text" name="gol"  class="form-control"  placeholder="golongan" id="gol" value="<?php echo $gol?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Pangkat</label>
                            <input type="text" name="pangkat"  class="form-control"  placeholder="pangkat" id="pangkat" value="<?php echo $pangkat?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Jabatan Akademik</label>
                            <input type="text" name="jabatan"  class="form-control"  placeholder="jabatan" id="jabatan" value="<?php echo $jabatan?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Jabatan Struktural</label>
                            <input type="text" name="struktural"  class="form-control"  placeholder="jabatan struktural" value="<?php echo $struktural ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Status Kepegawaian</label>
                            <select name="statuspegawai"  class="form-control">
                            	<option value="<?php echo $statuspegawai?>"><?php echo $statuspegawai?></option>
                                <option value="Dosen Tetap">Dosen Tetap</option>
                                <option value="Dosen Tidak Tetap">Dosen Tidak Tetap</option>\
                                <option value="Dosen Dpk">Dosen Dpk</option>
                                <option value="Kontrak">Kontrak</option>
                                <option value="Pasca Sarjana">Pasca Sarjana</option>
                            </select>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Unit Kerja</label>
                            <select name="unitkerja"  class="form-control" id="unitkerja" onchange="hourChange(this);">
                            	<option value="Universitas Warmadewa">Universitas Warmadewa</option>
                                <option value="Lainnya">Lainnya</option>
                            </select>
						</div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Sub Unit Kerja</label>
                            <select name="subunitkerja"  class="form-control" id="subunitkerja">
                            	<option value="<?php echo $subunitkerja?>"><?php echo $subunitkerja?></option>
                                <option value="Fakultas Ekonomi">Fakultas Ekonomi</option>
								<option value="Fakultas Hukum">Fakultas Hukum</option>
								<option value="Fakultas Sastra">Fakultas Sastra</option>
								<option value="Fakultas Fisip">Fakultas Fisip</option>
								<option value="Fakultas Pertanian">Fakultas Pertanian</option>
								<option value="Fakultas Teknik">Fakultas Teknik</option>
								<option value="Fakultas Kedokteran">Fakultas Kedokteran</option>
                                <option value="Pasca Sarjana">Pasca Sarjana</option>
                                <option value="Rektorat">Rektorat</option>
                            </select>
							<input type="text" name="subunitkerja2" class="form-control" style="display:none" id="subunitkerja2">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Pendidikan Dosen S3</label>
                            <select name="s3"  class="form-control">
                                <option value="<?php echo $s3?>"><?php echo $s3?></option>
                                <option value="Tidak">Tidak</option>
                            	<option value="Ya">Ya</option>
                            </select>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Asisten Kuliah Praktikum</label>
                            <input type="number" name="satub"  class="form-control"  placeholder="asisten kuliah praktikum" value="<?php echo $satub?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Bimbingan Kuliah Kerja/Kerja Praktek</label>
                            <input type="number" name="satuc"  class="form-control"  placeholder="Bimbingan Kuliah Kerja/Kerja Praktek" value="<?php echo $satuc?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Bimbingan Skripsi</label>
                            <input type="number" name="satud"  class="form-control"  placeholder="Bimbingan Skripsi" value="<?php echo $satud?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Penelitian Kelompok / Antar Bidang</label>
                            <input type="number" name="duaa"  class="form-control"  placeholder="Penelitian Kelompok / Antar Bidang" value="<?php echo $duaa?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Penelitian Individu</label>
                            <input type="number" name="duab"  class="form-control"  placeholder="Penelitian Individu" value="<?php echo $duab?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Menulis naskah buku/ Menterjemahkan naskah buku/ Menyunting naskah buku Menulis Diklat</label>
                            <input type="number" name="duac"  class="form-control"  placeholder="Menulis naskah buku/ Menterjemahkan naskah buku/ Menyunting naskah buku Menulis Diklat" value="<?php echo $duac ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Pengabdian Masyarakat</label>
                            <input type="number" name="tiga"  class="form-control"  placeholder="Pengabdian Masyarakat" value="<?php echo $tiga ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Pembimbing Akademika</label>
                            <input type="number" name="empata"  class="form-control"  placeholder="Pembimbing Akademika" value="<?php echo $empata ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Pembinaan Kegiatan Kemahasiswaan</label>
                            <input type="number" name="empatb"  class="form-control"  placeholder="Pembinaan Kegiatan Kemahasiswaan" value="<?php echo $empatb ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Pimpinan Organisasi Inter</label>
                            <input type="number" name="empatc"  class="form-control"  placeholder="Pimpinan Organisasi Inter" value="<?php echo $empatc ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Jabatan Struktural</label>
                            <input type="number" name="limaa"  class="form-control"  placeholder="Jabatan Struktural" value="<?php echo $limaa ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Jabatan Non Struktural</label>
                            <input type="number" name="limab"  class="form-control"  placeholder="Jabatan Non Struktural" value="<?php echo $limab ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Tanggal Surat</label>
                            <input type="text" name="tgl"  class="form-control"  placeholder="tanggal surat" value="<?php echo $tgl?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">No Rekening</label>
                            <input type="text" name="norek"  class="form-control"  placeholder="no rekening" value="<?php echo $norek?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Tugas Minimal Wajib Mengajar</label>
                            <input type="number" name="minimalmengajar"  class="form-control"  value="<?php echo $minimalmengajar?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Status Kepegawaian (Form B)</label>
                            <select name="formb"  class="form-control">
                                <option value="<?php echo $formb?>"><?php echo $formb?></option>
                                <option value="Dosen Dalam">Dosen Dalam</option>
                            	<option value="Dosen Luar">Dosen Luar</option>
                                <option value="Dosen Luar Dalam">Dosen Luar Dalam</option>
                            </select>
                         </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 Dosen</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>
                    <th>Jabatan</th>
                    <th>Golongan</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 "<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,'');
						$JABATAN = $DataDosen->get_data_dosen('JABATAN',$a,'');
						$GOL = $DataDosen->get_data_dosen('GOL',$a,'');
						$PANGKAT = $DataDosen->get_data_dosen('PANGKAT',$a,'');
						
						echo "<tr ids='".$id."-".$Nama."-".$NIK."/ ".$NIDN."-".$JABATAN."-".$GOL."-".$PANGKAT."' class='odd gradeX context pilih1'>";
						echo "<td>".$id."</td>";
						echo "<td>".$Nama."</td>";
						echo "<td>".$NIK."</td>";
						echo "<td>".$JABATAN."</td>";
						echo "<td>".$GOL."</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];
				nama = pecah[1];
				nip = pecah[2];
				jabatan = pecah[3];
				gol = pecah[4];
				pangkat = pecah[5];
				
			$('#nip').val(nip);
			$('#namas').val(nama);
			$('#jabatan').val(jabatan);
			$('#gol').val(gol);
			$('#pangkat').val(pangkat);
			$('#myModal1').modal('hide')
		});
	});
</script>
   
<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(){
	$("#example2").dataTable();
	
  });
</script>

<div id="myModal2" 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">Data Dosen dari Jadwal</h4>
      </div>
      <div class="modal-body">
      	<div class="table-responsive">
          <table id="example2" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Dosen</th>
                    <th>Semester Akademik</th>
                    <th>Hari</th>
                    <th>Tahun</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataJadwal->get_data_sk_bt('',$a,'jumlah', $tahun, $semester, $program);
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id1 = $DataJadwal->get_data_sk_bt('id',$a,'', $tahun, $semester, $program);
						$dosen1 = $DataJadwal->get_data_sk_bt('dosen', $a, '', $tahun, $semester, $program);
						$semester1 = $DataJadwal->get_data_sk_bt('sm', $a, '', $tahun, $semester, $program);
						$hari1 = $DataJadwal->get_data_sk_bt('hari', $a, '', $tahun, $semester, $program);
						$tahun1 = $DataJadwal->get_data_sk_bt('tahun', $a, '', $tahun, $semester, $program);
						
						echo "<tr ids='".$id1."-".$dosen1."' class='odd gradeX context pilih2'>";
						echo "<td>".$id1."</td>";
						echo "<td>".$dosen1."</td>";
						echo "<td>".$semester1."</td>";
						echo "<td>".$hari1."</td>";
						echo "<td>".$tahun1."</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(){
		$('.pilih2').click(function(){
			var kode = $(this).attr('ids');
			var pecah = kode.split("-");	
				iddosenjd = pecah[0];
				dosen = pecah[1];
				
			$('#dosen').val(dosen);
			$('#myModal2').modal('hide')
		});
	});
</script>

<div id="myModal" 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">Setting</h4>
      </div>
      <div class="modal-body">
          <form action="<?php echo $base?>add-beban-tugas" method="post" name="cmb" style="margin-bottom:35px;" id="cmb">
            <div class="form-group">
                <label class="control-label">Tahun Akademik</label>
                <select class="form-control" name="tahun">
                <?php 
                    if ($tahun != "") {
                        echo "<option value='".$tahun."'>".$tahun."</option>";
                    }
					    $JumlahData = $DataJadwal2->get_all_tahun('',$a,'jumlah');	
                            for ($a=1;$a<=$JumlahData;$a++){
                            $tahun = $DataJadwal2->get_all_tahun('tahun',$a,'');
                       		echo "<option value=".$tahun.">".$tahun."</option>";
                        }
                ?>
                </select>
			</div>
            <div class="form-group">
                <label class="control-label">Semester</label>
                <select class="form-control" name="semester">
                <?php 
                    if ($semester != "") {
                        echo "<option value='".$semester."'>".$semester."</option>";
                    }
                ?>
                	<option value="GENAP">GENAP</option>
                    <option value="GANJIL">GANJIL</option>
                </select>
			</div>

                <button type="submit" class="btn btn-primary" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon glyphicon-ok-circle"></i> OK</button>
         </form>   
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
