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

?> 
<style >
	.badge-statuss {
    color: #fff;
    background-color:red!important;
}
</style>
            <div id="layoutSidenav_content">
                <main>
                    <div class="container-fluid">
                        <h2 class="mt-30 page-title">Locations</h2>
                        <ol class="breadcrumb mb-30">
                            <li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
                            <li class="breadcrumb-item active">Locations</li>
                        </ol>
                        <div class="row justify-content-between">
							<div class="col-lg-12">
								<a href="add_location.php?main=3&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 Locations</h4>
									</div>
									<div class="card-body-table">
										<div class="table-responsive">
											<table class="table ucp-table table-hover" id="table_id">
												<thead>
													<tr>
														
														<th style="width:60px">ID</th>
														<th>City Name</th>
														<th>Status</th>
														<th>Action</th>
													</tr>
												</thead>
												<tbody>
													<?php 
													$sql=mysqli_query($conn,"SELECT * FROM `location` WHERE 1 ORDER BY id DESC");
													$sn='1';
													while ($row=mysqli_fetch_object($sql)) {
													?>	

													<tr>
														
														<td><?=$sn++;?></td>
														<td><?=$row->city;?></td>
														<!-- <td><span class="badge-item badge-status">Active</span></td>
														<td class="action-btns">
															<a href="#" class="edit-btn"><i class="fas fa-edit"></i> Edit</a>
														</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"> Deactive</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?loc_id=<?=$row->id;?>" class="edit-btn"><i class="fas fa-trash-alt"></i>&nbsp;&nbsp;Remove</a>
														</td>
													</tr>

													<?php } ?>

													
												</tbody>
											</table>
										</div>
									</div>
								</div>
							</div>
                        </div>
                    </div>
                </main>
              <?php include("footer.php"); ?>