<?php 
session_start();
require_once("../../includes/display_internal_user_dryout.inc.php");
require_once("../../includes/functions_internal_user_dryout.inc.php");
$obj = new data();
$connect = $obj->funConnect();
$display = new display();
$display->logout_iu();
$pagename = basename($_SERVER['PHP_SELF']);

if (isset($_REQUEST['selBType']) && $_REQUEST['selBType']!="")
{
	$selBType = $_SESSION['selBType'] = $_REQUEST['selBType'];
}
else if(isset($_SESSION['selBType']))
{
	$selBType = $_SESSION['selBType'];
}
else
{
	unset($_SESSION['selBType']);
	$selBType = '';
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php $display->title(); ?></title>
<?php $display->favicon(); ?>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<?php $display->css(); ?>
<link href="../../css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="../js/html5shiv.js"></script>
  <script src="../js/respond.min.js"></script>
<![endif]-->

<style>
		.tablesorter th{
				position: -webkit-sticky;
				background-color: white !important;
				position: sticky;
				top: -10px;
				border-top: #ddd 1px solid !important;
				z-index: 999 !important;
			}
	</style>
	
</head>
    <body class="skin-blue fixed">
        <!-- header logo: style can be found in header.less -->
        <?php $display->header_tag(); ?>
		<div class="wrapper row-offcanvas row-offcanvas-left">
            <?php $display->leftmenu(5); ?>
			<aside class="right-side">                
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        <i class="fa fa-leaf"></i>&nbsp;Ops VC&nbsp;&nbsp;&nbsp;&nbsp;<small><div class="headline text-center" id="time" style="color:#000; font-weight:bold; font-size:12px;"></div></small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="../"><i class="fa fa-home"></i> Home</a></li>
                        <li class="active">Ops VC&nbsp;&nbsp;&nbsp;>&nbsp;&nbsp;&nbsp;Historical Data - VC</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
				<!--   content put here..................-->
				<?php if(isset($_REQUEST['msg'])){
						$msg = $_REQUEST['msg'];
						if($msg == 0){?>
				<div class="alert alert-success alert-dismissable">
					<i class="fa fa-check"></i>
					<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
					<b>Congratulations!</b> Vessels in History added/updated successfully.
				</div>
				<?php }?>
				<?php if($msg == 1){?>
				<div class="alert alert-success alert-dismissable">
					<i class="fa fa-ban"></i>
					<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
					<b>Congratulations!</b> Vessels in History sheet successfully create.
				</div>
				<?php }?>
				<?php if($msg == 2){?>
				<div class="alert alert-success alert-dismissable">
					<i class="fa fa-check"></i>
					<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
					<b>Congratulations!</b> Status changed successfully.
				</div>
				<?php }}?>
				<div class="box box-primary">
					<h3 style=" text-align:center;">Historical Data - VC</h3>
				
					<form name="frm1" id="frm1" enctype="multipart/form-data" action="<?php echo $pagename;?>"/>
                        <div class="col-xs-9" style="text-align:right;">
						<a href="addhistoricaldata.php?page=7"><button class="btn btn-info btn-flat" type="button" >Add New</button></a>
                        </div>
                        <div class="col-xs-3">
                             <select name="selBType" id="selBType" class="form-control" onChange="getDefaultData();">
                             <option value="">---Select Business Type---</option>
                               <?php echo $obj->getBusinessTypeList1($selBType);?>
                              </select>                  
                        </div><!-- /.col -->
						<div style="height:10px;">
							<input type="hidden" name="txtMappingid2" id="txtMappingid2" value="" />
							<input type="hidden" name="txtStatus" id="txtStatus" value="" />
							<input type="hidden" name="txtFileName" id="txtFileName" value="" />
							<input type="hidden" name="action" id="action" value="submit" />
						</div>
                
						<div class="box-body table-responsive" style="overflow-y:auto; max-height:390px;">
							<table class="table table-bordered tablesorter table-striped" id='in_ops_at_glance' style="border-collapse: separate;">
								<thead>
									<tr>
										<th align="left">Business Type</th>
										<th align="left">Nom ID</th>
										<th align="left">Material Name</th>
										<th align="left">Vessel</th>
										<th align="left">CP Date</th>
                                        <th align="left">Voyage No.</th>
										<th align="center">Voyage Financials</th>
										<th align="left">FDA</th>
										<th align="left">Calculations</th>
                                        <th align="center">Payment / Invoice</th>
										<th align="center">Operator</th>
										<th align="center">Status</th>
									</tr>
								</thead>
								
							</table>
						</div>
					</form>	
				</div>
				<!--   content ends here..................-->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->
<?php $display->footer(); ?>
<?php $display->js(); ?>
<script src="../../js/timer.js" type="text/javascript"></script>
<link href="../../css/jquery.alerts.css" rel="stylesheet" type="text/css" />
<link href="../../css/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css" />
<script src='../../js/plugins/datatables/jquery.dataTables.min.js'></script>
<script src='../../js/jquery.autosize.js'></script>
<script language="JavaScript" type="text/javascript" src="../../js/jquery.alerts.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 

	$('.sidebar-toggle').trigger('click');
getDefaultData();
});

function getDefaultData()
{
		var table = $('#in_ops_at_glance').dataTable();
		if(table != null)table.fnDestroy();
	  
		table = $("#in_ops_at_glance").DataTable( {
			"processing": true,
			"serverSide": true,
			"stateSave": true,
			"order": [[0, 'desc']],
			"ajax": {
				"url": "options.php?id=97",
				"type": "POST",
				"dataSrc": function ( d ) {
					return d.records;
				},
				"data": function ( d ) {d.selBType=$("#selBType").val()},
			},
			"columns": [
				{ "data": "col1" },
				{ "data": "col2" },
				{ "data": "col3" },
				{ "data": "col4" },
				{ "data": "col5" },
				{ "data": "col6" },
				{ "data": "col7" },
				{ "data": "col8" },
				{ "data": "col9" },
				{ "data": "col10" },
				{ "data": "col11" },
				{ "data": "col12" },
				
			],
			"language": {
				  "zeroRecords": "SORRY CURRENTLY THERE ARE ZERO(0) RECORDS"
				},
			 "fnDrawCallback": function(oSettings, json) {
				  $('[data-toggle="tooltip"]').tooltip();	
				},	
			"columnDefs": [ 
			        
					{
						"targets": 6,
						"orderable": false
					},
					{
						"targets": 7,
						"orderable": false
					},
					{
						"targets": 8,
						"orderable": false
					},
					{
						"targets": 9,
						"orderable": false
					},
					{
						"targets": 10,
						"orderable": false
					},
					{
						"targets": 11,
						"orderable": false
					}
				]
					
		});
}




$(document).ready(function(){ 
	var voyid = '<?= $_REQUEST['voy_no']?>';

	console.log(voyid)

	if(voyid!=''){

		$('.dataTables_filter').find('input').val(voyid).keyup();

	}


});



</script>
		
</body>
</html>