<?php include("header.php");
 include("side.php");
 include("../db.php");
 // $id=$_GET['id'];
 

 // $sql=mysqli_query($conn,"SELECT o.product_name,o.place_id,o.date,p.address,p.city,p.pin,o.status,o.subtotal FROM place p INNER JOIN order_products o ON p.id = o.place_id WHERE 1");

 $sql=mysqli_query($conn,"SELECT * FROM `place_order` GROUP BY groups ORDER BY id DESC");

?>
<style >
	td th{
		text-align: center;
	}
</style>
            <div id="layoutSidenav_content">
                <main>
                    <div class="container-fluid">
                        <h2 class="mt-30 page-title">Orders</h2>
                        <ol class="breadcrumb mb-30">
                            <li class="breadcrumb-item"><a href="index.php">Dashboard</a></li>
                            <li class="breadcrumb-item active">Orders</li>
                        </ol>
                        <div class="row justify-content-between">
							
							
<div class="col-lg-12 col-md-12">
	<div class="card card-static-2 mb-30">
		<div class="card-title-2">
			<h4>All Orders</h4> 
		</div>
		<div class="card-body-table">
			<div class="table-responsive">
				<table class="table ucp-table table-hover" id="table_id">
					<thead>
						<tr>
							<th>ID</th>
							<th >Order ID</th>
							<th style="width:300px">Item</th>
							
							<th >Quantity</th>
							<th style="width:130px">Status</th>
							<th style="width:130px">Total</th>
							<th style="width:200px">Order Date</th>
							<th style="width:100px">Action</th>
						</tr>
					</thead>
					<tbody>
						<?php
						$sn='1';
						  while($row=mysqli_fetch_object($sql)) { ?>
						<tr>
							<td><?=$sn++;?></td>
							<td><?=$row->groups;?></td>
							<td><a href="#" target="_blank"><?=$row->product_name;?></a></td>
							<td><?=$row->quantity;?></td>
							
							<!-- <td>#, <?=$row->address;?>, <?=$row->city;?>-<?=$row->pin;?></td> -->
		<td>
				<span>				
<?php if(isset($row->status)){ 
if($row->status == 'Completed'){ echo '<span class="badge-item badge-status" style="background-color: #78c350!important;">Complete</span>'; }

if($row->status == 'Progress'){ echo '<span class="badge-item badge-status" style="background-color: #45bbe0;">Progress</span>'; }

if($row->status == 'Cancel'){ echo '<span class="badge-item badge-status" style="background-color: #fc544b;">Cancel</span>'; } 

if($row->status == 'place'){ echo '<span class="badge-item badge-status" style="background-color: #8892d6;">New Ordrer</span>'; } }
	 ?></span>
							</td>
							<td>&#8377;<?=$row->final;?></td>
							<td>
								<span class="delivery-time"><?=$row->date;?></span>
								<!-- <span class="delivery-time">4:00PM - 6.00PM</span> -->
							</td>
							<td class="action-btns">
								<a href="order_view.php?id=<?=$row->groups;?>" ><i class="fas fa-eye"></i></a>
								<a href="order_edit.php?id=<?=$row->groups;?>" class="edit-btn"><i class="fas fa-edit"></i></a>
							</td>
						</tr>
					<?php } ?>
						
												</tbody>
											</table>
										</div>
									</div>
								</div>
							</div>
                        </div>
                    </div>
                </main>
              <?php include("footer.php"); ?>