<div class="fd_bread_wrapper">
	<div class="container">
		<div class="row">
			<div class="col-lg-12">
				<div class="fd_bread">
					<h1 class="fd_page_title"><span>Checkout</span></h1>
					<nav aria-label="breadcrumb">
					  <ol class="breadcrumb">
						<li class="breadcrumb-item"><a href="<?php echo base_url(); ?>">Home</a></li>
						<li class="breadcrumb-item active" aria-current="page">Checkout</li>
					  </ol>
					</nav>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="fd_checkout_wrapper">
	<div class="container">
		<form method="post" id="checkout_form"  >
		<div class="row">
			<div class="col-md-8">
				<div class="checkout_form">
			
					<div class="row">
						<div class="col-md-12">
							<div class="checkout_heading">
								<h1>Address Details</h1>
							</div>
						</div>
						<div class="col-md-6">
							<div class="checkout_form_block">
								<input type="hidden" placeholder="First Name" value="<?php if(isset($_SESSION['userid'])){ echo $_SESSION['userid']; } ?>" name="check_uid" id="check_uid" />
								<span>Your First Name</span>
								<input type="text" placeholder="First Name" value="<?php if(isset($_SESSION['userid'])){ echo $this->hs->get_userdetails('user_fname',$_SESSION['userid']); } ?>" name="ufname" id="ufname" />
							</div>
						</div>
						<div class="col-md-6">
							<div class="checkout_form_block">
								<span>Your Last Name</span>
								<input type="text" placeholder="Last Name" value="<?php if(isset($_SESSION['userid'])){ echo $this->hs->get_userdetails('user_lname',$_SESSION['userid']); } ?>" name="ulname" id="ulname" />
							</div>
						</div>
						<div class="col-md-6">
							<div class="checkout_form_block">
								<span>Your Email</span>
								<input type="text" placeholder="Email" value="<?php if(isset($_SESSION['userid'])){ echo $this->hs->get_userdetails('user_email',$_SESSION['userid']); } ?>" name="ucheck_email" id="ucheck_email" />
							</div>
						</div>
						<div class="col-md-6">
							<div class="checkout_form_block">
								<span>Contact Number</span>
								<input type="text" placeholder="Contact No." value="<?php if(isset($_SESSION['userid'])){ echo $this->hs->get_userdetails('user_mobile',$_SESSION['userid']); } ?>" name="ucontact" id="ucontact" />
							</div>
						</div>
						<div class="col-md-12">
							<div class="checkout_form_block">
								<span>Your Street Address</span>
								<textarea rows="10" placeholder="Address here" name="uaddress" id="uaddress" ><?php if(isset($_SESSION['userid'])){ echo $this->hs->get_userdetails('user_address',$_SESSION['userid']); } ?></textarea>
							</div>
						</div>
						<div class="col-md-6">
							<div class="checkout_form_block">
								<span>City</span>
								<input type="text" placeholder="City"  value="<?php if(isset($_SESSION['userid'])){ echo $this->hs->get_userdetails('user_city',$_SESSION['userid']); } ?>" name="ucity" id="ucity"/>
							</div>
						</div>
						<div class="col-md-6">
							<div class="checkout_form_block">
								<span>Post Code</span>
								<input type="text" placeholder="Pincode" value="<?php if(isset($_SESSION['userid'])){ echo $this->hs->get_userdetails('user_zipcode',$_SESSION['userid']); } ?>" name="upincode" id="upincode"/>
							</div>
						</div>
						<div class="col-md-12">
							<div class="checkout_form_block checkout_btn">
								<button class="fd_cart_btn" type="submit">Submit</button>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="col-md-4">
				<div class="checkout_cart">
					<div class="cart_summery_heading">
						<h3>cart summery</h3>
					</div>
					<div class="cart_summery_section">
						<table>
							<tbody>
							<?php if(!empty($cart)){
								 foreach($cart as $cart_items){
							?>
								<tr id="<?php echo $cart_items['rowid']?>">
									<td>
										<div class="cart_summery_img">
											<img src="<?php echo base_url().$cart_items['options']['image']; ?>" alt="image" class="img-fluid" />
										</div>
									</td>
									<td>
										<div class="cart_summery_name">
											<h5><?php echo $cart_items['name']; ?></h5>
										</div>
										<div class="cart_summery_quantity">
											<h5><span>X</span><?php echo $cart_items['qty']; ?></h5>
										</div>
									</td> 
									<td>
										<div class="cart_summery_price">
											<h5><span><?php echo $this->hs->getwebsettings('currency_symbol'); ?> </span><?php echo $cart_items['subtotal']; ?></h5>
										</div>
									</td>
								</tr> 
								<?php }
								} ?>
							</tbody>
						</table>
					</div>
					<div class="total_summery">
						<h3>total amount</h3>
						<h5><span><?php echo $this->hs->getwebsettings('currency_symbol'); ?> </span><?php if(!empty($cart_total)){ echo $cart_total; } ?></h5>
					</div>
					<?php  if(isset($_SESSION['discount_amount'])){ ?>
					<div class="total_summery">
						<h3>Discount amount</h3>
						<h5><span><?php echo $this->hs->getwebsettings('currency_symbol'); ?> </span><?php  echo $_SESSION['discount_amount'];  ?></h5>
					</div>
					<?php } ?>
				</div>
				<div class="payment_status">
					<div class="wallet">
						<div class="wallet_heading">
							<h3>Your Balance Are</h3>
						</div>
						<div class="wallet_status">
							<h3>your wallet balance</h3>
							<h5 class="wallet_price"><span><?php echo $this->hs->getwebsettings('currency_symbol'); ?> </span><?php if(!empty($current_wallet)){ if($current_wallet[0]->wallet_amount !== ''){ echo $current_wallet[0]->wallet_amount; }else{ echo 0;  } }else{ echo 0;	 } ?></h5>
						</div>
						<div class="wallet_status">
							<h3>payable amount</h3>
							<h5><span><?php echo $this->hs->getwebsettings('currency_symbol'); ?> </span>
							<?php if(!empty($cart_total)){ 
									$final_amount = $cart_total;
									if(isset($_SESSION['discount_amount'])){
										$final_amount = $cart_total - $_SESSION['discount_amount'];
									}										
							?>
							<input type="hidden"  name="cart_total" id="cart_total" value="<?php echo $final_amount; ?>">
							<?php }?>
							<?php if(!empty($final_amount)){ echo $final_amount; } ?></h5>
						</div>
					</div>
					<div class="payment_options">
						<div class="payment_heading">
							<h3>choose payment option</h3>
						</div>
						<div class="payment">
							<div class="row">
							<?php if($this->hs->getwebsettings('paypal_status') == 1){ ?>
								<div class="col-md-6">
									<div class="payment_block">
										<input type="radio" name="payment_group" id="checkbox1" value="1"/>
										<label for="checkbox1">
											<span class="radio_custom"></span>
											<img src="<?php echo base_url(); ?>themeassets/images/payment/paypal.png" alt="image" class="img-fluid" />
										</label>
									</div>
								</div>
								<?php } 
								if($this->hs->getwebsettings('payumoney_status') == 1){?>
								<div class="col-md-6">
									<div class="payment_block">
										<input type="radio" name="payment_group" id="checkbox2" value="2"/>
										<label for="checkbox2">
											<span class="radio_custom"></span>
											<img src="<?php echo base_url(); ?>themeassets/images/payment/payumoney.png" alt="image" class="img-fluid" />
										</label>
									</div>
								</div>
								<?php } 
								if($this->hs->getwebsettings('wallet_status') == 1){?>
								<?php if(!empty($current_wallet)){ if($current_wallet[0]->wallet_amount >0 ){  ?>
								<div class="col-md-6">
									<div class="payment_block">
										<input type="radio" name="payment_group" id="checkbox3" checked  value="3"/>
										<label for="checkbox3">
											<span class="radio_custom"></span>
											<img src="<?php echo base_url(); ?>themeassets/images/payment/wallet.png" alt="image" class="img-fluid" />
										</label>
									</div>
								</div>
								<?php } 
								   }
								 }
								if($this->hs->getwebsettings('cod_status') == 1){?>
								<div class="col-md-6">
									<div class="payment_block">	
										<input type="radio" name="payment_group" id="checkbox4" value="4"/>
										<label for="checkbox4">
											<span class="radio_custom"></span>
											<img src="<?php echo base_url(); ?>themeassets/images/payment/cod.png" alt="image" class="img-fluid" />
										</label>
									</div>
								</div>
								<?php }  ?>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	 </form>
	</div>
</div>

<div id="show_paymentform" style="display:none;"></div>