<link href="<?php echo base_url();?>adminassets/plugins/dataTables/css/jquery.dataTables.html" rel="stylesheet" type="text/css">
<link href="<?php echo base_url();?>adminassets/plugins/dataTables/css/dataTables.bootstrap.css" rel="stylesheet" type="text/css"> 
<div class="vd_content-wrapper">
      <div class="vd_container">
        <div class="vd_content clearfix">
          <div class="vd_head-section clearfix">
            <div class="vd_panel-header">
              <ul class="breadcrumb">
                <li><a href="<?php echo base_url();?>admin">Home</a> </li>
                <li class="active">Orders</li>
              </ul>
              
 
            </div>
          </div>
          <!-- vd_head-section -->
          
          <div class="vd_title-section clearfix">
            <div class="vd_panel-header">
              <h1>Manage Orders</h1>
              
<!-- vd_panel-menu --> 
            </div>
            <!-- vd_panel-header --> 
          </div>
          <!-- vd_title-section -->
          
          <div class="vd_content-section clearfix">
            
         <div class="row">
                    <div class="col-md-12">
                     <div class="panel panel-success">
							
      <div class="panel-heading">Listing All Orders</div>
      <div class="panel-body">
                     <table class="table table-striped table-responsive table-bordered dataTable" id="data-tables">
        	<thead>
												<tr>
													<th>S.No.</th>
													<th>OrderNo.</th>
                                                    <th>OrderDate</th>
													<th>UserDetails</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",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><i class='fa fa-<?php echo strtolower($order->curr);?>'></i> <?php echo $order->ototal;?></td>
                               <td><span class="label label-default"><?php echo $order->pay_status;?></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"> <?php echo $order->bitems;?> Items</i></a>
                          
                        </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><div class="modal fade" id="md-default" tabindex="-1" role="dialog">
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                        </div>
                                        <div class="modal-body">
                                            <div class="text-center">
                                                <div class="modal-icon"><i class="fa fa-snowflake-o"></i></div>
                                                <h4>Wait! Loading Images.....</h4>
                                            </div>
                                        </div>
                                        <div class="modal-footer">
                                            <button class="btn btn-default" data-dismiss="modal">Close</button>
                                        </div>
                                    </div>
                                    <!-- /.modal-content -->
                                </div>
                                <!-- /.modal-dialog -->
                            </div>
        </table>
        </div></div>
                    </div>
                </div>
          </div>
        </div>
        <!-- .vd_content --> 
      </div>
      <!-- .vd_container --> 
    </div>
  </div>
  <!-- .container --> 
</div>
<!-- .content -->

<!-- Footer Start -->
  <footer class="footer-1"  id="footer">      
    <div class="vd_bottom ">
        <div class="container">
            <div class="row">
              <div class=" col-xs-12">
                <div class="copyright">
                  	Copyright &copy;2018 HadesIndia. All Rights Reserved 
                </div>
              </div>
            </div><!-- row -->
        </div><!-- container -->
    </div>
  </footer>
<!-- Footer END -->
  

</div>

<!-- .vd_body END  -->
<a id="back-top" href="#" data-action="backtop" class="vd_back-top visible"> <i class="fa  fa-angle-up"> </i> </a>

<!--
<a class="back-top" href="#" id="back-top"> <i class="icon-chevron-up icon-white"> </i> </a> -->

<!-- Javascript =============================================== --> 
<!-- Placed at the end of the document so the pages load faster --> 

		<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 type="text/javascript" src='<?php echo base_url();?>adminassets/plugins/jquery-ui/jquery-ui.custom.min.js'></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>

<script type="text/javascript" src="<?php echo base_url();?>adminassets/js/caroufredsel.js"></script> 
<script type="text/javascript" src="<?php echo base_url();?>adminassets/js/plugins.js"></script>

<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/breakpoints/breakpoints.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/prettyPhoto-plugin/js/jquery.prettyPhoto.js"></script> 

<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/tagsInput/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/bootstrap-switch/bootstrap-switch.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/blockUI/jquery.blockUI.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/pnotify/js/jquery.pnotify.min.js"></script>

<script type="text/javascript" src="<?php echo base_url();?>adminassets/js/theme.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/custom/custom.js"></script>

<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>adminassets/plugins/dataTables/dataTables.bootstrap.js"></script>


</body>
</html>