<?php require_once('header.php'); ?>

<section class="content" style="background-color: white;">
    <div class="row">
		<div class="col-md-4" style="text-align: left;">
			<h4><i class="fa fa-map-marker"></i> Deliverd Status Update Details</h4>
		</div>
		<div class="col-md-8" style="text-align: right;"> 
		    <a href="delivery_status_update-new.php" class="btn btn-success btn-sm"><i class="fa fa-plus"></i> Create New Delivery Status</a>
		</div>
	</div> 
	
	<div class="row" style="padding-left: 10px;padding-right: 10px;margin-top:10px;">
	    <div class='col-md-2 col-sm-6'>
                 <label for="from">From Date:</label>
                 <input type="date" id="from_date" class="form-control" value="<?php echo date("Y-m-d") ?>" name="from_date" onchange="date_changed()">
        </div>
        <div class='col-md-2 col-sm-6'>
             <label for="to">To Date:</label>
             <input type="date" id="to_date" class="form-control" value="<?php echo date("Y-m-d") ?>" name="to_date" onchange="date_changed()">
        </div>
        
        
		
    </div>
    
	<div class="row">
		<div class="col-md-12">
			<div>
			<div class="box-body table-responsive">
					<table id="employee-grid"  class="table table-bordered table-striped">
						<thead>
							<tr>
								<th width="30">S.No</th>
								<th>View</th>
								<th>Delivery Status No</th>
								<th>Total Shipment</th>
								<th>Total Box</th>
								<th>Total Wt</th>
								<th>Date</th>
								<th>Status</th>
							</tr>
						</thead>
					</table>
				</div>
			</div>
		</div>
	</div>
</section>
<?php require_once('footer.php'); ?>

<script type="text/javascript">
$(document).ready(function(){
    getData();
});

function date_changed(){
    var from_date=$('#from_date').val();
    var to_date=$('#to_date').val();
    if(from_date!='' && to_date!=''){
        getData();
    }
}
function getData(){
    var from_date=$('#from_date').val();
    var to_date=$('#to_date').val();
    
    var dataTable = $('#employee-grid').DataTable( {
		"processing": true,
		"serverSide": true,    
        "destroy":true,
        "ajax":{
			url : "data-tables/delivery-status-update-data-table.php",
			type: "post",
			data:{'type':2,from_date:from_date,to_date:to_date},
			error: function(){ 
				$(".employee-grid-error").html("");
				$("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="10" style="text-align;center;">No data found in the server</th></tr></tbody>');
				$("#employee-grid_processing").css("display","none");
			}
		}
	} );
    }
</script>