<?php 
require_once("header.php");
require_once("session_check.php");
?>

			<!-- page template area start -->
			<section id="about">
			    <div class="container mt-10 pb-10 pt-0">	
					<div class="row">
						<div class="col-lg-4">
							<?php require_once("user_left_panel.php");?>
						</div>
						<div class="col-lg-8">
						    <h1 class="title mt-5 mb-15" style="text-align:left;">My Orders</h1>
						<?php if(isset($_SESSION['del_succ_msg'])) { ?>
						<p><img src="images/tick.png" alt="" /> <?php echo $_SESSION['del_succ_msg'];?></p>
						<?php
						unset($_SESSION['del_succ_msg']);
						}
						?>
						<?php
						$sql_order = "SELECT * FROM `og_orders` WHERE `user_id` = '".$_SESSION['USER_ID']."' AND `transaction_completed` = 'Yes' ORDER BY `order_id` DESC";
						$exe_order = mysqli_query($connection,$sql_order);
						while($arr_order = mysqli_fetch_array($exe_order))
						{								
							?>	
							<div class="col-md-12" data-nav="false" style="border: 1px solid #ddd; background:#f1f1f1;">
								<div class="item">
									<p class="mt-10 mb-10"><span>Date</span><span style="float:right;"><?php echo date('F d, Y h:i A',strtotime($arr_order['post_date']));?></span></p>
									<p><span>Order ID</span><span style="float:right;"><?php echo $arr_order['orderid'];?></span></p>
									<p><span>Total Quantity</span><span style="float:right;"><?php echo $arr_order['total_quantity'];?></span></p>
									<p><span>Total Amount</span><span style="float:right;">&pound;<?php echo $arr_order['grand_total'];?></span></p>
									<p><span>Payment Status</span><span style="float:right;"><?php echo $arr_order['payment_status'];?></span></p>
									<p><span>Delivery Status</span><span style="float:right;"><?php echo $arr_order['delivery_status'];?></span></p>
										<p style="text-align:left;"><button type="button" class="btn btn-flat btn-theme-colored border-left-theme-color-2-4px" style="padding:6px 14px;" onclick="window.location.href='order-details.php?orderid=<?php echo $arr_order['orderid'];?>'">View Details</button></p>
								</div>	
							</div>
							<div>&nbsp;</div>
						<?php
						}
						?>										
						</div>
					</div>
				</div>
			</section>
			<!-- page template area end -->
  
<?php require_once("footer.php");?>