<!-------------Date piker--------------->
<link rel="stylesheet" href="<?php echo base_url('assets/website/datepiker/dist/datepicker.css') ; ?>">
<link rel="stylesheet" href="<?php echo base_url('assets/website/datepiker/css/main.css') ; ?>">
<!-------------Date piker--------------->


<script>


$(function(){
	$("#dates_pik").change(function(){
		$("#dtime").load('<?php echo site_url("Ajx_functions/date_vali") ; ?>/'+$(this).val() );		
	});	 
});



</script>



<div class="container marg_top" >
<div class="row">




<?php

if(function_exists('date_default_timezone_set')) {
    date_default_timezone_set("Asia/Kolkata");
}

// then use the date functions, not the other way around
$date = date("d/m/Y");
	
$date1 =  date("H:i a");

?>

<div class="col-md-12 padd_not">
<?php 
if($cart_qty!=0)
{
?>





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






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

<?php  
 $currentURL = current_url(); 
$url=urlencode(base64_encode($currentURL));
echo form_open('Cart/update/'.$url.''); ?>
<form method="post">
<table class="table table-striped fnt_siz">

<h4 class="inner_bt" > <i class="fa fa-shopping-cart"></i> My Basket</h4>
    <tbody>
            <?php $i = 1; ?>
      <?php foreach ($this->cart->contents() as $items): ?>
<?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
      <tr class="text-left" >

<td align="left"  style="max-width:500px;">
            
<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']) ; ?>" style="width:50px; border:2px solid #cccccc; padding:5px; margin-right:10px;" align="left" >	
<?php echo $items['name']; ?> 
</a>


<?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
<p>

					<?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>



					 <?php  $option_value; ?>



					<?php endforeach; ?>

				</p>



			<?php endif; ?>	 
            
            
            
  

            
            
            
            
            
            
            
            
             </td>

      
<td align="left">
	
    
<div class="clr"></div>
    
      
<?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; 
}
}
?>  

      
	  
      </td>




<td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?> X </td>


<td style="text-align:right">

<?php echo $items['qty']; ?>
 </td>
      

<td style="text-align:right"><?php echo $this->cart->format_number($items['subtotal']); ?>


<?php  $product_wait=$unit_weight* $items['qty'];  $sum+= $product_wait; ?> 


</td>

	

</tr>  



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

 
      
    </tbody>
  </table>
  
<table class="table table-striped fnt_siz">





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

      <tr>
        <td>Delivery Charge </td>
        <td>
        
        <?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>
        
      </tr>
      <?php } ?>
     
     
        
      <tr>
        <td><b style="font-size:15px;">Total</b></td>
<td ><b style="font-size:15px;">
<?php   if($total!='' ){ $tayal2=$total+$dvtcharge; echo $tayal2; echo ".00"; $total=$this->cart->format_number($tayal2);}  else {echo "00.00"; } ?></b></td>
        
  </tr>
  
  
  </table>
  
  </form>
 




<a  href="<?php echo site_url('Cart');?>" class="add_home pull-right"> Change Your Cart</a>


  
</div>








</div>



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

<div class="col-md-12 registor">
  
  
  
  <?php if($option_value==1) { ?> 
  <h4 class="sub_hd">Shop Delivery</h4>
  <?php } else {?>
  <h4 class="sub_hd">Door Delivery</h4>
  
  <?php } ?>
  
  <p>Make sure your details are correct</p>

<?php  echo $reporto; ?>
<form method="post" action="" name="ship_form">

 


<?php if($error){ ?>

<div class="fontphp5"><?php echo $error ; ?></div>

<?php } ?>

<?php if($suc_msg){ ?>

<div class="fontphp4"><?php echo $suc_msg ; ?></div>

<?php } ?>

<!--<br />
<b>The order will be shipped to the following address:</b> <br />
<font color="#000000">

<b>Name</b> &nbsp;&nbsp;&nbsp;&nbsp; : <?php echo $name; ?><br />
<b>Address</b> : <?php echo $shaddress; ?><br />
<b>Land Mark</b> : <?php echo $city; ?><br />
<b>Pin</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : <?php echo $shpin; ?><br />
<b>Tel</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : <?php echo $shtel; ?><br />
<b>Mob</b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : <?php echo $shmobile; ?><br /><br />
</font> 
<a href="<?php echo site_url('Userpage/profile'); ?>" style="float:left;"  class="button-primary"  >Change The Shipping Address</a>-->

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





<input name="dtype" class="input" size="25" maxlength="50" type="hidden" value="<?=$option_value?>"  >
<input name="ship_charge" class="input" size="25" maxlength="50" type="hidden" value="<?=$dvtcharge?>" >

<span class="label">Name *</span>
<input name="name" class="input" size="25" maxlength="50" type="text" value="<?php echo $name; ?>" required >

<span class="label">Address *</span>
<textarea name="address" class="input" style=" height:100px;" required ><?php echo $shaddress; ?></textarea>

<span class="label">Landmark</span>
<input name="landmark" class="input" size="25" maxlength="50" type="text" value="<?php echo $landmark; ?>">


<span class="label">Pin</span>
<input name="pin" class="input" size="25" maxlength="50" type="text" value="<?php echo $shpin; ?>" >



<input name="city" class="input" size="25" maxlength="50" type="hidden" value="<?php echo $city; ?>">


<input name="state" class="input" size="25" maxlength="50" type="hidden" value="<?php echo $state; ?>">


<span class="label">Mobile *</span>
<input name="mobile" class="input" size="25" maxlength="10" type="text" value="<?php echo $shmobile; ?>" required >

<span class="label">Tel</span>
<input name="tel" class="input" size="25" maxlength="50" type="text" value="<?php echo $shtel; ?>">



<span class="label">GST Number (if you have.)</span>
<input name="gst" class="input"  type="text" value="<?php echo $sgst; ?>">



<span class="label" <?php if($option_value==1) { ?> style="display:none;" <?php } ?> >Postal Area</span>


<select name="post"  id="post" required <?php if($option_value==1) { ?>  hidden="hidden" <?php } ?>   style="width:100%; height:30px; " >

<?php if($option_value==1) { ?><option value="shop">Shop Delivery</option><?php } else { ?>

 <option value="">---Select---</option> 
<?php if($post_list): foreach($post_list as $post_row): ?>
<option value="<?=$post_row['title']?>"  <?php if($post==$post_row['title']){ ?> selected="selected" <?php } ?>  ><?=$post_row['title']?></option>
<?php endforeach; endif; ?>

<?php } ?>



</select>



<div class="col-md-6 padd_not">



<?php if($option_value==1) { ?> <label> Pickup Date :</label> <?php } else { ?> <label>Delivery Date :</label> <?php } ?>


<div class='input-group date' id='datetimepicker1'>
<input type="text" class="docs-date" name="ddate"  required autofocus  placeholder="Pick a date" id="dates_pik"  style="width:90%; border:1px solid #000000;"  >        
</div>

</div>


<div class="col-md-6 padd_not">


<?php if($option_value==1) { ?> <label> aproximate Pickup Time :</label> <?php } else { ?> <label>Delivery Time :</label> <?php } ?>

<br />
<!--<input name="dtime"  type="text" value="">-->

<?php if($site): foreach($site as $site_row):
$dvt1=$site_row['dvt1'];
$dvt2 =$site_row['dvt2'];
endforeach; endif; ?>

<select name="dtime"  id="dtime" required  style="width:100%; height:30px; " >
<option value="">---Select---</option>
<option value="<?=$dvt1?>" ><?=$dvt1?></option>
<option value="<?=$dvt2?>" ><?=$dvt2?></option>
</select>
</div>



<div class="col-md-12 padd_not">
<p>&nbsp;</p>
<input type="radio" name="gifts" value="1" required /> &nbsp; Cash on Delivery &nbsp; <br />
<!--<input type="radio" name="gifts" value="2" required   /> &nbsp; Online Payment &nbsp;  <br />-->
<input type="radio" name="gifts" value="3" required   /> &nbsp; Card on Delivery ( Swiping Machine ) &nbsp; <br />




</div>



<div class="clr">


</div>
<p>&nbsp;</p>
<input name="submit" class="button-primary" value="Complete Order" type="submit" onclick="return ship_val();">


    <br />


</form>
</div></div>

<?php }
 
 else
 {
	 ?>
<table align="left" border="0" width="480" cellpadding="10">
<br />


<tr><td colspan="2">
<div class="fontphp5"><?php echo 'Your Cart is Empty. Please select items to place the order.' ; ?></div>
</td></tr><tr><td height="20"></td></tr>

</table>	 
<?php
 }
 
 ?>   
    

  </div>
  </div>  
</div>

  <!-------------Date piker--------------->
<!--    <script src="datepiker/assets/js/jquery.min.js"></script>
  <script src="datepiker/assets/js/bootstrap.min.js"></script>-->
  <script src="<?php echo base_url('assets/website/datepiker/dist/datepicker.js') ; ?>"></script>
  <script src="<?php echo base_url('assets/website/datepiker/i18n/datepicker.en-US.js') ; ?>"></script>
  <script src="<?php echo base_url('assets/website/datepiker/i18n/datepicker.en-GB.js') ; ?>"></script>
  <script src="<?php echo base_url('assets/website/datepiker/i18n/datepicker.zh-CN.js') ; ?>"></script>
  <script src="<?php echo base_url('assets/website/datepiker/i18n/datepicker.pt-BR.js') ; ?>"></script>
  <script src="<?php echo base_url('assets/website/datepiker/i18n/datepicker.tr-TR.js') ; ?>"></script>
  <script src="<?php echo base_url('assets/website/datepiker/i18n/datepicker.de-DE.js') ; ?>"></script>
  <script src="<?php echo base_url('assets/website/datepiker/js/main.js') ; ?>"></script>
    <!-------------Date piker--------------->