<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');
		$('#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-dosen/'+ kode +'';
	});
	
	$('#nonaktif').click(function(){
		var kode = $('#kodekunci').val();
		if (confirm("Anda yakin me-nonaktifkan data dengan kode " + kode+"?")){
			window.location=''+base+'query-delete-dosen/'+ kode +'';	
		}
	});
	
	$('#newdata').click(function(){
		window.location=''+base+'add-dosen';
	});

  });
   
</script>
<script type="text/javascript">
    var detik = <?php echo date('s'); ?>;
    var menit = <?php echo date('i'); ?>;
    var jam   = <?php echo date('H'); ?>;
    
    function clock()
    {
        if (detik!=0 && detik%60==0) {
            menit++;
            detik=0;
        }
        second = detik;
        
        if (menit!=0 && menit%60==0) {
            jam++;
            menit=0;
        }
        minute = menit;
        
        if (jam!=0 && jam%24==0) {
            jam=0;
        }
        hour = jam;
        
        if (detik<10){
            second='0'+detik;
        }
        if (menit<10){
            minute='0'+menit;
        }
        
        if (jam<10){
            hour='0'+jam;
        }
        waktu = hour+':'+minute+':'+second;
        
        document.getElementById("clock").innerHTML = waktu;
        detik++;
    }

    setInterval(clock,1000);
</script>
<script type="text/javascript">
 function hourChange(selectObj) {
   var selectIndex=selectObj.selectedIndex;
   var selectValue=selectObj.options[selectIndex].text;
   if (selectIndex == 0){
		$('#penumpang').show();
		$('#kendaraan').hide();
   } else if (selectIndex == 1){
		$('#penumpang').hide();
		$('#kendaraan').show();
   }	
 }
</script>

<aside class="right-side">                
                <section class="content-header">
                    <h1>
                        Data Transaksi Pemesanan Tiket
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="home"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="#">Tiket</a></li>
                        <li class="active">Transaksi Pemesanan Tiket</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                </div><!-- /.box-header -->
        <div class="box-body">
        	<div class="col-sm-8">
                <form class="form-horizontal" role="form" method="POST" enctype="multipart/form-data" action="#">
                    <input type="hidden" name="act" value="1">
                    <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel">Pemesanan Tiket</h4>
                    </div>
                    <div class="modal-body" >
                        <div class="form-group">
                            <label for="Operator" class="control-label">No. Identitas (KTP/SIM/Lainnya)</label>
                            <input type="text" name="noidentitas" required="required" class="form-control" >
                         </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Nama</label>
                            <input type="text" name="nama" required="required" class="form-control" >
                         </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label" >Jenis Angkutan</label>
                            <select name="jenisangkutan" class="form-control" onchange="hourChange(this);">
                            	<option value="penumpang">Penumpang</option>
                                <option value="Kendaraan">Kendaraan</option>
                            </select>
                         </div>
                        <div class="form-group" id="penumpang">
                            <label for="Operator" class="control-label" >Penumpang</label>
                            <select name="penumpang" class="form-control">
                            	<option value="dewasa">Dewasa</option>
                                <option value="anak">Anak-anak</option>
                            </select>
                         </div>
                        <div class="form-group" id="kendaraan" style="display:none;">
                            <label for="Operator" class="control-label">Kendaraan</label>
                            <select name="kendaraan" class="form-control">
                            	<option value="gol1">Gol I - Sepeda</option>
                                <option value="gol2">Gol II - Sepeda Motor</option>
                            	<option value="gol1">Gol III - Sepeda Motor > 500 cc</option>
                                <option value="gol2">Gol IV A - Mobil / Sedan</option>
                            	<option value="gol1">Gol IV B - Mobil Barang Sedang</option>
                                <option value="gol2">Gol V A - Bus Sedang</option>
                            	<option value="gol1">Gol V B - Truk Sedang</option>
                                <option value="gol2">Gol VI A - Bus Besar</option>
                            	<option value="gol1">Gol VI B - Truk Besar</option>
                            </select>
                         </div>
                    </div> 
                    <div class="modal-footer">
                        <div class="form-group">  
                            <label class="col-sm-2" for="aksi"></label>      
                                <div class="col-sm-10">
                                    <button type="submit" class="btn btn-success"><i class='glyphicon glyphicon-ok'></i> Beli</button>
                                </div>
                        </div>
                    </div>
                </form>
                </div>
            <div class="col-sm-4">                
            <form class="form-horizontal" role="form" method="POST" enctype="multipart/form-data" action="data-jadwal-proses">
                    <input type="hidden" name="act" value="1">
                    <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel">Informasi Jadwal</h4>
                    </div>
                    <div style="background-color:#3c8dbc; border-radius: 7px; ">
                        <div style="padding:5px;color:#FFF; text-align:center">
                            <h3>Harga</h3>
                            <h2>Rp. 50.000</h2>
                         </div>
                    </div> 
                    <div style="background-color:#3c8dbc; border-radius: 7px;margin-top:10px; ">
                        <div style="padding:5px;color:#FFF; text-align:center">
                            <h4>Kuota : 30</h4>
                         </div>
                    </div> 
                    <div style="background-color:#3c8dbc; border-radius: 7px;margin-top:10px; ">
                        <div style="padding:5px;color:#FFF; text-align:center">
                            <h4>Sisa : 20</h4>
                         </div>
                    </div> 
                    <div class="modal-body" style="margin-top:10px; ">
                        <ul>
                            <li>Kapal : MARUTI EXPRESS</li>
                            <li>Type Kapal : SPEED BOAT</li>
                            <li>Tanggal : 10/2/2017</li>
                            <li>Waktu : 07.00 Wita</li>
                            <li>Rute : PEL. TOYA PAKEH - PEL. SANUR</li>
                        </ul>
                    </div> 

                </div>
            </form>
        </div>
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!-- /.col -->
  </div><!-- /.row -->
  
                            <div class="modal fade" id="modalInsert" tabindex="-1" role="dialog">
                                <div class="modal-dialog modal-lg">
                                    <div class="modal-content">
                                    <form class="form-horizontal" role="form" method="POST" enctype="multipart/form-data" action="data-jadwal-proses">
                                    	<input type="hidden" name="act" value="1">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                            <h4 class="modal-title" id="myModalLabel">Tambah Data Jadwal</h4>
                                        </div>
                                        <div class="modal-body" style="padding-left:50px; padding-right:50px;">
                                             <div class="form-group">
                                                <label class="control-label">Tanggal</label>
                                                <div class="input-group date form_date" data-date="" data-date-format="dd-mm-yyyy" data-link-field="tgl">
                                                    <input required="required" class="form-control" type="text" value="" readonly id="tgl2">
                                                    <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="tgl" 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">Waktu</label>
                                                <div class="input-group bootstrap-timepicker timepicker">
                                                    <input type="time" class="form-control input-small" name="Waktu">
                                                    <span class="input-group-addon">
                                                        <i class="glyphicon glyphicon-time"></i>
                                                    </span>
                                                </div>
                                             </div>
                                            <div class="form-group">
                                            <label for="Operator" class="control-label">Nama Kapal</label>
                                            <select name="Id_Kapal" id="idkapal" class="form-control">
                                        <?php  
                                                include("config/connection.php");
                                                $sql ="select * from tb_kapal where Status = '1'";
                                                $hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
                                                mysql_close($test);
                                                
                                                while($row = mysql_fetch_object($hasil)){
                                                $Id_Kapal = $row->Id_Kapal;
                                                $Nama = $row->Nama;
                                                $Jumlah_Kursi = $row->Jumlah_Kursi;
                                                                                
                                        ?>
                                            <option value="<?php echo $Id_Kapal ?>" ><?php echo $Nama?> (<?php echo $Jumlah_Kursi?>)</option>
                                         <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Kuota Order</label>
                                                <input type="number" name="Kuota_Order" required="required" class="form-control" value="1">
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Nama Nahkoda</label>
                                                <select name="Id_Nahkoda" id="idkapal" class="form-control">
											<?php  
													include("config/connection.php");
													$sql ="select * from tb_nahkoda where Status ='1'";
													$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
													mysql_close($test);
													
													while($row = mysql_fetch_object($hasil)){
														$idnahkoda = $row->Id_Nahkoda;
														$namanahkoda = $row->Nahkoda;
														$alamat = $row->Alamat;
														$telp = $row->No_Telp;
																													
											?>
												<option value="<?php echo $idnahkoda ?>" ><?php echo $namanahkoda?></option>
                                             <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Dari</label>
                                                <select name="Dari" id="dari" class="form-control">
											<?php  
												include("config/connection.php");
												$sql ="select * from tb_pelabuhan where Status ='1'";
												$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
												mysql_close($test);
												
												while($row = mysql_fetch_object($hasil)){
													$id = $row->Id_Pelabuhan;
													$nama = $row->Nama;
													$keterangan = $row->Keterangan;
																		?>
												<option value="<?php echo $id ?>" ><?php echo $nama?></option>
                                             <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Tujuan</label>
                                                <select name="Tujuan" id="tujuan" class="form-control">
											<?php  
												include("config/connection.php");
												$sql ="select * from tb_pelabuhan where Status ='1'";
												$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
												mysql_close($test);
												
												while($row = mysql_fetch_object($hasil)){
													$id = $row->Id_Pelabuhan;
													$nama = $row->Nama;
													$keterangan = $row->Keterangan;
																		?>
												<option value="<?php echo $id ?>" ><?php echo $nama?></option>
                                             <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Harga</label>
				                                <div class="input-group">
                                                    <span class="input-group-addon">Rp</span>
                                                    <input type="number" name="Harga" required="required" class="form-control" value="0">
                                              	</div>
                                             </div>
                                        </div> 
                                        <div class="modal-footer">
                                            <div class="form-group">  
                                                <label class="col-sm-2" for="aksi"></label>      
                                                    <div class="col-sm-10">
                                                        <button type="submit" class="btn btn-success"><i class='glyphicon glyphicon-save'></i> Simpan</button>
                                                    </div>
                                            </div>
                                        </div>
                                    </form>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                                <!-- /.modal-dialog -->
                            </div>


                            <div class="modal fade" id="modalEdit" tabindex="-1" role="dialog">
                                <div class="modal-dialog modal-lg">
                                    <div class="modal-content">
                                    <form class="form-horizontal" role="form" method="POST" enctype="multipart/form-data" action="data-jadwal-proses">
                                       <input type="hidden" name="act" value="2">
                                       <input type="hidden" name="id" id="id">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                            <h4 class="modal-title" id="myModalLabel">Ubah Data Jadwal</h4>
                                        </div>
                                        <div class="modal-body" style="padding-left:50px; padding-right:50px;">
                                             <div class="form-group">
                                                <label class="control-label">Tanggal</label>
                                                <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd" data-link-field="tgl">
                                                    <input required="required" class="form-control" type="text" value="" readonly id="tanggal">
                                                    <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="tgl" 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">Waktu</label>
                                                <div class="input-group bootstrap-timepicker timepicker">
                                                    <input type="time" class="form-control input-small" name="Waktu" id="Waktu">
                                                    <span class="input-group-addon">
                                                        <i class="glyphicon glyphicon-time"></i>
                                                    </span>
                                                </div>
                                             </div>
                                            <div class="form-group">
                                            <label for="Operator" class="control-label">Nama Kapal</label>
                                            <select name="Id_Kapal" id="Id_Kapal" class="form-control">
                                        <?php  
                                                include("config/connection.php");
                                                $sql ="select * from tb_kapal where Status = '1'";
                                                $hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
                                                mysql_close($test);
                                                
                                                while($row = mysql_fetch_object($hasil)){
                                                $Id_Kapal = $row->Id_Kapal;
                                                $Nama = $row->Nama;
                                                $Jumlah_Kursi = $row->Jumlah_Kursi;
                                                                                
                                        ?>
                                            <option value="<?php echo $Id_Kapal ?>" ><?php echo $Nama?> (<?php echo $Jumlah_Kursi?>)</option>
                                         <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Kuota Order</label>
                                                <input type="number" name="Kuota_Order" required="required" class="form-control" value="1" id="Kuota_Order">
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Nama Nahkoda</label>
                                                <select name="Id_Nahkoda" id="Id_Nahkoda" class="form-control">
											<?php  
													include("config/connection.php");
													$sql ="select * from tb_nahkoda where Status ='1'";
													$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
													mysql_close($test);
													
													while($row = mysql_fetch_object($hasil)){
														$idnahkoda = $row->Id_Nahkoda;
														$namanahkoda = $row->Nahkoda;
														$alamat = $row->Alamat;
														$telp = $row->No_Telp;
																													
											?>
												<option value="<?php echo $idnahkoda ?>" ><?php echo $namanahkoda?></option>
                                             <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Dari</label>
                                                <select name="Dari" id="Dari" class="form-control">
											<?php  
												include("config/connection.php");
												$sql ="select * from tb_pelabuhan where Status ='1'";
												$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
												mysql_close($test);
												
												while($row = mysql_fetch_object($hasil)){
													$id = $row->Id_Pelabuhan;
													$nama = $row->Nama;
													$keterangan = $row->Keterangan;
																		?>
												<option value="<?php echo $id ?>" ><?php echo $nama?></option>
                                             <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Tujuan</label>
                                                <select name="Tujuan" id="Tujuan" class="form-control">
											<?php  
												include("config/connection.php");
												$sql ="select * from tb_pelabuhan where Status ='1'";
												$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
												mysql_close($test);
												
												while($row = mysql_fetch_object($hasil)){
													$id = $row->Id_Pelabuhan;
													$nama = $row->Nama;
													$keterangan = $row->Keterangan;
																		?>
												<option value="<?php echo $id ?>" ><?php echo $nama?></option>
                                             <?php } ?> 
                                             	</select>  
                                             </div>
                                            <div class="form-group">
                                                <label for="Operator" class="control-label">Harga</label>
				                                <div class="input-group">
                                                    <span class="input-group-addon">Rp</span>
                                                    <input type="number" name="Harga" required="required" class="form-control" value="0" id="Harga">
                                              	</div>
                                             </div>
                                        </div> 
                                        <div class="modal-footer">
                                            <div class="form-group">  
                                                <label class="col-sm-2" for="aksi"></label>      
                                                    <div class="col-sm-10">
                                                        <button type="submit" class="btn btn-success"><i class='glyphicon glyphicon-save'></i> Simpan</button>
                                                    </div>
                                            </div>
                                        </div>
                                    </form>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                                <!-- /.modal-dialog -->
                            </div>
                            <div class="modal fade" id="modalDelete" tabindex="-1" role="dialog">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                            <h4 class="modal-title" id="myModalLabel">Non Aktif Jenis Kapal</h4>
                                        </div>
                                        <div class="modal-body">
                                            <form class="form-horizontal" role="form" name="form_kepala_delete" method="POST" enctype="multipart/form-data" id="form_kepala_delete" action="data-kapal-proses">
                                                <input type="hidden" id="idd" name="id">
                                                <input type="hidden" name="act" value="3">
                                            <p>Apakah Anda Yakin Akan Menghapus data ini?</p>
                                        </div>
                                        <div class="modal-footer"> 
                                            <button type="button" class="btn btn-warning" data-dismiss="modal">Tidak</button>
                                            <button type="submit" class="editflag btn btn-success" >Yakin</button>    
                                        </div>
                                            </form>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                                <!-- /.modal-dialog -->
                            </div>
    <script>
        $(document).on("click", ".open-Edit", function () {
            var Id = $(this).data('id');
            //event.preventDefault();
            $.ajax({
                type: "get",
                url: "data-jadwal-proses.php?actget=1",
                data: "id="+Id,
                success: function(data){
					        
                    var jdata = jQuery.parseJSON(data);
                    $('#id').val(jdata.Id_Jadwal);
					$('#Waktu').val(jdata.Waktu);
					$('#Kuota_Order').val(jdata.Kuota_Order);
					$('#Harga').val(jdata.Harga);
					$('#tanggal').val(jdata.tgl);
					$('#tgl').val(jdata.tanggal);
					
					$('#Id_Kapal').val(jdata.Id_Kapal).attr('selected',true);
                    var option = document.createElement("option");
                    option.value = jdata.Id_Kapal;
                    option.text = jdata.namakapal;
                    var select = document.getElementById("Id_Kapal");

					$('#Id_Nahkoda').val(jdata.Id_Nahkoda).attr('selected',true);
                    var option2 = document.createElement("option");
                    option2.value = jdata.Id_Nahkoda;
                    option2.text = jdata.Nahkoda;
                    var select = document.getElementById("Id_Nahkoda");

					$('#Dari').val(jdata.Dari).attr('selected',true);
                    var option3 = document.createElement("option");
                    option3.value = jdata.Dari;
                    option3.text = jdata.peldari;
                    var select = document.getElementById("Dari");

					$('#Tujuan').val(jdata.Dari).attr('selected',true);
                    var option3 = document.createElement("option");
                    option4.value = jdata.Tujuan;
                    option4.text = jdata.peltujuan;
                    var select = document.getElementById("Tujuan");
					
                    $("#modalEdit").modal('show');
                },
                error: function(){
                    alert("failure");
                }
            });
        });
        $(document).on("click", ".open-Delete", function () {
            var Id = $(this).data('id');
            //event.preventDefault();
            $('#idd').val(Id);
            $('#modalDelete').modal('show');
        });

    </script>
<script type="text/javascript">
            $('#timepicker2').timepicker({
                minuteStep: 1,
                template: 'modal',
                appendWidgetTo: 'body',
                showSeconds: true,
                showMeridian: false,
                defaultTime: false
            });
        </script>