<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>
                        Laporan Data Manifest
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="home"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="#">Laporan</a></li>
                        <li class="active">Laporan Data Manifest</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 -->
                <?php 
					$dari = $_POST['dari'];
					//$dari = substr(0, 10, $dari);
					$sampai = $_POST['sampai'];
					
					if($dari == ''){
						$dari = date('Y-m-d');	
					}
					 
					if($sampai == ''){
						$sampai = date('Y-m-d');	
					}
				?>
                <form action="<?php echo $base ?>dashboard" method="post">
                <div class="col-sm-5">
                     <div class="form-group">
                        <label class="control-label">Dari 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="<?php echo $dari?>" readonly id="tgl">
                            <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="dari" 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>
                <div class="col-sm-5">
                     <div class="form-group">
                        <label class="control-label">Sampai Tanggal</label>
                        <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd" data-link-field="tgl2">
                            <input required="required" class="form-control" type="text" value="<?php echo $sampai?>" 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="tgl2" name="sampai" 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>
                <div class="col-sm-2">
					<button type="submit" class="btn btn-success" style="margin-top:25px; width:100%"><i class='glyphicon glyphicon-search'></i> Cari</button>
                </div>
                </form>
                <div class="box-body table-responsive" style="padding-top:100px">
                    <table id="example1" class="table table-bordered table-striped">
                        <thead>
                            <tr>
                                <th>No Tiket</th>
                                <th>Nama</th>
                                <th>No Identitas</th>
                                <th>Jenis Angkutan</th>
                                <th>Kategori</th>
                                <th>Kapal</th>
                                <th>Tanggal</th>
                                <th>Waktu</th>
                            </tr>
                        </thead>
                        <tbody>
           <?php
					include("config/connection.php");
              		$sql ="	select tb_tiket.*, tb_angkutan.nama as angkutan, tb_jadwal.Waktu, tb_jadwal.tanggal, tb_kapal.Nama as kapal
							from tb_tiket inner join 
							tb_angkutan on tb_angkutan.id_angkutan = tb_tiket.id_angkutan
							inner join tb_jadwal on tb_jadwal.Id_Jadwal = tb_tiket.id_jadwal
							inner join tb_kapal on tb_jadwal.Id_Kapal = tb_kapal.Id_Kapal
							where tb_jadwal.tanggal >= '".$dari."' and tb_jadwal.tanggal <= '".$sampai."'
							order by tb_jadwal.tanggal desc";
							//echo $sql;
					$hasil = mysql_query($sql) or die("Kesalahan Pada SQL");
					mysql_close($test);
					
					while($row = mysql_fetch_object($hasil)){
					    
						$idtiket = $row->id;
						$id_jadwal = $row->id_jadwal;
						$harga = $row->harga;
						$namapenumpang = $row->nama;
						$no_identitas = $row->no_identitas;
						$tanggal = $row->tanggal;
						$no_tiket = $row->no_tiket;
						$id_angkutan = $row->id_angkutan;
						$angkutan = $row->angkutan;
						$Waktu = $row->Waktu;
						$tanggal = $row->tanggal;
						$kapal = $row->kapal;
						
						if($id_angkutan == 1 or $id_angkutan == 2){
							$jenisangkutan = 'Penumpang';	
						}else{
							$jenisangkutan = 'Kendaraan';	
						}
			?>
                            <tr>
                                <td><?php echo $no_tiket?></td>
                                <td><?php echo $namapenumpang?></td>
                                <td><?php echo $no_identitas?></td>
                                <td><?php echo $jenisangkutan?></td>
                                <td><?php echo $angkutan?></td>
                                <td><?php echo $kapal?></td>
                                <td><?php echo $tanggal?></td>
                                <td><?php echo $Waktu?></td>
                            </tr>
						<?php } ?>
                        </tbody>
                    </table>
                </div><!-- /.box-body -->
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!-- /.col -->
  </div><!-- /.row -->
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
        <!-- Bootstrap -->
        <script src="js/bootstrap.min.js" type="text/javascript"></script>

        <script src="js/plugins/datatables/jquery.dataTables.js" type="text/javascript"></script>
        <script src="js/plugins/datatables/dataTables.bootstrap.js" type="text/javascript"></script>
        <!-- AdminLTE App -->
        <script src="js/AdminLTE/app.js" type="text/javascript"></script>
		<script type="text/javascript">
            $(function() {
                $("#example1").dataTable();
                $('#example2').dataTable({
                    "bPaginate": true,
                    "bLengthChange": false,
                    "bFilter": false,
                    "bSort": true,
                    "bInfo": true,
                    "bAutoWidth": false
                });
            });
        </script>
