<div class="col-md-12  full min_ht">
<div class="col-md-12  text-center">


<p class="inter">
<?php echo anchor(base_url('Admin_home/'),'Home') ; ?> >> <a href="<?php echo site_url('Order_admin/view');?>"><?=$heading?></a>
</p><br>

<h1 style="text-align:left;"><i class="fa fa-bars" aria-hidden="true"></i> <?=$heading?></h1>
<div class="clr2"></div>

<?php
$p_order_id='';
$total_amt = 0;
if($result):
$atts = array(
      'width'      => '800',
      'height'     => '600',
      'scrollbars' => 'yes',
      'status'     => 'yes',
      'resizable'  => 'yes',
      'screenx'    => '20',
      'screeny'    => '20',
      'class'	   => 'lnk'
    );


?>



<div class="col-md-12">

<form name="form" method="post">
 
<div class="col-md-2"> 
  <select name="statuso" class="form-control">
  
   	<option value="P"<?php if("P"==$statuso){echo "selected";}?>>Pending</option>
    <option value="1"<?php if("1"==$statuso){echo "selected";}?>>Confirmed</option>
    <option value="D"<?php if("D"==$statuso){echo "selected";}?>>Delivered</option>
    <option value="C"<?php if("C"==$statuso){echo "selected";}?>>Cancelled</option> 
    </select>
</div> 
<div class="col-md-2"> <input name="submit" class="btn btn-lg btn-primary btn-block btn2" value="Submit" type="submit" ></div>
    </form>
</div>
<div class="col-md-6"><p align="left" style="color:#930;"> Click on the order id, customer name to view details </p></div>

<table class="listing" >
		<thead>
		<tr>
			<th class="lasto">No.</th>
            <th class="lasto">Order ID</th>
			<th class="lasto">Customer Name</th>
			<th class="lasto">Customer No</th>
            <th class="lasto">Mobile No</th>
			<th class="lasto">Address</th>
			<th class="lasto">payment</th>
            <th class="lasto">Date</th>
            <th class="lasto">Status</th>
            <th class="lasto">Track Details</th>
            <th class="lasto">Modify</th>
            <th class="lasto">Delete</th>
		</tr>
		</thead>
        <style>
@media only screen and (max-width: 760px),(min-device-width: 768px) and (max-device-width: 1024px)  
{
.listing td:nth-of-type(1):before { content: "No."; }
.listing td:nth-of-type(2):before { content: "Order ID"; }
.listing  td:nth-of-type(3):before { content: "Customer Name"; }
.listing  td:nth-of-type(4):before { content: "Customer No"; }
.listing  td:nth-of-type(5):before { content: "Mobile No"; }
.listing  td:nth-of-type(6):before { content: "Address"; }
.listing  td:nth-of-type(7):before { content: "payment"; }
.listing  td:nth-of-type(8):before { content: "Date"; }
.listing  td:nth-of-type(9):before { content: "Status"; }
.listing  td:nth-of-type(10):before { content: "Track Details"; }
.listing  td:nth-of-type(11):before { content: "Modify"; }
.listing  td:nth-of-type(12):before { content: "Delete"; }
}
</style>
        <tbody>

  <?php $i=1; foreach($result as $row): ?>
  <tr>
    <td class="lasto3"><?=$i?></td>
    <td class="lasto3">
	<?php 
	$atts['height']=600; 
	echo anchor_popup(site_url('Order_admin/order_details/'.$row['order_id']), $row['order_id'], $atts) ; 
	?>
    </td>
    <td class="lasto3">
	<?php 
	
	if($row['user_id']==0) { echo "Quick Order";}
	else
	 {
	
	
	$atts['height']=400; 
	echo anchor_popup(site_url('User_details/view/'.$row['user_id']), get_customer_by_id($row['user_id']), $atts) ; 
	}?>
	</td>
    <td class="lasto3">
	<?php 
	$atts['height']=400; 
	echo $row['user_id']; 
	?>
	</td>
     <td class="lasto3">
	<?php 
	$atts['height']=400; 
	echo $row['mobile']; 
	?>
	</td>
    <td class="lasto3">
	<?php 
	$atts['height']=400; 
	echo $row['address']; 
	?>
	</td>
    <td class="lasto3">
	<?php 
	$atts['height']=400; 
	if($row['gifts']=='2')
	{
	echo 'Payment Gateway';
	}
	else
	{
		echo 'Cash on Delivery';
	}
	
	

	
	?>
    	<span style="color:#FF0000;"><?php if($row['payment']=='1'){ echo"- Paid";}?></span>
    
    
	</td>
    <td class="lasto3"><?=get_datetime($row['order_date'])?></td>
    <td class="lasto3">
    <form name="form<?=$i?>" method="post" action="Order_admin/change_del_status/">
    <input type="hidden" name="oid" value="<?=$row['order_id']?>" />
    
    <select name="status" onchange="form<?=$i?>.submit()"
    <?php if($row['status']=='C'){ echo 'style="background-color:#FFB9B9; width:auto;"' ; }else echo 'style="width:auto;"' ; ?>  class="form-control" style="width:auto;">
     
    <?php if($row['status']=='P'): //if pending ?>
    
   	<option value="P" <?php if($row['status']=='P')echo 'selected'; ?> >Pending</option>
    <option value="1" <?php if($row['status']=='1')echo 'selected'; ?> >Confirmed</option>
    <option value="D" <?php if($row['status']=='D')echo 'selected'; ?> >Delivered</option>
    
    <?php elseif($row['status']=='C'): //if cancelled ?>
    
    <option value="C" <?php if($row['status']=='C')echo 'selected'; ?> >Cancelled</option>
	
    <?php elseif($row['status']=='1'): //if confirmed ?>
    
    <option value="1" <?php if($row['status']=='1')echo 'selected'; ?> >Confirmed</option>
    <option value="D" <?php if($row['status']=='D')echo 'selected'; ?> >Delivered</option>
	
    <?php elseif($row['status']=='D'): // if delivered ?>
    
    <option value="D" <?php if($row['status']=='D')echo 'selected'; ?> >Delivered</option>
    
    <?php endif; ?>
    
    </select>
    </form>

    </td>
    <td class="lasto3"><?php echo $row['track_det']=='' ? '' : substr($row['track_det'],0,100).'...' ; ?> </td>
    <td class="lasto3">
    <a href="<?php echo site_url('Order_admin/edit/'.$row['order_id']) ; ?>">
    <img src="<?php echo base_url('assets/web_images/edit.png'); ?>" width="20" height="20" />
    </a>
    </td>
    <td class="lasto3">
    <a href="<?php echo site_url('Order_admin/remove/'.$row['order_id'].'/1/') ; ?>" onClick="return confirm('Delete content ?')">
    <img src="<?php echo base_url('assets/web_images/delete.gif'); ?>" width="20" height="20" />
    </a> 
    </td>
  </tr>
  <?php $i++; endforeach; ?>
  </tbody>
</table>


<?php endif; ?>
</div>

</div>

