<section role="main" class="content-body">
					<header class="page-header">
						<h2>Manage Orders</h2>
					
						<div class="right-wrapper pull-right">
							<ol class="breadcrumbs">
								<li>
									<a href="<?php echo base_url();?>admin">
										<i class="fa fa-home"></i>
									</a>
								</li>
								<li><span>Manage Orders</span></li>
							</ol>
					
						</div>
					</header>
						<section class="panel">
							<header class="panel-heading">
								<h2 class="panel-title">List of All Orders</h2>
							</header>
							<div class="panel-body">
								<table class="table table-bordered table-striped mb-none" id="datatable-tabletools" data-swf-path="assets/vendor/jquery-datatables/extras/TableTools/swf/copy_csv_xls_pdf.swf">
        	<thead>
												<tr>
													<th>S.No.</th>
													<th>OrderNo.</th>
                                                    <th>OrderDate</th>
													<th>UserDetails</th>
													<th>Currency</th>
                                                    <th>OrderTotal</th>
													<th>PaymentStatus</th>
													<th>Total Items</th>
													<th>Action</th>
												</tr>
											</thead>
			<tbody>
                                            <?php  $i=1;foreach($orders as $order){?>
                                            <tr data-category="active">
													<td data-title=""><?php echo $i;?></td>
                        <td data-title="Title"><h4>#<?php echo $order->oid;?></h4></td>
                        <td><?php echo date("d M Y h:i a",strtotime($order->odate));?></td>
                        <td><i class="fa fa-user"></i> <?php echo $order->first_name.' '.$order->last_name;?><br/>
                           <i class="fa fa-envelope"></i> <?php echo $order->email;?></td>
                           <td><?php echo $order->curr;?><br/><label class="label label-default"><?php echo $order->pay_method;?></label></td>
                           <td><label class="label label-primary">SubTotal :<?php echo $order->otot;?></label>
                               <label class="label label-info">Shipping :<?php echo $order->shiptot;?></label>
                               <label class="label label-default">Discount :<?php echo $order->odis;?></label>
                               <label class="label label-success">Total :<?php echo $order->ototal-$order->odis;?></label></td>
                           <td><span class="label label-default"><?php if($order->pay_status==""){echo "Transaction Pending";}else{echo $order->pay_status;}?></span><br/>
                           <span class="label label-warning"><?php echo $order->trans_id;?></span><br/>
                           <span class="label label-success"><?php echo $order->txn_ref;?></span></td>
                        <td>
                         <!-- <a href="#" id="<?php echo $order->oid;?>" data-toggle="modal" data-target="#md-default" class="btn btn-xs btn-success vieworder"><i class="fa fa-shopping-cart"> <?php echo $order->bitems;?> Items</i></a>-->
                           <a href="<?php echo base_url();?>admin/order_details/<?php echo $order->oid;?>" class="btn btn-xs btn-success vieworder"><i class="fa fa-shopping-cart"> View <?php echo $order->bitems;?> Items</i></a><br/>
                          <span class="label label-warning"> <?php echo $this->db->get_where("order_items",array("oid"=>$order->oid,"claim_pro"=>"yes"))->num_rows();?> Claimed</span>
                          
                        </td>
                        <td data-title="Action">
<div class="tg-btnsactions">
    <a class="btn btn-xs btn-danger order_delete" href="<?php echo $order->oid;?>"><i class="fa fa-trash-o"></i></a>
  
</div>
                        </td>
												</tr>
                                            <?php $i++;}?>
                                            </tbody>
        </table>
							</div>
						</section>
				</section>
                
			</div>

			
		</section>

		<!-- Vendor -->
        <script>
	$(document).ready(function(){
		$('#data-tables').dataTable();
		
		$(".vieworder").click(function(){//alert("asdfa");
			var id=$(this).attr('id');
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/vieworder',
							 data: {id:id},
							 success: function(res){
								$(".modal-body").html(res);
							 }
							 });
		});
		
		$(".order_delete").click(function(e){e.preventDefault();
		if (!confirm("Sure you want to delete?")){
				  return false;
				}
			var id=$(this).attr("href");$(this).closest("tr").remove();
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/order_delete',
							 data: {id:id},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
	});
</script>
	<script src="<?php echo base_url();?>admin_assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap/js/bootstrap.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/nanoscroller/nanoscroller.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/magnific-popup/magnific-popup.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
		
		<!-- Specific Page Vendor -->
		<script src="<?php echo base_url();?>admin_assets/vendor/select2/select2.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/extras/TableTools/js/dataTables.tableTools.min.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
		
		<!-- Theme Base, Components and Settings -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.init.js"></script>


		<!-- Examples -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.default.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.row.with.details.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.tabletools.js"></script>
</body>
</html>