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

?>
            <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"><a href="orders.php">Orders</a></li>
                            <li class="breadcrumb-item active">Order View</li>
                        </ol>
                        <div class="row">
							<div class="col-xl-12 col-md-12">
								<div class="card card-static-2 mb-30">
									<div class="card-title-2">
										<h2 class="title1458">Order View</h2>
										<span class="order-id">Order ID - <?=$orderid;?></span> 
									</div>
									<div class="invoice-content">
										<div class="row">
											<div class="col-lg-6 col-sm-6">
												<div class="ordr-date">
													<b>Order Date :</b> <?=$_SESSION['e'];?>
												</div>
											</div>
											<div class="col-lg-6 col-sm-6">

												<div class="ordr-date right-text">
													<b>Order Date :</b><br>
													#0, <?=$_SESSION['a'];?>, <?=$_SESSION['b'];?> - <?=$_SESSION['c'];?>
												</div>
											</div>
											<div class="col-lg-12">
												<div class="card card-static-2 mb-30 mt-30">
													<div class="card-title-2">
														<h4>Recent Orders</h4>
													</div>
													<div class="card-body-table">
														<div class="table-responsive">
			<table class="table ucp-table table-hover">
				<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">Price</th>
							<th style="width:200px">Order Date</th>
							
						</tr>
				</thead>
				<tbody>
						<?php 
						 $sql=mysqli_query($conn,"SELECT * FROM place_order WHERE groups='$orderid'" );
						$sn='1';
						  while($row=mysqli_fetch_object($sql)) {
					$id=$row->user_id;
					$total=$row->final;
					$status=$row->status;
						   ?>
						<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->sub_total;?></td>
							<td>
								<span class="delivery-time"><?=$row->date;?></span>
								<!-- <span class="delivery-time">4:00PM - 6.00PM</span> -->
							</td>
							</tr>
					<?php } ?>
					
				</tbody>
			</table>
		</div>
	</div>
</div>
</div>
<div class="col-lg-7 ">
	<?php $sql=mysqli_query($conn,"SELECT * FROM `user` WHERE user_id='$id'");
		$sn='1';
		  while($row=mysqli_fetch_object($sql)) { ?>
 <strong>To</strong>	
				  <address>
					<strong class="text-blue font-size-24"><?=$row->name;?></strong><br>
					<strong class="d-inline"><?=$row->address;?>, &nbsp;<?=$row->city;?> - <?=$row->pin;?></strong><br>
					<strong>Phone: <?=$row->mobile;?> &nbsp;&nbsp;&nbsp;&nbsp; Email: <?=$row->email;?></strong>
				  </address>

<?php } ?>
</div>
<div class="col-lg-5">
<!-- <div class="order-total-dt">
	<div class="order-total-left-text">
		Service Tax
	</div>
	<div class="order-total-right-text">
		&#8377;50
	</div>
</div>
<div class="order-total-dt">
	<div class="order-total-left-text">
		Delivery Fees
	</div>
	<div class="order-total-right-text">
		&#8377;50
	</div>
</div> -->
<div class="order-total-dt">
	<div class="order-total-left-text fsz-18">
		Total Amount
	</div>
	<div class="order-total-right-text fsz-18">
		&#8377;<?=number_format($total,2);?>
	</div>
</div>
</div>
<div class="col-lg-7"></div>
<div class="col-lg-5">
<div class="select-status">
	<label for="status">Status*</label>
	<div class="status-active">
		<span>				
<?php if(isset($status)){ 
if($status == 'Completed'){ echo '<span class="badge-item badge-status" style="background-color: #78c350!important;">Complete</span>'; }

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

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

if($status == 'place'){ echo '<span class="badge-item badge-status" style="background-color: #8892d6;">New Ordrer</span>'; } }
	 ?></span>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
                        </div>
                    </div>
                </main>
               <?php include("footer.php"); ?>