<?php include("header.php");
 include("side.php");
 include("../db.php");

?>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.css">
  
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js">
</script>

<style >
	.badge-statuss {
    color: #fff;
    background-color:red!important;

}
.t{
	white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

</style>
            <div id="layoutSidenav_content">
                <main>
                    <div class="container-fluid">
                        <h2 class="mt-30 page-title">Categories</h2>
                        <ol class="breadcrumb mb-30">
                            <li class="breadcrumb-item"><a href="index.php">Dashboard</a></li>
                            <li class="breadcrumb-item active">Categories</li>
                        </ol>
                        <div class="row justify-content-between">
							<div class="col-lg-12">
								<a href="add_category.php?main=5&cat=2" class="add-btn hover-btn">Add New</a>
							</div>
							
							
							<div class="col-lg-12 col-md-12">
								<div class="card card-static-2 mt-30 mb-30">
									<div class="card-title-2">
										<h4>All Categories</h4>
									</div>
									<div class="card-body-table">
										<div class="table-responsive">
											<table class="table ucp-table table-hover display" id="table_id">
												<thead>
													<tr>
														<!-- <th ><input type="checkbox" class="check-all"></th> -->
														<th >ID</th>
														<th >Image</th>
														<th>Category</th>
														<th>Description</th>
														<th>Status</th>
														<th>Action</th>
													</tr>
												</thead>
												<tbody>
													<?php 
													$sql=mysqli_query($conn,"SELECT * FROM `category` ORDER BY id DESC");
													$sn='1';
													while ($row=mysqli_fetch_object($sql)) {
													?>													
													<tr>
														<!-- td><input type="checkbox" class="check-item" name="ids[]" value="11"></td> -->
														<td><?=$sn++;?></td>
														<td>
															<div class="cate-img">
																<img src="../uploads/<?=$row->image;?>" alt="">
															</div>
														</td>
														<td style="text-transform: uppercase;" class="t"><?=$row->category_name;?> </td>
														<td class="t"><?=$row->discription;?>whe hwqe wq ei wiei hwqeihiqw hiwq eihwqe i hiwqheih wiehiwq ei werfrewwer te rtw er twet re tre t</td>
														<td>
															<?php if($row->status == '1' or $row->status == '2'){ echo '<span class="badge-item badge-status"> Active</span>'; } else { echo '<span class="badge-item badge-statuss"> Empty</span>'; }?></span></td>
														<td class="action-btns">
															<!-- <a href="#" class="edit-btn"><i class="fas fa-edit"></i>Edit</a>&nbsp;&nbsp;|&nbsp;&nbsp; -->

															<a href="delete.php?cat_id=<?=$row->id;?>" class="edit-btn"><i class="fas fa-trash-alt"></i></a>
														</td>
													</tr>
												<?php } ?>
													
												</tbody>
											</table>
										</div>
									</div>
								</div>
							</div>
                        </div>
                    </div>
                </main>
               <?php include("footer.php"); ?>
