<?php 

session_start();

require_once("../../includes/display_internal_user_risk.inc.php");
require_once("../../includes/functions_internal_user_riskmangement.inc.php");
$obj = new data();
$connect = $obj->funConnect();
$display = new display();
$display->logout_iu();
$ids = $_REQUEST['ids'];

$pagename = basename($_SERVER['PHP_SELF']);
$selBType = $_SESSION['selBType'];
$msg = NULL;
$rigts    = explode(',',$obj->getUserRights($_SESSION['uid'],$_SESSION['moduleid'],18));
?>

<!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" />
<?php $display->js(); ?>
<!-- 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>
.benchclass{
	background-color:#f39c12;
	color:#ffffff;
}
</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-book"></i>&nbsp;Period Contract&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">Period Contract</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> Period Contract added/updated successfully.
				</div>
				<?php }?>
				<?php if($msg == 1){?>
				<div class="alert alert-danger alert-dismissable">
					<i class="fa fa-ban"></i>
					<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
					<b>Sorry!</b> there was an error while adding/updating Period Contract.
				</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> Period Contract delete successfully.
				</div>
				<?php }}?>
				<div class="box box-primary">
				<h3 style=" text-align:center;">Period Contract List</h3>
                <form name="frm1" id="frm1" enctype="multipart/form-data" action="<?php echo $pagename;?>"/>
				    
				     <div class="row" style="padding-right:10px; padding-left:10px;">
					    <div class="col-md-6">
						</div>
					    <div class="col-md-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 class="col-md-3">
						 <?php if(in_array(2, $rigts)){?>
                            <div style="float:right;"><a href="addperiod_contract.php" title="Add New"><button type="button" class="btn btn-info btn-flat">Add New</button></a></div>
						 <?php }?>
                         </div>
                     </div>
                    
					<div >
						<input name="txttblid" id="txttblid" type="hidden" value="" />
						<input name="txttblstatus" id="txttblstatus" type="hidden" value="" />
						<input name="delId" id="delId" type="hidden" value="" />
						<input type="hidden" name="action" id="action" value="submit" />
					</div>				
					<div class="box-body table-responsive" style="overflow:auto;">
                        <table id="coa_list" class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th align="left" valign="middle" width="10%">Contract ID</th>
                                    <th align="left" valign="middle" width="10%">Contract No.</th>
                                    <th align="left" valign="middle" width="10%">Contract Date</th>
                                    <th align="left" valign="middle" width="10%">Vessel Name</th>
                                    <th align="center" valign="middle" width="12%">Own Business Account</th>
									<th align="center" valign="middle" width="8%">Working Currency</th>
									<th align="center" valign="middle" width="10%">Total Days</th>
									
									<th align="center" valign="middle" width="10%">Status</th>
                                    <th align="center" valign="middle" width="10%">Nominate</th>
                                    <th align="center" valign="middle" width="8%">Details</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div style="clear:both;"></div>
				</form>
				</div>
                
                
				<!--   content ends here..................-->
                </section><!-- /.content -->
            </aside><!-- /.right-side -->
			
			<div class="modal fade" id="compose-modal" tabindex="-1" role="dialog" aria-hidden="true">
				<div class="modal-dialog" style="width:95%">
					 <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"><i class="fa fa-file-text-o"></i>&nbsp;&nbsp;Period Contract Nominations</h4>
						</div>
						
						<div class="modal-body" id="div_3" style="overflow:auto;">
						</div>
                        
					 </div>
				</div>
			</div>
			
        </div><!-- ./wrapper -->
<?php $display->footer(); ?>
<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(){
getDefaultData();
});
function getDefaultData()
{
		var table = $('#coa_list').dataTable();
		if(table != null)table.fnDestroy();
	  
		table = $("#coa_list").DataTable( {
			"processing": true,
			"serverSide": true,
			"stateSave": true,
			"order": [[1, 'desc']],
			"ajax": {
				"url": "options.php?id=87",
				"type": "POST",
				"dataSrc": function ( d ) {
					return d.records;
				},
				"data": function ( d ) {d.businesstype=$("#selBType").val()},
			},
			"columns": [
				{ "data": "col1" },
				{ "data": "col2" },
				{ "data": "col3" },
				{ "data": "col4" },
				{ "data": "col5" },
				{ "data": "col6" },
				{ "data": "col7" },
				{ "data": "col12" },
				{ "data": "col8" },
				{ "data": "col9" },
				{ "data": "col10" },
				
			],
			"language": {
				  "zeroRecords": "SORRY CURRENTLY THERE ARE ZERO(0) RECORDS"
				},
			 "fnDrawCallback": function(oSettings, json) {
				  $('[data-toggle="tooltip"]').tooltip();	
				},	
			"columnDefs": [ 
			        

				
				{ orderable: false, targets: [ 5, 7, 8 ] } 

					
					
					
				]
					
		});
}

function getListOFEstimate(contractid)
{
	$("#div_3").html('<b style="font-size:25px;">Please wait . . .</b><br><br><img src="../../img/loading.gif"  />');
	$.post("options.php?id=88",{contractid:""+contractid+""}, function(html) {
	$("#div_3").html("");
	$("#div_3").html(html);
	$("#fce_list,#relet_list").dataTable();
	});
}
</script>
		
</body>
</html>