<?php
session_start();
error_reporting(1);
ini_set('display_errors', 1);
require_once "../config.php";
include_once "../ichat/admin/route.php";
include_once "../ichat/admin/route.php";
if ($session->is_logged_in() != true ) {
        redirect_to(WEB_LINK.'/login');
} else {
    $current_user = User::get_specific_id($session->admin_id);
    $current_user->set_online();
    $group = $current_user->prvlg_group;
}


require_once("../ichat/admin/assets/includes/Library/SessManager.php");
require_once("../ichat/admin/assets/includes/Library/User.php");
$session = new  SessManager();


//require_once "check_admin.php";
require_once 'database1.php';
class ProductCategory extends database
{
    public function index()
    { 
		return $this->fetchAll('tb_product_category', $where);
	}
}
$msg='';
if(isset($_GET['message']))
{
	$msg=$_GET['message'];
}

$obj = new ProductCategory();	
$productCategories = $obj->index();
include 'header.php';
?>
            <!-- MAIN CONTENT-->
            <div class="main-content">
                <div class="section__content section__content--p30">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="overview-wrap">
                                    <h2 class="title-1">All Product Categories</h2>
                                    
                                </div>
								<?php if($msg !=''){echo '<span class="col-md-6 alert alert-danger pull-left">' . $msg . '</span>';}?>
                            </div>
                        </div>
                        
                        <div class="row m-t-25 m-row">
							<div class="col-lg-12">
                                <a href="add-product-category" class="btn btn-success pull-right">Add Prodiuct Category</a>
                                <div class="table-responsive table--no-card m-b-30 top-margin pull-left">
                                    <table class="table table-borderless table-data3">
                                        <thead>
                                            <tr>
                                                <th>Name</th>
												<th>Description</th>
												<th>Actions</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                           <?php
											foreach($productCategories AS $productCategory)
											{
											?>
											<tr>
												<td><?php echo htmlspecialchars($productCategory['cl_name']);?></td>
												<td><?php echo htmlspecialchars($productCategory['cl_description']);?></td>
												<td></td>
											</tr>
											<?php
											}
											?>
                                           
                                        </tbody>
                                    </table>
									
                                </div>
                            </div>
                            
                          
                        </div>
                        
                       <script>
						$(document).ready(function(){
							$('.active').removeClass('active');
							$('#customer-menu').addClass('active');
						}); 
						</script>               

  <?php
  include 'footer.php';
  ?>