<?php

include_once '../includes/processes.php';
$Process = new Login_Process;

$pageLink = basename($_SERVER['REQUEST_URI']);
$Process->check_status($pageLink);
if($_SESSION['dept_id']!=7) {
	
	header("location:../");
}
 require 'db_config/config.php';

?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>I.T Asset Listing</title>
		 	<link rel="icon" type="image/ico" href="img/airicon.ico"/>

    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet"  href="customstyle.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="bootstrap/js/bootstrap.min.js"></script>
	<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
	<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  </head>
  <body>
    <header>
		<?php $Process->navigation("advance_search"); ?>
    </header> 
    <div class="container padding-top-120">
    
	  <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
        <input type="text" name="from_date" id="from_date" class="form-control" placeholder="From Date"/>
		</div>
	    <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
        <input type="text" name="to_date" id="to_date" class="form-control" placeholder="To Date"/>
		</div>
		<div class="col-md-3">
		<input type="button" name="filter" id="filter" value="Filter" class="btn btn-primary " />
		</div>
		<br>
		<br>
		<br>
		<div id="order_table" class="table-responsive">
		<table class="table table-bordered table-hover table-condensed">
		<tr>
		<th>ID</th>
		<th>USER</th>
		<th>USER STATUS</th>
		<th>DESIGNATION</th>
		<th>DEVICE</th>
		<th>BRAND</th>
		<th>MODEL NUMBER</th>
		<th>LOCATION</th>
		<th>ASSET TAGGING</th>
		<th>ASSET TAG </th>
		<th>DATE</th>
		</tr>
		<?php
		$query ="SELECT * FROM asset_info ORDER BY id desc";
 $result =mysqli_query($connect, $query);
		while($row = mysqli_fetch_array($result))
		{
		?>
		<tr>  
                               <td><?php echo $row["id"]; ?></td>  
                               <td><?php echo $row["user"]; ?></td>  
                               <td><?php echo $row["user_status"]; ?></td>  
                               <td><?php echo $row["designation"]; ?></td>  
                               <td><?php echo $row["device"]; ?></td>  
                               <td><?php echo $row["brand"]; ?></td>  
                               <td><?php echo $row["model_num"]; ?></td>  
                               <td><?php echo $row["location"]; ?></td>  
                               <td><?php echo $row["asset_tagging"]; ?></td>  
                               <td><?php echo $row["asset_tag"]; ?></td>  
                               <td><?php echo $row["date"]; ?></td>  
		</tr>  
		<?php	
		}
		?>
		</table>
	 </div>
        </div>
  </body>
</html>
<script>  
      $(document).ready(function(){  
           $.datepicker.setDefaults({  
                dateFormat: 'yy-mm-dd'   
           });  
           $(function(){  
                $("#from_date").datepicker();  
                $("#to_date").datepicker();  
           });  
           $('#filter').click(function(){  
                var from_date = $('#from_date').val();  
                var to_date = $('#to_date').val();  
                if(from_date != '' && to_date != '')  
                {  
                     $.ajax({  
                          url:"filter.php",  
                          method:"POST",  
                          data:{from_date:from_date, to_date:to_date},  
                          success:function(data)  
                          {  
                               $('#order_table').html(data);  
                          }  
                     });  
                }  
                else  
                {  
                     alert("Please Select Date");  
                }  
           });  
      });  
 </script>

