<?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">

    
  </head>
  <body>
    <header>
    <div class="navbar navbar-default navbar-fixed-top navbar-inverse">
      <div class="container">
        <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#example">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>  
          <span class="icon-bar"></span>
        </button>
          <a href="" class="navbar-brand">Asset Listing</a>
        </div>
        <div class="collapse navbar-collapse" id="example">
          <ul class="nav navbar-nav">
            <li><a href="homepage.php"><span  class="glyphicon glyphicon-home"></span> Home</a></li>
            <li class="active"><a href="display.php"><span class="glyphicon glyphicon-list-alt"></span> View List</a></li>
            <li><a href="update_page.php"><span class="glyphicon glyphicon-pencil"></span> Update List</a></li>
			            <li><a href="advance_search.php"><span class="glyphicon glyphicon-search"></span> Advance Search</a></li>

             <li>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            <span class="glyphicon glyphicon-user"></span> Super Admin
            <span class="caret"></span>
            </a>
            <ul class="dropdown-menu">
              <li><a href="add_user.php"><span class="glyphicon glyphicon-plus-sign"></span> Add User</a></li>
              <li><a href="view_user.php"><span class="glyphicon glyphicon-list-alt"></span> View User</a></li>       
              <li><a href="add_item.php"><span class="glyphicon glyphicon-shopping-cart"></span> Add item</a></li>              
			  
            </ul>
            </li>
          </ul>
           <form action="search.php" method="POST" class="navbar-form navbar-left" role="search">
            <div class="form-group">
              <input type="text" name="search" class="form-control" placeholder="Search Here">
            </div>
            <button name="submit" type="submit" class="btn btn-primary "><span class="glyphicon glyphicon-search"></span></button>
  
          </form>
             <ul class="nav navbar-nav  navbar-left " >
		   <li>
		   <form action="homepage.php" method="POST" class="navbar-form">
            <a href="" class="dropdown-toggle" data-toggle="dropdown">
          <span class="glyphicon glyphicon-user">
		  
			</span>   
			<span class="caret"></span>
            </a>
            <ul class="dropdown-menu">
              <li><a href="change_password.php"><span class="glyphicon glyphicon-wrench"></span> Change password</a></li>
			  <li class="divider"></li>
				<li>
				<button name="logout" type="submit" class="btn btn-group-justified btn-danger">
				<span class="glyphicon glyphicon-log-out ">Logout</span>
				</button>
				</li>
            </ul>
			</form>
		  </ul>
		  <?php
        if(isset($_POST['logout']))	 
		{
			session_destroy();
			header('location:index.php');
		}
	 
	 ?>
        </div>
      </div>
    </div>
    </header> 
    <div class="container padding-top-120">
    <div class="table-responsive">
    <table class="table table-bordered table-hover table-condensed" id="myTable">
    <thead>
      <tr class="info">
            <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>
    </thead>
      <tbody>
	  <?php
$query="SELECT * FROM asset_info ORDER BY id DESC";

$get=mysqli_query($connect,$query);
while ($display=mysqli_fetch_assoc($get)){
	
	echo "<tr>";
	echo "<td>".$display['id']. "</td>";
	echo "<td>".$display['user']. "</td>";
	echo "<td>".$display['user_status']. "</td>";
	echo "<td>".$display['designation']. "</td>";
	echo "<td>".$display['device']. "</td>";
	echo "<td>".$display['brand']. "</td>";
	echo "<td>".$display['model_num']. "</td>" ;
	echo "<td>".$display['location']. "</td>";
	echo "<td>".$display['asset_tagging']. "</td>";
	echo "<td>".$display['asset_tag']. "</td>";
	echo "<td>".$display['date']. "</td>";
	echo "</tr>";
}
?>
	  </tbody>
    </table>
    </div>
	<form action="export.php" method="post" class="padding-top-20 magin-top-35" >
	<button name="export_excel" type="submit" class="btn btn-success">
		<span class="glyphicon glyphicon-save "> Download</span>
	</button>
	</form>
	<!--
	<form action="export_csv.php" method="post" class="padding-top-20 magin-top-35" >
	<button name="csv" type="submit" class="btn btn-success">
		<span class="glyphicon glyphicon-save "> Download</span>
	</button>
	</form>-->
    </div>
     <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="table/js/jquery.js"></script>
	<script src="table/js/jquery.dataTables.js"></script>
	<script src="table/js/dataTables.bootstrap.js"></script>
	
	<script>
	    $(".table").DataTable();
	</script>
<!--
	<script type="text/javascript" src="tableExport/tableExport.js"></script>
	
	<script type="text/javascript" src="tableExport/jquery.base64.js"></script>
	<script type="text/javascript" src="tableExport/html2canvas.js"></script>
			<script type="text/javascript" src="tableExport/jspdf/jspdf.js"></script>
		<script type="text/javascript" src="tableExport/jspdf/libs/sprintf.js"></script>
		<script type="text/javascript" src="tableExport/jspdf/libs/base64.js"></script>
		
	<script type="text/javascript">
		$(document).ready(function(){
			$("#pdf").click(function(){
				$("#myTable").tableExport({
					type: 'pdf',
					escape: 'false'
				});
			});
		});
	</script>
	-->
	
  </body>
</html>