| Server IP : 162.214.74.102 / Your IP : 216.73.216.36 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/views/frontend/ |
Upload File : |
<div class="for-fixed"></div>
<section id="checkout" style="margin-top: 70px;">
<div class="container">
<div class="col-md-12 col-sm-12 col-xs-12 paddxs">
<div class="col-md-8 col-sm-12 col-xs-12 paddxs">
<?php $validator = array('role' => 'form', 'id' => 'checkoutForm'); echo form_open('createorderfrontend/checkout', $validator); ?>
<input type="hidden" name="subtotal" id="subtotal" value="<?=$cartData['subtotal']?$cartData['subtotal']:0;?>" data-value="<?=$cartData['subtotal']?$cartData['subtotal']:0;?>">
<input type="hidden" name="taxAmount" id="taxAmount" value="<?=$cartData['taxAmount']?$cartData['taxAmount']:0;?>" data-value="<?=$cartData['taxAmount']?$cartData['taxAmount']:0;?>">
<input type="hidden" name="subtotalWithTax" id="subtotalWithTax" value="<?=$cartData['subtotalWithTax']?$cartData['subtotalWithTax']:0;?>" data-value="<?=$cartData['subtotalWithTax']?$cartData['subtotalWithTax']:0;?>">
<input type="hidden" name="deliveryCharge" id="deliveryCharge" value="<?=$cartData['deliveryCharge']?$cartData['deliveryCharge']:0;?>" datavalue="<?=$cartData['deliveryCharge']?$cartData['deliveryCharge']:0;?>">
<input type="hidden" name="subtotalWithTaxWithDelCharge" id="subtotalWithTaxWithDelCharge" value="<?=$cartData['subtotalWithTaxWithDelCharge']?$cartData['subtotalWithTaxWithDelCharge']:0;?>" data-value="<?=$cartData['subtotalWithTaxWithDelCharge']?$cartData['subtotalWithTaxWithDelCharge']:0;?>">
<input type="hidden" name="salesTax" id="salesTax" value="<?=$cartData['salesTax']?$cartData['salesTax']:0;?>" data-value="<?=$cartData['salesTax']?$cartData['salesTax']:0;?>">
<?php
if (isset($cc_number) && isset($cc_time)) {
$tempCode = $cc_number.'-|-'.$cc_time;
}
else {
$tempCode = '';
}
?>
<input type="hidden" name="tempCode" id="tempCode" value="<?=set_value('tempCode', $tempCode)?>">
<input type="hidden" name="customer_id" id="customer_id" value="<?=set_value('customer_id', isset($custData['customer_id'])? $custData['customer_id'] : '');?>">
<div class="checkBg">
<?php if($this->session->flashdata('success_msg')) { ?>
<div class="alert alert-info text-center">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><?php echo $this->session->flashdata('success_msg'); ?></strong>
</div>
<?php } ?>
<?php if(validation_errors() != FALSE) { ?>
<div class="alert alert-danger text-center">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><?php echo validation_errors(); ?></strong>
</div>
<?php } ?>
<?php if($this->session->flashdata('error_msg')) { ?>
<div class="alert alert-danger text-center">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><?php echo $this->session->flashdata('error_msg'); ?></strong>
</div>
<?php } ?>
<h3 class="ckh"><i class="fa fa-car" aria-hidden="true"></i> Delivery Order Information</h3>
<div class="input-group form-group">
<span class="input-group-btn">
<button class="btn btn-secondary btn-icon" type="button"><i class="fa fa-user" aria-hidden="true"></i></button>
</span>
<input type="text" value="<?=set_value('customer_name', isset($custData['customer_name'])? $custData['customer_name']: '');?>" class="form-control bod-form" placeholder="First Name" id="customer_name" name="customer_name" required="">
</div>
<div class="input-group form-group">
<span class="input-group-btn">
<button class="btn btn-secondary btn-icon" type="button"><i class="fa fa-user" aria-hidden="true"></i></button>
</span>
<input type="text" value="<?=set_value('customer_lastname', isset($custData['customer_lastname'])? $custData['customer_lastname']: '');?>" class="form-control bod-form" placeholder="Last Name" id="customer_lastname" name="customer_lastname" required="">
</div>
<div class="input-group form-group">
<span class="input-group-btn">
<button class="btn btn-secondary btn-icon" type="button"><i class="fa fa-envelope" aria-hidden="true"></i></button>
</span>
<input type="email" value="<?=set_value('customer_email', isset($custData['customer_email'])? $custData['customer_email'] : '');?>" class="form-control bod-form" placeholder="Email Address" id="customer_email" name="customer_email" required="">
</div>
<div class="input-group form-group">
<span class="input-group-btn">
<button class="btn btn-secondary btn-icon" type="button"><i class="fa fa-phone" aria-hidden="true"></i></button>
</span>
<input type="text" id="customer_phone" name="customer_phone" value="<?=set_value('customer_phone', isset($custData['customer_phone'])? $custData['customer_phone'] : '');?>" data-value="<?=set_value('customer_phone', isset($custData['customer_phone'])? $custData['customer_phone'] : '');?>" class="form-control bod-form commonInputClass" pattern="(?:[+][0-9]{1,3}[\s]?)?(?:(?:[(][0-9]{2}[)][\s]?)|(?:[0-9]{2}[\s]?))?(?:(?:[0-9]{1}[0-9.-]{6,8}[0-9]{1})|(?:[0-9]{1}[\s]?[0-9\.-]{6,8}[0-9]{1})){1}" placeholder="Your Contact Number" required="">
</div>
<h3>Your Home Address</h3>
<p class="instP">Your present delivery address. Want different delivery address? <span id="edit-address" data-id="1">Click here</span></p>
<div class="col-md-12 custom-padding-0">
<div class="input-group form-group">
<span class="input-group-btn">
<button class="btn btn-secondary btn-icon" type="button"><i class="fa fa-map-marker" aria-hidden="true"></i></button>
</span>
<input type="text" id="customer_street" name="customer_street" value="<?=set_value('customer_street', isset($custData['customer_street'])? $custData['customer_street'] : '');?>" data-value="<?=set_value('customer_street', isset($custData['customer_street'])? $custData['customer_street'] : '');?>" class="form-control bod-form commonInputClass" placeholder="Your Address" required="">
</div>
<div class="input-group form-group" style="width: 100%;">
<select class="fs_input form-control" required="" name="customer_city" id="customer_city">
<option value="">Select City</option>
<?php
if ($CityList && is_array($CityList)) {
foreach ($CityList as $key => $value) {
if ($custData['customer_city'] && $value->city_id == $custData['customer_city']) {
$mySelect = 'selected';
}
else {
$mySelect = '';
}
?>
<option value="<?=$value->city_id?>" <?=$mySelect?>><?=$value->cityname?></option>
<?php
}
}
?>
</select>
</div>
<p class="instP">This will be used for delivery addrees verification</p>
<div class="input-group form-group" style="width: 100%;">
<select class="fs_input form-control" required="" name="customer_state" id="customer_state">
<?php
if ($StateList && is_array($StateList)) {
foreach ($StateList as $key => $value) {
if ($custData['customer_state'] && $value->statecode == $custData['customer_state']) {
$mySelect = 'selected';
}
else {
$mySelect = '';
}
?>
<option value="<?=$value->statecode?>" <?=$mySelect?>><?=$value->statename?></option>
<?php
}
}
?>
</select>
</div>
<div class="input-group form-group">
<span class="input-group-btn">
<button class="btn btn-secondary btn-icon" type="button"><i class="fa fa-location-arrow" aria-hidden="true"></i></button>
</span>
<input onkeypress="return only_num(event, this.value)" maxlength="5" data-minlength="5" type="text" id="customer_zip" name="customer_zip" value="<?=set_value('customer_zip', isset($custData['customer_zip'])? $custData['customer_zip'] : '');?>" data-value="<?=set_value('customer_zip', isset($custData['customer_zip'])? $custData['customer_zip'] : '');?>" class="form-control bod-form commonInputClass" placeholder="Zip Code" required="">
</div>
</div>
<h3><i class="fa fa-comments" aria-hidden="true"></i> Delivery Instructions <span class="DIexample">(eg.Gate Code info, Beware of Dog,Go around to the back, etc...)</span></h3>
<div class="form-group">
<textarea class="form-control bod-form" rows="5" id="instructions" name="instructions"><?=set_value('instructions');?></textarea>
</div>
</div>
<div class="checkBg mctop30">
<h3 class="ckh"><i class="fa fa-credit-card-alt" aria-hidden="true"></i> Please Provide Payment Information</h3>
<!-- <div class="checkRadioInner">
<span class="checkRadio">
<input id="pay-paypal" name="paybox" type="radio">
</span>
<span class="checkPayImg mcleft"><img src="assets/img/paypal-payment-logo.png"></span>
</div>
<div class="checkRadioInner mcleft8">
<span class="checkRadio">
<input id="pay-card" name="paybox" checked="checked" type="radio">
</span>
<span class="checkPayImg mcleft"><img src="assets/img/pay-by-card.png"></span>
</div> -->
<div class="clearfix"></div>
<div class="row editSection mctop30">
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="input-group form-group">
<input onkeypress="return only_num(event, this.value)" class="fs_input cardClass" id="cc_number" name="cc_number" value="<?=set_value('cc_number', isset($cc_number)?$cc_number:'')?>" placeholder="Card Number" type="text" required="">
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-cc"></i></span>
</div>
</div>
<?php
$selected = 'selected';
?>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="form-group">
<select id="cc_type" name="cc_type" placeholder="Card Type" class="fs_input cardClass" required="">
<option value="" selected="selected">Card Type</option>
<option value="Visa" <?=isset($cc_type)&&$cc_type=='Visa'?$selected:''?> >Visa</option>
<option value="MasterCard" <?=isset($cc_type)&&$cc_type=='MasterCard'?$selected:''?> >Master Card</option>
<option value="Discover" <?=isset($cc_type)&&$cc_type=='Discover'?$selected:''?> >Discover</option>
<option value="Amex" <?=isset($cc_type)&&$cc_type=='Amex'?$selected:''?> >Amex</option>
</select>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="form-group">
<select id="cc_exp_month" name="cc_exp_month" placeholder="Expiration Month" class="fs_input cardClass" required="">
<option value="" selected="selected">Expiration Month</option>
<option value="01" <?=isset($cc_exp_month)&&$cc_exp_month=='01'?$selected:''?> >Jan</option>
<option value="02" <?=isset($cc_exp_month)&&$cc_exp_month=='02'?$selected:''?> >Feb</option>
<option value="03" <?=isset($cc_exp_month)&&$cc_exp_month=='03'?$selected:''?> >Mar</option>
<option value="04" <?=isset($cc_exp_month)&&$cc_exp_month=='04'?$selected:''?> >Apr</option>
<option value="05" <?=isset($cc_exp_month)&&$cc_exp_month=='05'?$selected:''?> >May</option>
<option value="06" <?=isset($cc_exp_month)&&$cc_exp_month=='06'?$selected:''?> >Jun</option>
<option value="07" <?=isset($cc_exp_month)&&$cc_exp_month=='07'?$selected:''?> >Jul</option>
<option value="08" <?=isset($cc_exp_month)&&$cc_exp_month=='08'?$selected:''?> >Aug</option>
<option value="09" <?=isset($cc_exp_month)&&$cc_exp_month=='09'?$selected:''?> >Sep</option>
<option value="10" <?=isset($cc_exp_month)&&$cc_exp_month=='10'?$selected:''?> >Oct</option>
<option value="11" <?=isset($cc_exp_month)&&$cc_exp_month=='11'?$selected:''?> >Nov</option>
<option value="12" <?=isset($cc_exp_month)&&$cc_exp_month=='12'?$selected:''?> >Dec</option>
</select>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="form-group">
<select id="cc_exp_year" name="cc_exp_year" placeholder="Expiration Year" class="fs_input cardClass" required="">
<option value="" selected="selected">Expiration Year</option>
<?php
$nowYear = date("Y");
$maxYear = date("Y", strtotime('+15 years'));
for($i = $nowYear; $i <= $maxYear; $i++) {
if (isset($cc_exp_year) && $i == $cc_exp_year) {
$mySelect = 'selected';
}
else {
$mySelect = '';
}
?>
<option value="<?=$i?>" <?=$mySelect?>><?=$i?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-12">
<div class="form-group">
<input onkeypress="return only_num(event, this.value)" class="fs_input cardClass" id="cc_cvv" name="cc_cvv" placeholder="CVV Code" type="password" maxlength="3" minlength="3" required="" value="<?=set_value('cc_cvv', isset($cc_cvv)?$cc_cvv:'')?>">
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="col-md-4 col-sm-12 col-xs-12 paddxs cartWrap">
<div class="cart__header">
<div class="cart__header__title">
<span class="default-delivery-label">Your order</span>
<span class="fa fa-refresh fa-spin pull-right" id="cartLoader" style="display: none;"></span>
<div class="clearfix"></div>
</div>
</div>
<div class="cart__products">
<span id="cartDetailsWrap">
<div class="table-responsive">
<table class="table table-hover table-bordered" id="add-cart">
<tbody>
<tr class="text-center">
<td>
No items added yet!
</td>
</tr>
</tbody>
</table>
</div>
</span>
<div class="clearfix"></div>
<?php
if ($this->session->userdata('order_restaurant_id') && isset($cart) && is_array($cart) && count($cart) > 0) {
?>
<div class="col-md-12 col-sm-12 col-xs-12 posrel">
<p class="earnft">We appreciate your gratuity, please note that this is the primary way drivers earn money.</p>
<div class="form-group">
<div class="tipsWrap">
<label class="tips">Tips:</label>
<input type="radio" name="ifTip" value="tip_yes" id="ifTip_yes" checked="">
<label for="ifTip_yes">Yes</label>
<input type="radio" name="ifTip" value="tip_no" id="ifTip_no">
<label for="ifTip_no">No</label>
</div>
<div class="clearfix"></div>
<div class="tipsWrap tipsIPWrap" id="tipsIPWrap">
<div class="clearfix"></div>
<p>Enter Fixed or Percentage Amount: </p>
<input type="hidden" id="TipsHidden" value="0"></input>
<div class="clearfix"></div>
<input type="radio" name="TipType" value="per" id="TipType_per" checked="">
<label for="ifTip_yes">Percentage</label>
<input type="radio" name="TipType" value="fix" id="TipType_fix">
<label for="ifTip_no">Fixed</label>
<div class="col-sm-12" style="padding-left: 0px; margin-top: 5px;" id="TipType_per_wrap">
<select name="tip_per" id="tip_per" class="fs_input">
<option value="2">2%</option>
<option value="5">5%</option>
<option value="10">10%</option>
<option value="15">15%</option>
<option value="20">20%</option>
</select>
</div>
<div class="col-sm-12" style="padding-left: 0px; margin-top: 5px;display: none;" id="TipType_fix_wrap">
<input type="text" class="form-control twc couponCodeIP" name="tip_fix" id="tip_fix" placeholder="Fixed($)" onkeypress="return isDecimal(event)">
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
<table class="table table-hover table-bordered" style="margin-top: 10px;">
<tbody style="border-top: 2px solid #DDD;">
<tr style="font-weight:600;">
<td class="text-right" width="75%">Total:</td>
<td width="20%" id="checkOutGrandTotal">$0.00</td>
</tr>
</tbody>
</table>
<p class="earnft">If you prefer, you can tip cash when driver arrives.</p>
</div>
<div class="clearfix"></div>
<div class="col-md-8 col-sm-8 col-xs-12">
<div class="form-group">
<label for="sel1">Enter Coupon Code</label>
<input type="hidden" id="CouponHidden" value="0"></input>
<input type="text" class="form-control twc couponCodeIP" id="coupon_code" name="coupon_code">
<input type="hidden" id="coupon_type" name="coupon_type">
<input type="hidden" id="coupon_value" name="coupon_value">
<a href="javascript:void(0)" style="color: red; margin-top: 5px; display: none; font-size: 12px;" id="discard_coupon" onclick="discardCoupon()">Discard Coupon</a>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-12 paddleft">
<button type="button" class="btn cos-mh-btn mtop27" onclick="applyCoupon()">Apply</button>
</div>
<div style="clear: both;"></div>
<div class="col-xs-12">
<div id="successMsg" style="color: green; display: none;"></div>
<div id="errorMsg" style="color: red; display: none;"></div>
</div>
<div class="clearfix"></div>
<?php
$session_data = $this->session->userdata('order_restaurant_id');
$restaurant_id = $session_data['id'];
$this->db->select('restaurant_seourl');
$this->db->from('rt_restaurant');
$this->db->where('restaurant_id', $restaurant_id);
$myQuery = $this->db->get();
$myData = $myQuery->row();
?>
<div class="col-md-12 text-center btn-over mctop30">
<button type="button" onclick="window.location.href='<?=base_url();?>restaurantviewpage/<?=$myData->restaurant_seourl?>'" class="btn cos-mh-btn col-xs-12" style="float:none;">ADD MORE ITEMS</button>
</div>
<div class="clearfix"></div>
<div class="col-md-12 text-center btn-over">
<button type="submit" class="btn cos-mh-btn col-xs-12" style="float:none;">Checkout</button>
<p class="orgp terms">By placing this order you agree to the <a href="<?=base_url();?>terms">Terms & conditions</a></p>
</div>
<?php
}
?>
</div>
<!-- <div class="cart__header">
<div class="cart__header__title d-bar">
<span class="default-delivery-label">Delivery Order For Dine2You</span>
<div class="clearfix"></div>
</div>
</div>
<div class="cart__products bod-div">
<?php
if (isset($cart) && is_array($cart) && count($cart) > 0) {
?>
<div class="table-responsive">
<table class="table table-hover table-bordered" id="add-cart">
<tbody>
<?php
foreach ($cart as $key => $value) {
if ($value['size_name'] != '') {
$name = $value['name'].' ('.$value['size_name'].')';
}
else {
$name = $value['name'];
}
$addonsHtml = '';
if (is_array($value['addons']) && count($value['addons']) > 0) {
$addonsHtml .= '<div class="cartItemAddon">(';
$i = 1;
foreach ($value['addons'] as $keys => $values) {
//$subtotal = $subtotal + (floatval($values['addon_price']) * $values['addon_qty']);
if ($i > 1) {
$addonsHtml .= ', ';
}
$addonsHtml .= $values['addon_name'];
$i++;
}
$addonsHtml .= ')</div>';
}
?>
<tr class="text-center">
<td> <?=$value['qty']?> </td>
<td><?=$name?><?=$addonsHtml?></td>
<td class="text-left"> $<?=$value['subtotal']?> </td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-hover table-bordered" id="">
<tbody>
<tr>
<td></td>
<td></td>
<td class="text-right">Total Item:</td>
<td class="text-left">$<?=$cartData['subtotal']?></td>
</tr>
<tr>
<td></td>
<td></td>
<td class="text-right">Tax(<?=$cartData['taxAmount']?>%):</td>
<td class="text-left">$<?=number_format(($cartData['subtotal'] * ($cartData['taxAmount']/100)), 2, '.', '')?></td>
</tr>
</tbody>
<tbody id="delivery-charge1">
<tr style="font-weight:600;">
<td></td>
<td></td>
<td class="text-right">Subtotal:</td>
<td class="text-left">$<?=$cartData['subtotalWithTax']?></td>
</tr>
<tr style="color: rgb(11, 80, 158);" class="text-center">
<td></td>
<td></td>
<td class="text-right">Delivery Charge:</td>
<td class="text-left">$<?=$cartData['deliveryCharge']?></td>
</tr>
</tbody>
<tbody>
<tr style="font-weight:600;" class="text-center">
<td></td>
<td></td>
<td class="text-right">Grand Total:</td>
<td class="text-left">$<?=$cartData['subtotalWithTaxWithDelCharge']?></td>
</tr>
</tbody>
</table>
</div>
<div class="col-md-12 text-center btn-over mctop30">
<button type="button" class="btn cos-mh-btn col-xs-12" style="float:none;">ADD MORE ITEMS</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 posrel">
<p class="earnft">We appreciate your gratuity, please note that this is the primary way drivers earn money.</p>
<div class="form-group">
<label for="sel1">Tips</label>
<select class="fs_input csb-sel select2" name="tip" id="tip">
<option value="0">0%</option>
<option value="2">2%</option>
<option value="5" selected="">5%</option>
<option value="10">10%</option>
</select>
</div>
<p class="earnft">If you prefer, you can tip cash when driver arrives.</p>
</div>
<div class="clearfix"></div>
<div class="col-md-8 col-sm-8 col-xs-12">
<div class="form-group">
<label for="sel1">Coupon</label>
<input type="text" class="form-control twc" id="coupon_code" name="coupon_code">
<input type="hidden" class="form-control twc" id="coupon_type" name="coupon_type">
<input type="hidden" class="form-control twc" id="coupon_value" name="coupon_value">
<a href="javascript:void(0)" style="color: red; margin-top: 5px; display: none;" id="discard_coupon" onclick="discardCoupon()">Discard Coupon</a>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-12 paddleft">
<button type="button" class="btn cos-mh-btn mctop30" onclick="applyCoupon()">Apply</button>
</div>
<div class="clearfix"></div>
<div class="col-xs-12">
<div id="successMsg" style="color: green; display: none; margin-top: 5px;"></div>
<div id="errorMsg" style="color: red; display: none; margin-top: 5px;"></div>
</div>
<div class="clearfix"></div>
<div class="clearfix"></div>
<div class="col-md-12 text-center btn-over mctop30">
<button type="submit" class="btn cos-mh-btn col-xs-12" style="float:none;">Checkout</button>
<p class="orgp">By placing this order you agree to the <a href="terms.html">Terms & conditions</a></p>
</div>
<?php
}
else {
?>
<div class="table-responsive">
<table class="table table-hover table-bordered" id="">
<tbody>
<tr>
<td>No items in your cart yet!</td>
</tr>
</tbody>
</table>
</div>
<?php
}
?>
</div> -->
</div>
</form>
</div>
</div>
</section>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<form name="addOrderForm" id="addOrderForm" method="post">
<span id="menuDetailsWrap"></span>
</form>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(document).ready(function() {
$('#checkoutForm').validator();
$('#checkoutForm').validator().on('submit', function (e) {
if (e.isDefaultPrevented()) {
// handle the invalid form...
} else {
var cartSubtotal = parseFloat($('#subtotal').val());
if (cartSubtotal == 0.00) {
alert('Your cart is empty! Please add items in your cart to continue.');
return false;
}
}
})
$('#ifTip_yes').click(function() {
if ($(this).is(':checked')) {
$('#tipsIPWrap').show();
updateTipPer();
updateTipFix();
}
})
$('#ifTip_no').click(function() {
if ($(this).is(':checked')) {
$('#checkOutGrandTotal').html('$'+$('#subtotalWithTaxWithDelCharge').val());
$('#tipsIPWrap').hide();
$('#TipsHidden').val(0.00);
/*added on 26th Sept 2016*/
var subtotal = parseFloat($('#subtotal').val());
var couponAmount = $('#CouponHidden').val();
var salesTax = $('#salesTax').val();
var deliveryCharge = $('#deliveryCharge').val();
var newSubtotal = subtotal - couponAmount;
var tipCalc = $('#TipsHidden').val();
var newTaxAmount = newSubtotal * (salesTax / 100);
var newSubtotalWithTax = newSubtotal + newTaxAmount;
var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(deliveryCharge) + parseFloat(tipCalc);
$('#totalItemCheckout').html("$"+parseFloat(newSubtotal).toFixed(2));
$('#taxCheckout').html("$"+parseFloat(newTaxAmount).toFixed(2));
$('#subtotalWithTaxCheckout').html("$"+parseFloat(newSubtotalWithTax).toFixed(2));
$('#checkOutGrandTotal').html('$'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
/*ended on 26th Sept 2016*/
}
})
$('#tip_fix').keyup(function() {
updateTipFix();
})
$('#tip_per').change(function() {
updateTipPer();
})
$('#TipType_per').click(function() {
if ($(this).is(':checked')) {
$('#TipType_fix_wrap').hide();
$('#TipType_per_wrap').show();
updateTipPer();
}
})
$('#TipType_fix').click(function() {
if ($(this).is(':checked')) {
$('#TipType_per_wrap').hide();
$('#TipType_fix_wrap').show();
updateTipFix();
}
})
$("#edit-address").click(function(){
var dataid=$(this).attr("data-id");
if(dataid=="1")
{
$(this).attr("data-id", 2);
$(this).text("Revert");
$(".commonInputClass").val('');
}else
{
$(this).attr("data-id", 1);
$(this).text("Click Here");
$("#customer_street").val($("#customer_street").attr('data-value'));
$("#customer_zip").val($("#customer_zip").attr('data-value'));
$("#customer_phone").val($("#customer_phone").attr('data-value'));
}
});
})
function updateTipFix() {
if ($('#TipType_fix').is(':checked')) {
$('#checkOutGrandTotal').html('$'+parseFloat($('#subtotalWithTaxWithDelCharge').val()));
if ($('#tip_fix').val() === undefined || $('#tip_fix').val() == '') {
var tip = 0.00;
}
else {
var tip = parseFloat($('#tip_fix').val());
}
/*var grandTotal = parseFloat($('#subtotalWithTaxWithDelCharge').val());
var tip = parseFloat($('#tip_fix').val());
var tipCount = grandTotal + tip;
$('#TipsHidden').val(tipCount);
$('#checkOutGrandTotal').html('$'+parseFloat(tipCount).toFixed(2));
$('#subtotalWithTaxWithDelCharge').attr('data-value', parseFloat(tipCount).toFixed(2));*/
var subtotal = parseFloat($('#subtotal').val());
var couponAmount = $('#CouponHidden').val();
var salesTax = $('#salesTax').val();
var deliveryCharge = $('#deliveryCharge').val();
var newSubtotal = subtotal - couponAmount;
var tipCalc = tip;
var newTaxAmount = newSubtotal * (salesTax / 100);
var newSubtotalWithTax = newSubtotal + newTaxAmount;
var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(deliveryCharge) + parseFloat(tipCalc);
$('#totalItemCheckout').html("$"+parseFloat(newSubtotal).toFixed(2));
$('#taxCheckout').html("$"+parseFloat(newTaxAmount).toFixed(2));
$('#subtotalWithTaxCheckout').html("$"+parseFloat(newSubtotalWithTax).toFixed(2));
$('#checkOutGrandTotal').html('$'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
$('#TipsHidden').val(parseFloat(tipCalc).toFixed(2));
}
}
function updateTipPer() {
if ($('#TipType_per').is(':checked')) {
$('#checkOutGrandTotal').html('$'+parseFloat($('#subtotalWithTaxWithDelCharge').val()));
var subtotal = parseFloat($('#subtotal').val());
var couponAmount = $('#CouponHidden').val();
var salesTax = $('#salesTax').val();
var deliveryCharge = $('#deliveryCharge').val();
var tip = parseFloat($('#tip_per').val());
var newSubtotal = subtotal - couponAmount;
var tipCalc = newSubtotal * (tip / 100);
var newTaxAmount = newSubtotal * (salesTax / 100);
var newSubtotalWithTax = newSubtotal + newTaxAmount;
var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(deliveryCharge) + parseFloat(tipCalc);
$('#totalItemCheckout').html("$"+parseFloat(newSubtotal).toFixed(2));
$('#taxCheckout').html("$"+parseFloat(newTaxAmount).toFixed(2));
$('#subtotalWithTaxCheckout').html("$"+parseFloat(newSubtotalWithTax).toFixed(2));
$('#checkOutGrandTotal').html('$'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
$('#TipsHidden').val(parseFloat(tipCalc).toFixed(2));
}
}
function applyCoupon() {
$('#successMsg').html('').hide();
$('#errorMsg').html('').hide();
$('#discard_coupon').hide();
var coupon_code = $('#coupon_code').val();
if (coupon_code != '' && coupon_code !== undefined) {
$('#myLoader').show();
url='<?php echo base_url(); ?>createorderfrontend/applyCoupon';
$.ajax({
url: url,
type: 'POST',
data: {coupon_code: coupon_code},
success: function(data) {
$('#myLoader').hide();
var obj = JSON.parse(data);
if (obj['msg'] == 'valid') {
var subtotal = $('#subtotal').val();
var grandTotal = $('#subtotalWithTaxWithDelCharge').val();
var discountAmount = 0.00;
if (obj['type'] == 'per') {
var msg = 'You will get '+obj['offer']+'% off on this order';
var newAmt = grandTotal - (subtotal * (obj['offer']/100));
//msg += '<br>Current payable amount: <b>$'+parseFloat(newAmt).toFixed(2)+'</b>';
discountAmount = subtotal * (obj['offer']/100);
}
else {
var msg = 'You will get $'+obj['offer']+' off on this order';
var newAmt = grandTotal - obj['offer'];
//msg += '<br>Current payable amount: <b>$'+parseFloat(newAmt).toFixed(2)+'</b>';
discountAmount = obj['offer'];
}
$('#CouponHidden').val(discountAmount);
$('#successMsg').html(msg).show();
$('#coupon_type').val(obj['type']);
$('#coupon_value').val(obj['offer']);
$('#discard_coupon').show();
/*var myHtml = '<tr><td class="text-right" width="75%">Coupon Discount:</td>'+
'<td width="20%">$'+parseFloat(discountAmount).toFixed(2)+'</td></tr>';
$('#subtotalRowCheckout').after(myHtml);*/
var subtotal = parseFloat($('#subtotal').val());
var couponAmount = discountAmount;
var salesTax = $('#salesTax').val();
var deliveryCharge = $('#deliveryCharge').val();
var tip = parseFloat($('#TipsHidden').val());
var newSubtotal = subtotal - couponAmount;
var tipCalc = tip;
var newTaxAmount = newSubtotal * (salesTax / 100);
var newSubtotalWithTax = newSubtotal + newTaxAmount;
var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(deliveryCharge) + parseFloat(tipCalc);
$('#totalItemCheckout').html("$"+parseFloat(newSubtotal).toFixed(2));
$('#taxCheckout').html("$"+parseFloat(newTaxAmount).toFixed(2));
$('#subtotalWithTaxCheckout').html("$"+parseFloat(newSubtotalWithTax).toFixed(2));
$('#checkOutGrandTotal').html('$'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
$('#TipsHidden').val(parseFloat(tipCalc).toFixed(2));
}
else if (obj['msg'] == 'invalid') {
$('#CouponHidden').val(0);
$('#errorMsg').html('Invalid Coupon Code.').show();
$('#coupon_type').val('');
$('#coupon_value').val('');
}
console.log(data);
},
error: function(data) {
$('#errorMsg').html('Invalid Coupon Code.').show();
$('#myLoader').hide();
console.log(data);
}
})
}
else {
$('#errorMsg').html('Please enter a coupon code.').show();
}
}
function discardCoupon() {
$('#CouponHidden').val(0);
$('#successMsg').html('').hide();
$('#errorMsg').html('').hide();
$('#discard_coupon').hide();
$('#coupon_code').val('');
$('#coupon_type').val('');
$('#coupon_value').val('');
$('#errorMsg').html('Coupon discarderd!').show();
/*added on 26th Sept 2016*/
var subtotal = parseFloat($('#subtotal').val());
var couponAmount = $('#CouponHidden').val();
var salesTax = $('#salesTax').val();
var deliveryCharge = $('#deliveryCharge').val();
var newSubtotal = subtotal - couponAmount;
var tipCalc = $('#TipsHidden').val();
var newTaxAmount = newSubtotal * (salesTax / 100);
var newSubtotalWithTax = newSubtotal + newTaxAmount;
var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(deliveryCharge) + parseFloat(tipCalc);
$('#totalItemCheckout').html("$"+parseFloat(newSubtotal).toFixed(2));
$('#taxCheckout').html("$"+parseFloat(newTaxAmount).toFixed(2));
$('#subtotalWithTaxCheckout').html("$"+parseFloat(newSubtotalWithTax).toFixed(2));
$('#checkOutGrandTotal').html('$'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
/*ended on 26th Sept 2016*/
}
/*copied from previous page*/
$(function() {
/*$('#cartFullForm').validator().on('submit', function (e) {
if (e.isDefaultPrevented()) {
// handle the invalid form...
} else {
var cartSubtotal = parseFloat($('#subtotal').val());
if (cartSubtotal == 0.00) {
alert('Your cart is empty! Please add items in your cart to continue.');
return false;
}
}
})*/
base_url='<?php echo base_url(); ?>';
url= base_url+'createorderfrontend/updateCartView';
$('#cartLoader').show();
$.ajax({
url: url,
type: 'POST',
success: function(data) {
//console.log(data);
obj = JSON.parse(data);
$('#cartDetailsWrap').html(obj['myHtml']);
$('#cartSubtotal').html(obj['subtotal']);
$('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);
$('#checkOutGrandTotal').html('$'+obj['subtotalWithTaxWithDelCharge']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
$('#salesTax').val(obj['salesTax']);
$('#cartLoader').hide();
updateTipPer();
}
})
$('#cartFullForm').validator().on('submit', function (e) {
if (e.isDefaultPrevented()) {
// handle the invalid form...
} else {
var cartSubtotal = parseFloat($('#cartSubtotal').html());
if (cartSubtotal == 0.00) {
$('#cartDetails').modal('show');
return false;
}
}
})
})
function setSizeDetails(myThis) {
var sizeId = $(myThis).attr('data-size-id');
var sizeName = $(myThis).attr('data-size-name');
var sizePrice = $(myThis).attr('data-size-price');
$('#mySizeId').val(sizeId);
$('#mySizeName').val(sizeName);
$('#mySizePrice').val(sizePrice);
}
function setAddonDetails(myThis, parentId, childId) {
var myString = '';
var checked_quan = 0;
$('#addon-qty-'+childId).html('1');
$('input.single-checkbox_'+parentId).each(function() {
if ($(this).is(':checked')==true) {
checked_quan = checked_quan+1;
var addonName = $(this).attr('data-addon-name');
var addonPrice = $(this).attr('data-addon-price');
var addonId = $(this).attr('data-addon-id');
var addonQty = parseInt($('#addon-qty-'+addonId).html());
myString += ','+addonName+'|'+addonPrice+'|'+addonQty+'|'+addonId+'|'+parentId;
}
});
$('#myAddonList_'+parentId).val(myString);
}
function changeAddonCount(myThis, childId, parentId, reason, cnt) {
var myString = '';
var checked_quan = 0;
var myAddonQty = 0;
var quantity = $('#myMenuQty').val();
cnt = cnt * quantity;
if ($('#advacce_menu_'+childId).is(':checked') == false) {
return false;
}
$('input.single-checkbox_'+parentId).each(function() {
if ($(this).is(':checked')==true) {
var addonId = $(this).attr('data-addon-id');
myAddonQty = myAddonQty + parseInt($('#addon-qty-'+addonId).html());
}
});
if (myAddonQty >= cnt && reason == 'i') {
return false;
}
var nowCount = $('#addon-qty-'+childId).html();
var nextCount = parseInt(nowCount);
if (reason == 'd' && nextCount > 1) {
nextCount = nextCount - 1;
}
else if (reason == 'i') {
nextCount = nextCount + 1;
}
$('#addon-qty-'+childId).html(nextCount);
$('input.single-checkbox_'+parentId).each(function() {
if ($(this).is(':checked')==true) {
checked_quan = checked_quan+1;
var addonName = $(this).attr('data-addon-name');
var addonPrice = $(this).attr('data-addon-price');
var addonId = $(this).attr('data-addon-id');
var addonQty = parseInt($('#addon-qty-'+addonId).html());
myString += ','+addonName+'|'+addonPrice+'|'+addonQty+'|'+addonId+'|'+parentId;
}
});
$('#myAddonList_'+parentId).val(myString);
}
function addonLimit(cnt, childId, parentId) {
var myAddonQty = 0;
var quantity = $('#myMenuQty').val();
cnt = cnt * quantity;
var checked_quan = 0;
$('input.single-checkbox_'+parentId).each(function() {
if ($(this).is(':checked')==true) {
checked_quan = checked_quan+1;
var addonId = $(this).attr('data-addon-id');
myAddonQty = myAddonQty + parseInt($('#addon-qty-'+addonId).html());
}
});
if(checked_quan > cnt || myAddonQty > cnt) {
$("#advacce_menu_"+childId).attr('checked', false);
}
}
function resetAddon(myThis) {
var quantity = $(myThis).val();
var oldQuantity = $(myThis).attr('data-old-qty');
$(myThis).attr('data-old-qty', quantity);
$('.commonChooseUpto').each(function() {
var oldUpto = parseInt($(this).attr('data-old-count'));
var newUpto = oldUpto * quantity;
$(this).html(newUpto);
})
if (oldQuantity > quantity) {
$('.commonCheckbox').attr('checked', false);
$('.commonAddonQuantity').html('1');
$('.commonMyAddonList').val('');
}
}
function addOrder() {
url='<?php echo base_url(); ?>createorderfrontend/addOrder';
$('#cartLoader').show();
$.ajax({
url: url,
type: 'POST',
data: $('#addOrderForm').serialize(),
success: function(data) {
obj = JSON.parse(data);
$('#cartDetailsWrap').html(obj['myHtml']);
$('#cartSubtotal').html(obj['subtotal']);
$('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);
$('#checkOutGrandTotal').html('$'+obj['subtotalWithTaxWithDelCharge']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
//console.log(data);
/*added on 26th Sept 2016*/
var subtotal = parseFloat($('#subtotal').val());
var couponAmount = $('#CouponHidden').val();
var salesTax = $('#salesTax').val();
var deliveryCharge = $('#deliveryCharge').val();
var newSubtotal = subtotal - couponAmount;
var tipCalc = $('#TipsHidden').val();
var newTaxAmount = newSubtotal * (salesTax / 100);
var newSubtotalWithTax = newSubtotal + newTaxAmount;
var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(deliveryCharge) + parseFloat(tipCalc);
$('#totalItemCheckout').html("$"+parseFloat(newSubtotal).toFixed(2));
$('#taxCheckout').html("$"+parseFloat(newTaxAmount).toFixed(2));
$('#subtotalWithTaxCheckout').html("$"+parseFloat(newSubtotalWithTax).toFixed(2));
$('#checkOutGrandTotal').html('$'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
/*ended on 26th Sept 2016*/
$('#cartLoader').hide();
}
})
$("#myModal").modal("hide");
}
function editOrder(rowid, menu_id) {
$('#myLoader').show();
url='<?php echo base_url(); ?>createorderfrontend/showEditItemDetails';
$.ajax({
url: url,
type: 'POST',
data: {rowid: rowid, id: menu_id},
success: function(data) {
$('#myLoader').hide();
$("#menuDetailsWrap").html(data);
$('#myModal').modal("show");
},
error: function(data) {
$('#myLoader').hide();
console.log(data);
}
})
}
function deleteFromCart(rowid) {
//$('#row_'+rowid).fadeOut();
url='<?php echo base_url(); ?>createorderfrontend/deleteFromCart';
$('#cartLoader').show();
$.ajax({
url: url,
type: 'POST',
data: {rowid: rowid},
success: function(data) {
obj = JSON.parse(data);
$('#cartDetailsWrap').html(obj['myHtml']);
$('#cartSubtotal').html(obj['subtotal']);
$('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);
$('#checkOutGrandTotal').html('$'+obj['subtotalWithTaxWithDelCharge']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
/*added on 26th Sept 2016*/
var subtotal = parseFloat($('#subtotal').val());
var couponAmount = $('#CouponHidden').val();
var salesTax = $('#salesTax').val();
var deliveryCharge = $('#deliveryCharge').val();
var newSubtotal = subtotal - couponAmount;
var tipCalc = $('#TipsHidden').val();
var newTaxAmount = newSubtotal * (salesTax / 100);
var newSubtotalWithTax = newSubtotal + newTaxAmount;
var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(deliveryCharge) + parseFloat(tipCalc);
$('#totalItemCheckout').html("$"+parseFloat(newSubtotal).toFixed(2));
$('#taxCheckout').html("$"+parseFloat(newTaxAmount).toFixed(2));
$('#subtotalWithTaxCheckout').html("$"+parseFloat(newSubtotalWithTax).toFixed(2));
$('#checkOutGrandTotal').html('$'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
/*ended on 26th Sept 2016*/
$('#cartLoader').hide();
}
})
}
function changeCount(rowid, reason) {
var nowCount = $('#count_'+rowid).html();
var nextCount = parseInt(nowCount);
if (reason == 'd' && nextCount > 1) {
nextCount = nextCount - 1;
}
else if (reason == 'i') {
nextCount = nextCount + 1;
}
$('#count_'+rowid).html(nextCount);
url='<?php echo base_url(); ?>createorderfrontend/updateCartCount';
$.ajax({
url: url,
type: 'POST',
data: {rowid: rowid, qty: nextCount},
success: function(data) {
obj = JSON.parse(data);
$('#cartDetailsWrap').html(obj['myHtml']);
$('#cartSubtotal').html(obj['subtotal']);
$('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);
$('#checkOutGrandTotal').html('$'+obj['subtotalWithTaxWithDelCharge']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
}
})
}
function ShowDetails(my_id) {
if (my_id === undefined) {
my_id = 0;
}
$('#myLoader').show();
url='<?php echo base_url(); ?>createorderfrontend/showItemDetails';
$.ajax({
url: url,
type: 'POST',
data: {id: my_id},
success: function(data) {
$('#myLoader').hide();
$("#menuDetailsWrap").html(data);
$('#myModal').modal("show");
},
error: function(data) {
$('#myLoader').hide();
console.log(data);
}
})
}
</script>
<style type="text/css">
.cartItemAddon {
font-size: 10px;
}
.addonSingleWrap i {
color: #54B67A;
}
.cartItemRow {
border-bottom: 1px dashed #D2D2D2;
}
.cartWrap {
box-shadow: 0px 0px 10px 0px #E7E7E7;
}
.orgp.terms {
font-size: 14px;
margin-top: 10px;
margin-bottom: 10px;
}
.couponCodeIP {}
.mtop27 {
margin-top: 27px;
}
.tipsWrap {
margin-bottom: 7px;
}
.tipsWrap * {
vertical-align: middle;
}
.tipsWrap > label.tips {
margin-right: 25px;
}
.tipsWrap input {
margin-top: 0px;
}
.tipsWrap label {
margin-bottom: 0px;
}
.tipsWrap input+label {
margin-right: 10px;
}
.tipsIPWrap p {
font-size: 14px;
}
.hideInCheckout {
display: none;
}
</style>