<?php 
	include "php_class/class_mysql.php";
	include "php_class/class_dosen.php";
	include "php_class/class_ujianakhir.php";
	include "php_class/class_jadwal.php";
	$DataJadwal = new dataJadwal;
	$DataUjian = new dataUjian;
	$DataDosen = new dataDosen;
	
	$id = $xcode;
	$idmatakuliah = $DataUjian->get_jadwal_single_by_id('idmatakuliah',$id);
	$matakuliah = $DataUjian->get_jadwal_single_by_id('matakuliah',$id);
	$dosen = $DataUjian->get_jadwal_single_by_id('dosen',$id);
	$sks = $DataUjian->get_jadwal_single_by_id('sks',$id);
	$semester = $DataUjian->get_jadwal_single_by_id('semester',$id);
	$jurusan = $DataUjian->get_jadwal_single_by_id('jurusan',$id);
	$kelas = $DataUjian->get_jadwal_single_by_id('kelas',$id);
	$hari = $DataUjian->get_jadwal_single_by_id('hari',$id);
	$ruang = $DataUjian->get_jadwal_single_by_id('ruang',$id);
	$waktu = $DataUjian->get_jadwal_single_by_id('waktu',$id);
	$sm = $DataUjian->get_jadwal_single_by_id('sm',$id);
	$tahun = $DataUjian->get_jadwal_single_by_id('tahun',$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);?>;
		$("#dosen").click(function(){
			$("#myModal1").modal('show');
		});
		$("#matkul").click(function(){
			$("#myModal2").modal('show');
		});

	});
</script>

<style>
	.checkbox2{	width:20px; height:20px; float:left; }
</style>
<section class="content-header">
  <h1>
   Data Jadwal UAS
  </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-jadwal">UAS/UAS</a></li>
    <li class="active">Tambah Data Jadwal UAS</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">Edit Jadwal UAS</h3>
                </div>
                <div class="box-body">
                        
                        <div class="peringatan">
                        </div>

                	<form method="post" action="<?php echo $base?>query-edit-jadwal-uas">
                    	<input type="hidden" name="id" value="<?php echo $id?>">
                        <div class="form-group">
                            <label class="control-label">Mata Kuliah</label>
                            <input type="text" name="matakuliah"  class="form-control"  placeholder="mata kuliah" id="matkul" value="<?php echo $matakuliah?>">
                        </div>
                        <div class="form-group">
                            <label class="control-label">Sandi Mata Kuliah</label>
                            <input type="text" name="idmatakuliah"  class="form-control"  placeholder="sandi mata kuliah" value="<?php echo $idmatakuliah?>">
                        </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Nama Dosen</label>
                            <input type="text" name="dosen" required="required" class="form-control"  placeholder="nama dosen" id="dosen" value="<?php echo $dosen ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">SKS</label>
                            <input type="text" name="sks" required="required" class="form-control"  placeholder="sks" value="<?php echo $sks ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Semester</label>
                            <input type="text" name="semester" required="required" class="form-control"  placeholder="semester" value="<?php echo $semester ?>">
                         </div>

                        <div class="form-group">
                            <label for="Operator" class="control-label">Jurusan</label>
                            <select class="form-control" name="jurusan">
                            	<option value="<?php echo $jurusan?>"><?php echo $jurusan?></option>
                            	<option value="Akuntansi">Akuntansi</option>
                                <option value="IESP">IESP</option>
                                <option value="Manajemen">Manajemen</option>
                            </select>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Kelas</label>
                            <input type="text" name="kelas" required="required" class="form-control"  placeholder="kelas" value="<?php echo $kelas ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Hari</label>
                            <input type="text" name="hari" required="required" class="form-control"  placeholder="hari" value="<?php echo $hari ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Ruang</label>
                            <input type="text" name="ruang" required="required" class="form-control"  placeholder="ruang" value="<?php echo $ruang ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Waktu</label>
                            <input type="text" name="waktu" required="required" class="form-control"  placeholder="waktu" value="<?php echo $waktu ?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Semester Akademik</label>
                            <input type="text" name="sm" required="required" class="form-control"  placeholder="semester akademik"  value="<?php echo $sm?>">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Tahun Akademik</label>
                            <input type="text" name="tahun" required="required" class="form-control"  placeholder="tahun akademik" value="<?php echo $tahun?>">
                         </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 - Pendamping 1</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>Semester Akademik</th>
                    <th>Tahun Akademik</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataUjian->get_data_uts_all('',$a,'jumlah', $sm, $tahun);
				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 = $DataUjian->get_data_uts_all('id',$a,'', $sm, $tahun);
						$dosen = $DataUjian->get_data_uts_all('dosen', $a, '', $sm, $tahun);
						$sm = $DataUjian->get_data_uts_all('sm', $a, '', $sm, $tahun);
						$tahun = $DataUjian->get_data_uts_all('tahun', $a, '', $sm, $tahun);
						
						echo "<tr ids='".$id."-".$dosen."' class='odd gradeX context pilih1'>";
						echo "<td>".$id."</td>";
						echo "<td>".$dosen."</td>";
						echo "<td>".$sm."</td>";
						echo "<td>".$tahun."</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];
				dosen = pecah[1];
				
			$('#dosen').val(dosen);
			$('#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 Mata Kuliah</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>Sandi</th>
                    <th>Mata Kuliah</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataJadwal->get_data_matkul('',$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++){
						$Nama = $DataJadwal->get_data_matkul('matakuliah',$a,'');
						$kode = $DataJadwal->get_data_matkul('kode',$a,'');
						
						echo "<tr ids='".$kode."-".$Nama."' class='odd gradeX context pilih2'>";
						echo "<td>".$a."</td>";
						echo "<td>".$kode."</td>";
						echo "<td>".$Nama."</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("-");	
				id = pecah[0];
				mat = pecah[1];
				
			$('#idmatkul').val(id);
			$('#matkul').val(mat);
			$('#myModal2').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(){
	$("#example3").dataTable();
	
  });
</script>
