<style>
.padd_space td { padding:30px 0px;}
tfoot { padding-top:50px;}
tfoot td { padding-top:50px;}
.roundss { font-size:14px;}
.thead { background-color:#0f75bd; }
#quantity { width:60px; height:35px; padding-left:10px;}
.table > tbody > tr > td { padding-top:10px; padding-bottom:10px;}
.table { font-size:15px;}
.btn-success:hover { color:#000000; background-color:#F00;}
.nomargin { color:#000000;}
</style>




<script>
$(function(){
	$("#sub_categories").change(function(){
		$("#sub_categories_products").load('<?php echo site_url("Ajx_functions/sub_categories") ; ?>/'+$(this).val() );	
		
		document.getElementById('pro_qty').value = '';
		$("#prot_total").hide();
	});	 
});


$(function(){
	$("#sub_categories_products").change(function(){
		var product_id= $(this).val();
		$("#pro_rate").load('<?php echo site_url("Ajx_functions/sub_categories_products") ; ?>/'+$(this).val() );
		
	document.getElementById('pro_qty').value = '';
	$("#prot_total").hide();		
	});	 
});



$(function(){
	$("#pro_qty").keyup(function(){
		var product_id=document.getElementById("sub_categories_products").value;
		$("#prot_total").load('<?php echo site_url("Ajx_functions/pro_qty") ; ?>/'+$(this).val()+'/'+ product_id );	
		//$("#prot_total2").load('<?php echo site_url("Ajx_functions/pro_qty2") ; ?>/'+ product_id);	
		$("#prot_total").show();
			
	});	 
});




$(function(){
	$("#add_session").change(function(){
		$("#sub_categories_products").load('<?php echo site_url("Ajx_functions/add_session") ; ?>/'+$(this).val() );	
		
		document.getElementById('pro_qty').value = '';
		$("#prot_total").hide();
	});	 
});


</script>















<div class="container padd_not marg_top ">




<div class="col-md-12 registor" style="min-height:500px;">
<h3 class="sub_hd">Corporate Booking</h3>





<form method="post">

<!--<input type="text" name="name_fg[]" class="form-control" placeholder="Enter name">
<input type="text" name="email_fg[]" class="form-control" placeholder="Enter email">-->


<div class="col-md-3"> 
<label><b>Subcategory *</b></label>&nbsp;&nbsp;&nbsp;&nbsp;
<select name="sub_categories" id="sub_categories"  class="form-control" required  >
<option value="">-SELECT-</option>
<?php foreach($subcategoryquick as $value){?>
<option value="<?php echo $value['id'];?>"   ><?php echo $value['title'];?></option>
<?php }?>
</select>
</div>
    
    
    
<div class="col-md-4"> 
<label><b>Products *</b></label>&nbsp;&nbsp;&nbsp;&nbsp;
<select name="sub_categories_products" id="sub_categories_products"  class="form-control" required  >
<option value="">-SELECT-</option>	
</select>
</div>
 
 
 
<div class="col-md-3" style="padding:0px;">
 <label><b>&nbsp; <span id="pro_rate"></span></b></label><div class="clr"></div>
<div class="col-md-5"> 
<input type="text" value="" name="pro_qty" id="pro_qty" placeholder="Quantity" required  style="max-width:100%; padding:0px 10px; height:33px;" />
</div>
 
 
<div class="col-md-7"> 
<b ><span id="prot_total"></span></b>
</div>

</div>



<div class="col-md-2">
<label><b>&nbsp; </b></label><div class="clr"></div>
<input type="submit" name="addtocart" class="btn  btn-info pull-right" value="Add To Basket">
</div> 

<div class="clr"></div>

<!--<a id="add_session" class="btn btn-success pull-right">
<span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true"></span> Add</a>-->   
</form>
                    
























<div class="col-md-12 clr" style="min-height:100px;"></div>
<h4 style="border-bottom:1px solid #dddddd; padding-bottom:20px; margin-bottom:30px;">Order Details</h4>




<table id="cart" class="table table-hover table-condensed" cellpadding="10" cellspacing="10" > 
<thead style="background-color:#dddddd;">
						<tr>
							<th style="width:50%">Product</th>
							<th style="width:10%">Price</th>
							<th style="width:20%" class="text-center" >Quantity</th>
							<th style="width:15%" class="text-center">Subtotal</th>
							<th style="width:5%"></th>
						</tr>
					</thead>
					
<tbody>                    
<?php  
$currentURL = current_url(); 
$url=urlencode(base64_encode($currentURL));
echo form_open('Quick_order/update/'.$url.''); ?>
<form method="post">    
       
       
<?php $i = 1; ?>
<?php foreach ($this->cart->contents() as $items): ?>
<?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>             

<tr class="padd_space" >
<td data-th="Product" >
<div class="row">
<div class="col-sm-2 hidden-xs">
<a href="<?php echo site_url( 'Product/view/'.$items['id'].'/'.$items['category_id'].'/'.$items['unit_id'].'/'.url_title($items['name'],'-',true) ) ; ?>">   
<img src="<?php echo base_url('assets/images/'.$items['image']) ; ?>" class="img-responsive" >
</a>
                                    
</div>
<div class="col-sm-10">
<a href="<?php echo site_url( 'Product/view/'.$items['id'].'/'.$items['category_id'].'/'.$items['unit_id'].'/'.url_title($items['name'],'-',true) ) ; ?>">  <span class="nomargin"><?php echo $items['name']; ?></span></a>

<?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
<?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>
<?php  $option_value; ?>
<?php endforeach; ?>
<?php endif; ?>	 
</div>
</div>
</td>
<td data-th="Price">
<?php echo $this->cart->format_number($items['price']); ?> <?php // echo  $unit_weight; ?> / 
<?php $uid=$items['unit_id']; 
$sql ="SELECT * FROM shop_unit where id=$uid";
$query = $this->db->query($sql);
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {?>
<?php echo $row->title;?>
<?php echo $row->options;?>
<?php } } ?>                       
</td>
<td data-th="Quantity" align="center">
     
<?php
$sql ="SELECT * FROM shop_product where aid=".$items['id']."";
$query = $this->db->query($sql);
if ($query->num_rows() > 0) {
foreach($query->result() as $row) {
$pro_quty=$row->stock2;
$unit_weight=$row->weight; 
}
}
?>  


<?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3','id'=>'quantity', 'size' => '5','type' => 'number','min' => '0','max' => $pro_quty )); ?>


 <?php echo form_input(array('name' => $i.'[id]', 'value' => $items['id'], 'maxlength' => '3','id'=>'id', 'size' => '5','type' => 'hidden' )); ?>
 <div class="clr"></div>
<span style="font-size:10px; text-align:left;">Available product quantity : <?=$pro_quty?></span>
</td>
<td data-th="Subtotal" class="text-center">
<?php echo $this->cart->format_number($items['subtotal']); ?>
<?php  $product_wait=$unit_weight* $items['qty'];  $sum+= $product_wait; ?> 
</td>
<td class="actions" align="right">

<a href="<?php echo site_url('Quick_order/delete_item/'.$items['rowid']); ?>" class="remove" onclick="return confirm('Delete this Item ? ')">
<i class="fa fas fa-times btn-danger btn-sm"></i>     </a>
				
</td>
</tr>

					
<?php $i++; ?>
<?php endforeach; ?>  




<?php if($option_value==1 || $option_value=='' ) {
$total=$this->cart->format_number($this->cart->total());  /*$total=$this->cart->format_number($this->cart->total()); */
$total=$this->cart->total();
 } else {?> 
 
<tr>

<td colspan="3" align="right">Delivery Charge :</td>
<td style="text-align:center;" ><?php $total=$this->cart->format_number($this->cart->total());  /*$total=$this->cart->format_number($this->cart->total()); */
$total=$this->cart->total(); ?>
<?php if($total < 2500) { 
 if($site): foreach($site as $site_row):
$dvtcharge=$site_row['dvtcharge'];
endforeach; endif; ?>
<?=$dvtcharge?>.00 <?php  }  else { echo "Free Delivery"; $dvtcharge=0; } ?> </td>
<td></td>
</tr>

<?php } ?>


<tr>
<td colspan="3" align="right" ><b>Total Rs:</b></td>
<td align="center"> <strong><?php   if($total!='' ){ $tayal2=$total+$dvtcharge; echo $tayal2; echo ".00"; $total=$this->cart->format_number($tayal2);}  else {echo "00.00"; } ?></strong></td>
<td></td>
</tr>


               
</tbody>                 
                    
<tfoot>

<tr>



<td  colspan="3">
<p>&nbsp;</p><div class="clr"></div>
<div class="col-md-4 pull-right">  
<label class="roundss">Shop Delivery
  <input type="radio" value="1" <?php if($option_value==1){ echo 'checked="checked"'; } ?> required="required" name="dtype">
  <span class="checkmark"></span>
</label>
</div>

<div class="col-md-4 pull-right">  
<label class="roundss"> Door  Delivery
  <input type="radio" value="2" <?php if($option_value==2){ echo 'checked="checked"'; } ?> required="required"  name="dtype">
  <span class="checkmark"></span>
</label>
</div>

</td>


<td class="hidden-xs text-center">
<p>&nbsp;</p><div class="clr"></div>
<?php $currentURL = current_url(); 
$url=urlencode(base64_encode($currentURL));
?>
<a href="<?php echo site_url('Cart/delete/'.$url.'') ; ?>" class="btn btn-success pull-right" onclick="return confirm('Empty Cart ?')">Empty Cart</a></p>

</td>
<td>
<p>&nbsp;</p><div class="clr"></div>
<p><?php echo form_submit('placeorder','Place Order','class="btn  btn-danger btn-block"') ; ?></p>

</td>
</tr>
</tfoot>
                    
</form>                  
</table>

 
</div>








</div>




