<!-- product list start -->
<input type="hidden" id="baseurl" value="<?php echo base_url(); ?>" >
 
						 
								
								<!------ALL ORDER TAB START----->
								 
									<div class="row">
											<div class="col-md-12">
												<div class="hs_heading medium">
													<h3>Orders (<?php if(!empty($all_uorders)) { echo count($all_uorders); }else{ echo 0; } ?>) </h3>
												</div>
												<div class="hs_datatable_wrapper">
													<table class="hs_datatable table table-bordered">
														<thead>
															<tr>
																<th>#</th>
																<th>Order Id</th>
																<th>Name</th>
																<th>Mobile</th>
																<th>Items</th>
																<th>Delivery Address</th>
																<th>Status</th>
																<th>Action</th>
															</tr>
														</thead>
														<tbody>
														<?php 
														  $i= 0;
														  if(!empty($all_uorders)){
														foreach($all_uorders as $orders){ ?>
															 <tr>
																<td><?php echo ++$i; ?></td>
																<td id="uniqid_<?php echo $orders->order_id; ?>"><?php echo $orders->order_uniqid; ?></td>
																<td width="200">
																	<div class="hs_user">
																		<div class="user_name" id="name_<?php echo $orders->order_id; ?>">
																		<?php $order_user = $this->Data_access_model->select_data('','hs_user',array('user_id'=>$orders->order_uid));
																		if($order_user->num_rows() > 0){
																			$uname = $order_user->row();
																		}
																		
																		?>
																		<p><?php if(!empty($uname->user_name)){ echo $uname->user_name; } ?></p>
																		</div>
																	</div>
																</td>
																<td id="contact_<?php echo $orders->order_id; ?>" ><?php echo $orders->order_contact; ?></td>
																<td id="pid_<?php echo $orders->order_id; ?>">
																<?php $item = json_decode($orders->order_pid);
																foreach($item as $items){
																	
																	echo '<p>'.$items->name .' X ';
																	echo $items->qty.' = ';
																	echo $this->hs->getwebsettings('currency_symbol').$items->subtotal;
																	echo '</p>';
																}
																?>
																</td>
																<td id="add_<?php echo $orders->order_id; ?>"><?php echo $orders->delivery_address; ?>
																  </td>
																<td>
																	<select class="form-control" onchange="change_order_status(this.value,<?php echo $orders->order_id; ?>);" >
																		<option value="0" <?php if($orders->order_status == 0) { echo  "selected"; }?> >Pending</option>
																		<option value="1" <?php if($orders->order_status == 1) { echo  "selected"; }?> >In Transit</option>
																		<option value="2" <?php if($orders->order_status == 2) { echo  "selected"; }?> >Delivered</option>
																		<option value="3" <?php if($orders->order_status == 3) { echo  "selected"; }?> >Canceled</option>
																	</select>
																</td>
																<td width="200">
																<a href="javascript:;" onclick="view_order_details(<?php echo $orders->order_id; ?>);" class="btn" title="View" ><i class="fa fa-eye" aria-hidden="true"></i></a>
																	<a href="<?php echo base_url().'admin/delete_order/'.$orders->order_id;  ?>" class="btn" title="Delete" onclick="return delete_confirmation()"><i class="fa fa-trash" aria-hidden="true"></i></a>
																	
																<input type="hidden" id="order_status_<?php echo $orders->order_id; ?>" value="<?php if($orders->order_status ==0){ echo "pending"; }else if($orders->order_status ==1){ echo "In Transit"; }else if($orders->order_status ==2){ echo "Delivered"; }else if($orders->order_status ==3){ echo "Canceled"; }  ?>" >	
																<input type="hidden" id="date_<?php echo $orders->order_id; ?>" value="<?php echo $orders->order_date; ?>" >
																<input type="hidden" id="email_<?php echo $orders->order_id; ?>" value="<?php echo $orders->order_email; ?>" >
																<input type="hidden" id="city_<?php echo $orders->order_id; ?>" value="<?php echo $orders->order_city; ?>" >
																<input type="hidden" id="pincode_<?php echo $orders->order_id; ?>" value="<?php echo $orders->city_pincode; ?>" >
																<input type="hidden" id="amount_<?php echo $orders->order_id; ?>" value="<?php echo $this->hs->getwebsettings('currency_symbol').$orders->order_amount; ?>" >
																<?php if($orders->discount_amount =='None'){
																	$cur_code =''; 
																}else{
																	$cur_code = $this->hs->getwebsettings('currency_symbol');
																} ?>
																<input type="hidden" id="discount_amount_<?php echo $orders->order_id; ?>" value="<?php echo $cur_code.$orders->discount_amount; ?>" >
																<input type="hidden" id="paymode_<?php echo $orders->order_id; ?>" value="<?php if($orders->payment_mode == 1){ echo 'Paypal'; }else if($orders->payment_mode == 2){ echo 'Payumoney'; }else if($orders->payment_mode == 3){ echo 'Wallet'; }else if($orders->payment_mode == 4){ echo "COD"; } ?>" >
																<input type="hidden" id="paystatus_<?php echo $orders->order_id; ?>" value="<?php if($orders->payment_status == 0){ echo 'Unpaid'; }else if($orders->payment_status == 1){ echo 'Paid'; } ?>" >
																</td>
																
															</tr>
																				
															   
															 
														<?php
														  }
														 } 
														?>					
														</tbody>
													</table>
												</div>
											</div>
										</div>
								 
								<!------ALL ORDER TAB END----->
		 		
								
								
								
								
								
<!-- view order popup start -->
<div class="modal_box">
	<div id="view_order_info" class="modal fade" role="dialog">
		<div class="modal-dialog">
			<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">&times;</button>
						<h4 class="modal-title"><span>Order</span> Details</h4>
					</div>
				<div class="modal-body">
					 
					<div class="modal_inner_body">
						<div class="order_block">
							<label>Name -</label>
							<span id="ouname"> </span>
						</div>
						<div class="order_block">
							<label>Order ID -</label>
							<span id="orderid"> </span>
						</div>
						<div class="order_block">
							<label>Contact No. -</label>
							<span id="contact_id"></span>
						</div>
						<div class="order_block">
							<label>Items -</label>
							<ul id="proid">
								<!--<li><span>1x Chicken</span></li>
								<li><span>2x Noodles</span></li>-->
							</ul>
						</div>
						<div class="order_block">
							<label>Order Date -</label>
							<span id="odate"></span>
						</div>
						<div class="order_block">
							<label>Email -</label>
							<span id="oemail"></span>
						</div>
						<div class="order_block">
							<label>Delivery Address -</label>
							<span id="od_add"></span>
						</div>
						<div class="order_block">
							<label>City -</label>
							<span id="od_city"></span>
						</div>
						<div class="order_block">
							<label>Pincode -</label>
							<span id="od_pincode"></span>
						</div>
						<div class="order_block">
							<label>Order status -</label>
							<span id="od_staus"></span>
						</div>
						<div class="order_block">
							<label>Order Amount -</label>
							<span id="od_amount"></span>
						</div>
						<div class="order_block">
							<label>Discount Amount -</label>
							<span id="od_disamount"></span>
						</div>
						<div class="order_block">
							<label>Payment Mode -</label>
							<span id="od_paymode"></span>
						</div>
						<div class="order_block">
							<label>Payment Status -</label>
							<span id="od_paystaus"></span>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- view order popup end -->


