<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>
<aside class="right-side">                
    <section class="content-header">
        <h1>
            Daftar Jadwal Hari Ini
        </h1>
        <ol class="breadcrumb">
            <li><a href="home"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Kelola Data</a></li>
            <li class="active">Data Jadwal</li>
        </ol>
    </section>
    
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
        <div class="box-body">
			<?php  
				    include("config/connection.php");
					$today = date('Y-m-d');
              		$sql ="select tb_jadwal.*, DATE_FORMAT(tb_jadwal.tanggal,'%d-%m-%Y') as tgl, tb_kapal.Nama as namakapal, tb_nahkoda.Nahkoda, pDari.Nama as dari, pTujuan.Nama as tujuan, tb_jenis_kapal.Jenis
							from tb_jadwal inner join tb_kapal on tb_jadwal.Id_Kapal = tb_kapal.Id_Kapal
							inner join tb_nahkoda on tb_jadwal.Id_Nahkoda = tb_nahkoda.Id_Nahkoda
							inner join tb_pelabuhan pDari on (pDari.Id_Pelabuhan = tb_jadwal.Dari)
							inner join tb_pelabuhan pTujuan on (pTujuan.Id_Pelabuhan = tb_jadwal.Tujuan)
							inner join tb_jenis_kapal on tb_kapal.Id_Jenis = tb_jenis_kapal.Id
							where tb_jadwal.Status = '1' and tb_jadwal.tanggal = '".$today."'";
					$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
					mysql_close($test);
					
					while($row = mysql_fetch_object($hasil)){
						$id = $row->Id_Jadwal;
						$namakapal = $row->namakapal;
						$Nahkoda = $row->Nahkoda;
						$dari = $row->dari;
						$tujuan = $row->tujuan;
						$Kuota_Order = $row->Kuota_Order;
						$Sisa = $row->Sisa;
						$tanggal = $row->tgl;
						$Waktu = $row->Waktu;
						$Jenis = $row->Jenis;
						
			?>
        	<div class="col-sm-6" style="border-radius: 7px ; padding-top:20px; padding-bottom:20px;">
                <div style="background-color:#3c8dbc; border-radius: 7px 7px 0px 0px; ">
                    <div style="padding:5px;color:#FFF; text-align:center">
                        <h3><?php echo $namakapal?></h3>
                     </div>
                </div> 
                <div class="callout callout-info" style="margin-bottom:0px">
                            <a data-toggle="modal" href="#modalInsert" data-id='<?php echo $id?>' class="open-Edit" style="float:right"><button type="submit" class="btn btn-info"><i class='glyphicon glyphicon-info-sign'></i> Info Harga Tiket</button></a>
                    <h4>Tipe Kapal : <?php echo $Jenis?></h4>
                    <h4>Kuota : <?php echo $Kuota_Order?></h4>
                    <h4>Sisa : <?php echo $Sisa?></h4>
                    
                </div> 
                <div clas="modal-body" style="padding:10px; margin-bottom:-20px;">
                    <ul class="list-group">
                        <li class="list-group-item">DARI : <?php echo $dari?></li>
                        <li class="list-group-item">TUJUAN : <?php echo $tujuan?></li>
                        <li class="list-group-item">TANGGAL : <?php echo $tanggal?></li>
                        <li class="list-group-item">WAKTU : <?php echo $Waktu?> Wita</li>
                    </ul>
                </div> 
                <div class="callout callout-info" style="margin-bottom:0px; min-height:60px;">
                	<?php if($Kuota_Order-$Sisa < 185){?>  
                    <a href="pemesanan-tiket/<?php echo $id?>" target="_blank"><button type="submit" class="btn btn-success" style="float:right; width:80px"><i class='glyphicon glyphicon-ok-circle' ></i> Pilih</button></a>
                    <a href="order-tiket/<?php echo $id?>" target="_blank"><button type="submit" class="btn btn-warning" style="float:right; margin-right:15px"><i class='glyphicon glyphicon-ticket'></i> Multi Tiket</button></a>
                	<?php } ?>
                </div>
                <div style="background-color:#3c8dbc; border-radius: 0px 0px 7px 7px; min-height:10px; ">
                </div> 
            </div>
       	<?PHP } ?>     
        </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">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                            <h4 class="modal-title" id="myModalLabel">Informasi Jadwal</h4>
                                        </div>
                                        <div class="modal-body" style="padding-left:50px; padding-right:50px;">
											<div id="isi"></div>
                                        </div> 
                                        <div class="modal-footer">
                                        	<button type="button" class="btn btn-warning" data-dismiss="modal">Tutup</button>
                                        </div>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                                <!-- /.modal-dialog -->
                            </div>


    <script>
        $(document).on("click", ".open-Edit", function () {
            var Id = $(this).data('id');
            $.ajax({
                type: "get",
                url: "data-jadwal-proses.php?actget=5&id="+ Id,
                data: "id="+Id,
                success: function(data){
					        
                    $("#isi").html(data);
					
                    $("#modalInsert").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>