<!doctype html>
<html lang="en">
  <head>
  
  <script type="text/javascript">
function p(){
 document.getElementById("prfname").value =document.getElementById("pcfname").value;
 document.getElementById("prlname").value =document.getElementById("pclname").value;
 document.getElementById("prphone").value =document.getElementById("pcphone").value;
 document.getElementById("premail").value =document.getElementById("pcemail").value;
 document.getElementById("praddress").value =document.getElementById("pcaddress").value;
}
function b(){
 document.getElementById("brfname").value =document.getElementById("bcfname").value;
 document.getElementById("brlname").value =document.getElementById("bclname").value;
 document.getElementById("brphone").value =document.getElementById("bcphone").value;
 document.getElementById("bremail").value =document.getElementById("bcemail").value;
 document.getElementById("braddress").value =document.getElementById("bcaddress").value;
}
</script>
  
  
  <style>
  
  
  
@media (min-width: 200px) {
		.form-control-quantity{
		width:100%;
		
		}

.checkout-container{
	padding:0px 0px;
} 	
}
@media (min-width: 600px) {
		.form-control-quantity{
		width:100%;
		
		}

	
	.checkout-products{
	padding-top:10px;
	padding-bottom:10px;
	border-top:1xp solid #99EEF8;
	
}

.checkout-container{
	padding:5% 5%;
} 	
}
@media (min-width: 990px) and (max-width: 1799px) {
	.form-control-quantity{
		width:84px;
		
		}
	
	
	.checkout-products{
	padding-top:10px;
	padding-bottom:10px;
	display:-webkit-inline-box;
	border-top:1xp solid #99EEF8;
	
}

	
.checkout-container{
	padding:0% 15%;
} 
}

@media (min-width: 1800px) {  
	.form-control-quantity{
		width:84px;
		
		}

	.checkout-products{
	padding-top:10px;
	padding-bottom:10px;
	display:-webkit-inline-box;
	border-top:1xp solid #99EEF8;
	
}
.checkout-container{
	padding:0px 25%;
} 
}
.checkout-tablebottom{
	border:1px solid #e0e0e0;
	padding:20px;
	padding-bottom:20px;

	}
.checkout-instructions {
	border:1px solid #e0e0e0;
	border-bottom:0px;
	padding:20px;
}
.checkout-li{
	border-bottom:1px solid #e0e0e0;
	padding-bottom:15px;
	display:list-item;
	list-style-type:none;
	padding-bottom:35px;
}

  
 .prod-thumbnail{
	 padding:0px;
	 width:100%;
	 
}

.row{
	margin-bottom:10px	
}

.prod-title-variation{
	padding-left:10px;
	}

.checkout-img-info{
	padding:0px;
	padding-left:15px;
	text-align: left;

}
.checkout-prod-info{
	padding:0px;
	text-align:center;

	}
.checkout-img{
	padding:0px;
	}
.form-control{
	padding:4px 40px;
	}
	
.checkout-Customer-Info .form-control{
	padding:4px 5px;
	margin-bottom:10px
	}
	
.checkout-prod-info-r{
	text-align:right;
	font-size:20px;
	padding:10px 0px;
	
	}

.sign-ro-login{
	padding:10px 10px;
	background:#99EEF8;
	border-radius: 5px;
	margin-bottom:10px;
}

.place-order{
	margin-top:20px;
	
	}

.btn-place-order{
	margin-top:10px;
	}


  
  </style>
  
  </head>
  
  <body>
  
  
  <!-- head -->
  <div class="checkout-container">
  <h2><strong>Check Out</strong></h2>
  <!-- End head -->
  
   <!-- part1 -->
   <div class="checkout-instructions " style="height:70px;">
      <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
      	<h1 style=" margin:5px 5px;">Order Details</h1>
        </div>
        </div>
   <!-- End part1  -->  
   
   <!-- part2 subject-->
      
       <div class="checkout-instructions col-lg-12 col-md-12 col-sm-12 col-xs-12">

        <div class="checkout-tabletop checkout-cart-items">
          <div class="checkout-li hidden-sm hidden-xs">
            <div class="col-md-6">Product Description</div>
            <div class="col-md-2 text-center">Unit Price</div>
            <div class="col-md-2 text-center">Quantity</div>
            <div class="col-md-2 text-right">Sub-total</div>
          </div>
          
   <!--End part2 subject-->
   
    <!-- part3 cart-items-->
    <div class='cart-products'>
	<?php include ("checkout-products.php");?>
          </div>
        </div>      
      </div>
      
      <!-- End part3 cart-items-->
      
      <!-- part4 Coupon Customer Info Place Order-->
      <div class="checkout-tablebottom col-lg-12 col-md-12 col-sm-12 col-xs-12" >
      <!-- part4.1 Coupon-->
      
         <!-- Nav tabs -->
      <!-- End part4.1 Coupon-->

  <!-- Tab panes -->
<script>
function coupon(code)
{
var xmlhttp;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
  {
	if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
      if(xmlhttp.responseText>0)
	  {
		document.getElementById("discount").style.display="";
		document.getElementById("discount1").style.display="";
		document.getElementById("discount2").style.display="";
		document.getElementById("discountrate").innerHTML=100-xmlhttp.responseText*100+'%';
		
		var discountapplied = parseFloat(document.getElementById("total").innerHTML-parseFloat(xmlhttp.responseText*document.getElementById("total").innerHTML));
		
		var discountapplied = Math.round(discountapplied * 10) / 10;
		
		document.getElementById("discountapplied").innerHTML=
			discountapplied
		;
		
		document.getElementById("subtotal").innerHTML=
		document.getElementById("total").innerHTML
		-
		discountapplied
		+
		parseInt(document.getElementById("deliveryfee").innerHTML);
		
		document.getElementById("discounttotal").innerHTML=
		document.getElementById("total").innerHTML-document.getElementById("discountapplied").innerHTML;
		
		document.getElementById("discount_rate").setAttribute('value',xmlhttp.responseText);
		document.getElementById("code1").setAttribute('value',code);

      }else{
	    alert("This Coupon Code is invalid.");
	  }
    }  
  }
xmlhttp.open("GET","includes/check_coupon.php?code="+code,true);
xmlhttp.send();
}
</script>

    <div class="place-order col-lg-6 col-md-6 col-sm-12 col-xs-12" style="margin-top:0;    padding-left: 15px;padding-top: 5px;
"> 

			<h2>Coupon Code:</h2>
            <div class="input-group">
              <input id="code" name="code" class="form-control" placeholder="Please enter Coupon Code">
              <div class="input-group-addon" style="padding:0; background-color:rgba(227,105,10,1.00);"><button style="border:0; background-color:rgba(227,105,10,1.00); color:white; width:100%; height:100%" onClick="coupon(document.getElementById('code').value)">Apply Coupon</button></div>
            </div>
<form method="post" name="paypal_form" id="paypal_form" action="e-shop.php?page=10">
            <input id="discount_rate" style="display:none" name="discount_rate" value="" />
            <input id="code1" style="display:none" name="code" value="" />

			<h2>Customer Info:</h2>
			<strong>Customer's First Name</strong>
            <input class="form-control" id="pcfname" placeholder="" type="text" name="customer_Fname" value="<?php echo $_SESSION["first_name"];?>" required>
			
			<strong>Customer's Last Name</strong>
            <input class="form-control" id="pclname" placeholder="" type="text" name="customer_Lname" value="<?php echo $_SESSION["last_name"];?>" required>
            
            
            <strong>Customer's Email</strong> 
            <input class="form-control" style="text-align: center;" id="pcemail" placeholder="" type="email" name="customer_email" value="<?php echo $_SESSION["email"];?>" required>
            
            <strong>Customer's Phone</strong> 
            <input class="form-control" id="pcphone" placeholder="" type="text" name="customer_phone" value="<?php echo $_SESSION["phone"];?>" required>
            
            <strong>Billing Address</strong>
            <textarea class="form-control" id="pcaddress" rows="2" name="customer_address" wrap='physical' required><?php 
			
			$address=preg_replace("<br>", '/\r\n/',($_SESSION["address"]));
			echo $_SESSION["address"]; ?></textarea>
                 
            
            <strong>Company Name</strong> 
            <input class="form-control" placeholder="" type="text" name="company_name" value="*Optional" required>
            
            <h2>Delivery Details:</h2> 
            <button type="button" onclick="p()" />Same as Above</button><br><br>

            
			<strong>Recipient's First Name</strong>
            <input class="form-control" id="prfname" placeholder="" type="text" name="recipient_Fname"  required>
            
			<strong>Recipient's Last Name</strong>
            <input class="form-control" id="prlname" placeholder="" type="text" name="recipient_Lname"  required>
			
            <strong>Recipient's Email</strong>
            <input class="form-control" style="text-align: center;" id="premail" placeholder="" name="email" value="*Optional" required>
            
            <strong>Recipient's phone</strong>
            <input class="form-control" id="prphone" placeholder="" type="text" name="phone"  required>
            
            <strong>Delivery Address</strong>
            <textarea class="form-control" id="praddress" rows="2" name="address" wrap='physical' required></textarea>
                 
            <strong>Delivery Date</strong>
            <p>*Please select your targeted delivery date. We will confirm the exact delivery date after receiving your order very soon.<br>
Kindly note that delivery service is not available on Sundays and public holidays.</p>

			<input class="form-control" placeholder="Please select delivery date" type="text" name="delivery_date" id="datepicker" required></input>  
            
            <p>*Please note that the delivery service is handled by SF Express. We will try our best to deliver the goods to you within the scheduled time slot but delay may happen sometimes due to traffic situation.We will try our best to contact you directly if we will not be able to arrange the delivery on your targeted delivery time.</p>
            
            <strong>Delivery Time Slot</strong>
            
			<select class="form-control" name="delivery_time">
            <option value="09:00 - 15:00">9:00AM - 3:00PM</option>
            <option value="13:00 - 19:00">1:00PM - 7:00PM</option>
            </select>  
            
            <strong>Remarks</strong>
            <textarea class="form-control" rows="4" name="remarks" placeholder="Enter your message" wrap='physical'></textarea>
            </div>
            
            
            
     
    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12" style="margin-top:0;padding-right:15px;padding-top: 5px;"><h2 align="right">Order Summary</h2>
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div class="">Sub-total:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="total" class="" ><?php echo $_SESSION["Tsubtotal"];?></span>
 			</div>
        </div>
        
      	<div id="discount" style="display:none" class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div>Discount(%):</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <div id="discountrate" class="" ></div>
 			</div>
        </div>   
        
        <div id="discount1" style="display:none" class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div>Discounted Amount:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="discountapplied" class="" ></span>
 			</div>
        </div>   
        
        <div id="discount2" style="display:none" class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div>Sub-total After Discount:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="discounttotal" class="" ></span>
 			</div>
        </div>   

        
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div class="">Delivery Fee:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="deliveryfee"><?php if($_SESSION["Delivery"]==1){echo 38;}else{echo 0;} ?></span>
 			</div>
        </div>
              
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div class=""><strong>Total:</strong></div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="subtotal" class="" ><strong><?php echo $_SESSION["subtotal"]; ?></strong></span>
 			</div>
        </div> 
<div label="" data-field-name="terms" class="text-right">
<div class="">
<label style="font-weight: 400;font-size: 14px;">
<input type="checkbox" name="order_terms" onclick="Disabled('paypal')"> 
I agree to <a class="" >Sayvour’s Terms</a> and <a class="">Conditions</a>
</label>
</div>

<div class="ng-scope" ng-if="!isUserLoggedIn">
<label style="font-weight: 400;font-size: 14px;">
<input type="checkbox" name="save_marketing" > 
I wish to subscribe to Sayvour’s promotional materials  
</label>
</div>
      
</div>

      
<input class="hidden" name="username" value="<?php echo $_SESSION["username"];?>"/>
      
<input class="hidden" name="rm" value="2"/>
<input class="hidden" name="cmd" value="_cart"/>		
<input class="hidden" name="custom" value="<?php echo $_SESSION['username']; ?>"/>
<input class="hidden" name="business" value="info-facilitator@sayvour.com.hk"/>
<!-- Where people will be sent after a successful order -->
<input class="hidden" name="return" value="http://103.44.161.50/~monkeygo/sayvour/e-shop.php"/>
<!-- Where people will be sent after a cancelled order -->
<input class="hidden" name="cancel_return" value="http://103.44.161.50/~monkeygo/sayvour/e-shop.php"/>
<!-- The location of your IPN. PayPal needs to know this so it knows where to send the infomation about the order -->
<input class="hidden" name="notify_url" value="http://103.44.161.50/~monkeygo/sayvour/paypal.php"/>
<input class="hidden" name="quantity" value="2"/>

<?php 
	$y=$_SESSION["paypal_count"];
	$x=1;
	while($x<=$y){
		$item_name=$_SESSION["item_name_$x"];
		$amount=$_SESSION["amount_$x"];
		$quantity=$_SESSION["quantity_$x"];
		echo "<input class='hidden' name='item_name_".$x."' value='".$item_name."'/>";
		echo '<input class="hidden" name="amount_'.$x.'" value="'.$amount.'"/>';
		echo '<input class="hidden" name="quantity_'.$x.'" value="'.$quantity.'"/>';
		$x++;
		}
				
	$y=$_SESSION["paypal_count"];
	$x=1;
	while($x<=$y){
		$_SESSION["item_name_$x"]=null;
		$_SESSION["amount_$x"]=null;
		$_SESSION["quantity_$x"]=null;
		$x++;
	}
?>
<input class="hidden" name="y" value="<?php echo $x;?>"/>


<input class="hidden" name="upload" value="1"/>
<input class="hidden" name="txn_type" value="cart"/>
<input class="hidden" name="currency_code" value="HKD"/>
<h2 align="middle">Payment Method</h2>
<p style="color:rgba(107,180,211,1.00)">Please select</p>

<input id="payment_method" style="display:none" name="payment_method" value="bank" />

<img id="bank_img" src="../img/pic1a.jpg" width="260px" height="60px" onClick="payment('bank')" />
<p style="color:rgba(107,180,211,1.00)">If you want to pay with bank transfer, please transfer with the following account</p>
<p style="color:rgba(107,180,211,1.00)">(only available in Hong Kong Dollars)</p>
<p style="color:rgba(230,149,148,1.00)">Company Name: Patisserie Sayvour Limited</p>
<p style="color:rgba(230,149,148,1.00)">Beneficiary's Bank Name: HSBC</p>
<p style="color:rgba(230,149,148,1.00)">Beneficiary's Account no: 023-462187-838</p>
<p style="color:rgba(230,149,148,1.00)">SWIFT address: HSBCHKHHHKH</p>
<p style="color:rgba(230,149,148,1.00)">Bank address: 1 Queen's Road Central, Hong Kong</p>
<br>
<img id="paypal_img" src="../img/pic3b.jpg" width="260px" height="60px" onClick="payment('paypal')" />
<p style="color:rgba(107,180,211,1.00)">General buyer use credit card payment. </p>
<p style="color:rgba(107,180,211,1.00)">PayPal account owner can pay with PayPal account.</p>
<br>



<input id="paypal" class="btn btn-place-order" type="submit" name="submit" value="Place Order" disabled="disabled">
<input  class="btn btn-place-order" onclick="window.location.href='e-shop.php'" value="Continue Shopping!!">



</form> 
</div>
</div>
</div>
          
   <script>
function Disabled(type){
	if(type=='paypal'){
		if(document.getElementById('paypal').disabled==false){
			document.getElementById('paypal').disabled=true;
		}else{
			document.getElementById('paypal').disabled=false;
		}
	}
}
function payment(type){
	if(type=='paypal'){
		document.getElementById('paypal_img').setAttribute('src','../img/pic3a.jpg');
		document.getElementById('bank_img').setAttribute('src','../img/pic1b.jpg');
		document.getElementById('payment_method').setAttribute('value','paypal');
	}else{
		document.getElementById('bank_img').setAttribute('src','../img/pic1a.jpg');
		document.getElementById('paypal_img').setAttribute('src','../img/pic3b.jpg');
		document.getElementById('payment_method').setAttribute('value','bank');
	}
}
</script>
       

<!-- End part4 Coupon Customer Info Place Order-->
      
     
  </body>
</html>