<?php
error_reporting(E_ALL);
ini_set('display_errors',1);

session_start();
require_once "check_admin.php";
if(!isset($_SESSION['user_type']) || $_SESSION['user_type'] !='staff')
    {
            header('Location: ../admin/');
            exit;
    }
require_once 'database.php';
class new_category extends database
{
   

	public function GetAll()
    {
        
        return $this->fetchAll('menu_item');
    }
   
   
     public function CurrentCat($id)
    {
        $where['id']=$id;
        return $this->fetchRow('menu_category', $where);
    }
}
$cat = new new_category();

 include 'header.php';
 ?>
<div class="ordes-content">
    <div class="container midle-order">
        <div class="row">
        
            <div class="col-md-12">
                
                <div class="order-wraper">
                	<div class="col-md-12">
                    	<h1>Menu List</h1>
                    </div>
                    <div class="clearfix"></div>
                    <div class="col-sm-12">
                    	<div class="curent-user">
                        	<div class="row">
								
                                <div class="col-sm-12">
                                    <div class="curent-user-nav">
									<table class="table table-responsive"> 
											<tr>
												<th>Name</th>
												<th>Price</th>
												<th>Category</th>
												
											</tr>
											<?php
											 $items = $cat->GetAll();
											 foreach($items as $u)
											 {
											  $ca= 	$cat->CurrentCat($u['cat_id']);
											?>
											<tr>
												<td><?php echo htmlspecialchars($u['name']);?></td>
												<td><?php echo htmlspecialchars($u['price']);?></td>
												<td><?php echo htmlspecialchars($ca['name']);?></td>
											
											</tr>
											<?php
											
											 }
											?>
                                </table>
                                    	
                                    </div>
                            	</div>
                                
                        	</div>                            
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
	</div>
</div>

    </script>

    <script>
    $(document).ready(function(){
        $('.menu-item').removeClass('active');
        $('#cenas-menu').addClass('active');
    }); 
</script>
<?php include 'footer.php';?>