<?php
session_start();
include_once "../config.php";
require_once '../database1.php';
require_once "../check_admin.php";
class userOrder extends database
{
    public function index()
    { 
		return $this->fetchAll('tb_checkout', null, 'cl_created_at', 'DESC');
	}
	 public function getUser($uid)
    { 
		$where['id']=$uid;
		return $this->fetchRow('user',$where);
	}
}
$msg='';
if(isset($_GET['message']))
{
	$msg=$_GET['message'];
}

$obj = new userOrder();	
$userOrders = $obj->index();
include '../header.php';
?>
            <!-- MAIN CONTENT-->
            <div class="main-content">
                <div class="section__content section__content--p30">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-md-12">
                                <div class="overview-wrap">
                                    <h2 class="title-1">All User Orders</h2>
                                    
                                </div>
								
                            </div>
                        </div>
                        
                        <div class="row m-t-25 m-row">
							<div class="col-lg-12">
                                                         
                                <div class="table-responsive table--no-card m-b-30 top-margin pull-left">
                                    <table class="table table-borderless table-data3">
                                        <thead>
                                            <tr>
												
                                               
												<th>Name &amp; Shipping Address</th>
												<th>Mobile</th>
												<th>Email</th>
												<th>
													Invoice Number
												</th>
												<th>
													Created At
												</th>
												<th>Actions</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                           <?php
											foreach($userOrders AS $orders)
											{
												$uid=$orders['cl_user_id'];
												if($orders['cl_user_id'])
												{
												//$us = $obj->getUser($uid);
												}
											?>
											<tr class="action-container">
												
												
												<td><?php echo htmlspecialchars($orders['cl_fname']).' '.htmlspecialchars($orders['cl_surname']);?>
												<br/><?php echo htmlspecialchars($orders['cl_address']);?><br/><?php echo htmlspecialchars($orders['cl_city']);?><br><?php echo htmlspecialchars($orders['cl_county']);?><br/><?php echo htmlspecialchars($orders['cl_pin']);?></td>
												<td><?php echo htmlspecialchars($orders['cl_mobile']);?></td>
												<td><?php echo htmlspecialchars($orders['cl_email']);?></td>
												<td><?php echo htmlspecialchars($orders['cl_invoice_no']) ?></td>
												<td><?php echo htmlspecialchars(date("d M Y H:i:s", strtotime($orders['cl_created_at'])));?></td>
												<td><a id="view" href="view?id=<?php  echo htmlspecialchars($orders['cl_id']); ?>" class="btn btn-primary"><i class="fa fa-eye"></i></a> <a id="edit" href="edit?id=<?php  echo htmlspecialchars($orders['cl_id']); ?>" class="btn btn-success"><i class="fa fa-edit"></i></a></td>
											</tr>
											<?php
											}
											?>
                                           
                                        </tbody>
                                    </table>
									
                                </div>
                            </div>
                            
                          
                        </div>
                        
                       <script>
						$(document).ready(function(){
							$('.active').removeClass('active');
							$('#customer-menu').addClass('active');
						}); 
						</script>               

  <?php
  include '../footer.php';
  ?>