<?php 
	include "php_class/class_mysql.php";
	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>
	$(document).ready(function(){
	var base = <?php echo json_encode($base);?>;
		$("#namaPendamping1").click(function(){
			$("#myModal1").modal('show');
		});
		$("#namaPendamping2").click(function(){
			$("#myModal2").modal('show');
		});
		$("#namaPendamping3").click(function(){
			$("#myModal3").modal('show');
		});
		$("#ttd").click(function(){
			$("#myModal4").modal('show');
		});
		$("#ttdpenguji").click(function(){
			$("#myModal5").modal('show');
		});
		$("#kejur").click(function(){
			$("#myModal6").modal('show');
		});
		$("#wadek2").click(function(){
			$("#myModal7").modal('show');
		});

		$('#NPM').keyup(function(e){
	  		if(e.keyCode == 13){
				var npm = $('#NPM').val();
				var action = '3';
				var program = $('#program').val();
				var tahun = $('#tahun').val();
				var semester = $('#semester').val();
				var idgrup = $('#idgrup').val();
				if (npm==''){
					$('.peringatan').html('<div id="warning"><div class="alert alert-warning" role="alert">NPM Masih Kosong!</div></div>')			
				}else{
					$('.peringatan').html('<div id="warning"><img src="img/ld.gif"></div>')			
					$.ajax({
						type:"POST",
						data: "index=" + npm + "&program=" + program + "&tahun=" + tahun + "&semester=" + semester + "&grup=" + idgrup ,
						url:"<?php echo $base?>cek-npm-proposal.php",     
						success: function(data){
							var tampung = data;
							if(tampung!=404){
								$('#form1').show();
								var pecah=tampung.split(":");
								$('#namaMhs').val(pecah[0]);
								$('#namaMhs2').val(pecah[0]);
								$('#idMhs').val(pecah[3]);
								$('#kelas').val(pecah[7]);
								$('#jurusan').val(pecah[1]);
								$('#judul').val(pecah[8]);
								$('#idPendamping1').val(pecah[9]);
								$('#namaPendamping1').val(pecah[10]);																
								$('#idPendamping2').val(pecah[11]);
								$('#namaPendamping2').val(pecah[12]);																
								$('#idPendamping3').val(pecah[13]);
								$('#namaPendamping3').val(pecah[14]);	
								$('#nipPendamping1').val(pecah[15]);	
								$('#nipPendamping2').val(pecah[16]);	
								$('#nipPendamping3').val(pecah[17]);
								$('#tglProposal').val(pecah[18]);
								$('#tglProposal2').val(pecah[18]);
								$('#status').val(pecah[5]);	
																							
								
								$('#bungkus').show();
								$('.peringatan').html('<div id="warning"><div role="alert"></div></div>')
							}else{
								$('.peringatan').html('<div id="warning"><div class="alert alert-warning" role="alert">Mahasiswa dengan NPM ini tidak ditemukan!</div></div>')
								$('#NPM').focus();	
								$('#simpan').hide();
								}
						}
					});
				}
			} 
		});

	});
</script>

<style>
	.checkbox2{	width:20px; height:20px; float:left; }
</style>
<section class="content-header">
  <h1>
   Data Agenda Surat
  </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-proposal">Data Agenda Surat</a></li>
    <li class="active">Tambah Data Agenda Surat</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">Tambah Data Agenda Surat</h3>
                </div>
                <?php 
						$beranda = $xcode;
						
						if($beranda == 1){
							$ctk = 'DEKANAT';	
						}elseif($beranda == 2){
							$ctk = 'MANAJEMEN';
						}elseif($beranda == 3){
							$ctk = 'AKUNTANSI';	
						}elseif($beranda == 4){
							$ctk = 'IESP';	
						}elseif($beranda == 5){
							$ctk = 'REGULER B';
						}else{
							$ctk = 'DEKANAT';
							$beranda = 1;	
						}
				?>
                <div class="box-body">
                	<form method="post" action="<?php echo $base?>query-add-surat-keluar" enctype="multipart/form-data">
                    	<input type="hidden" name="status" value="2">
                         <div class="form-group">
                         	<label for="Operator" class="control-label">Beranda</label>
                            <select class="form-control" name="beranda">
                            	<option value="<?php echo $beranda?>"><?php echo $ctk?></option>
                            	<option value="1">DEKANAT</option>
                                <option value="2">MANAJEMEN</option>
                                <option value="3">AKUNTANSI</option>
                                <option value="4">IESP</option>
                                <option value="5">REGULER B</option>
                            </select>
                         </div>
                        <div class="form-group">
                            <label class="control-label">No Surat</label>
                            <input type="text" name="nosurat"  class="form-control"  placeholder="nomer surat">
                        </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Asal Surat</label>
                            <input type="text" name="asal" required="required" class="form-control"  placeholder="asal surat">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Prihal</label>
                            <input type="text" name="prihal" required="required" class="form-control"  placeholder="prihal">
                         </div>

                        <div class="form-group">
                            <label for="Operator" class="control-label">Tujuan / Kepada</label>
                            <input type="text" name="tujuan" required="required" class="form-control"  placeholder="tujuan">
                         </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Disposisi</label>
                            <input type="text" name="disposisi" class="form-control"  placeholder="disposisi">
                         </div>
                         <div class="form-group">
                            <label class="control-label">Tanggal Surat</label>
                            <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd" data-link-field="tglProposal2">
                                <input required="required" class="form-control" type="text" value="" placeholder="tanggal surat" readonly id="tglProposal">
                                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                                <input type="hidden" id="tglProposal2" name="tanggal" value="" />
                                <script type="text/javascript">
                                    $('.form_date').datetimepicker({
                                        language:  'id',
                                        weekStart: 1,
                                        todayBtn:  1,
                                        autoclose: 1,
                                        todayHighlight: 1,
                                        startView: 2,
                                        minView: 2,
                                        forceParse: 0
                                    });
                                </script>  
                            </div>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Dokumen</label>
                            <input type="file" name="dokumen" class="form-control" >
                         </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>

    	
    	