AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.80
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/views/frontend/checkout.php
<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;?>">
          <input type="hidden" name="orderType" id="orderType" value="<?=$cartData['orderType']?$cartData['orderType']:0;?>" data-value="<?=$cartData['orderType']?$cartData['orderType']:0;?>">
      <input type="hidden" name="orderTypeValidation" id="orderTypeValidation" value="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">&times;</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">&times;</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">&times;</a>
            <strong><?php echo $this->session->flashdata('error_msg'); ?></strong> 
          </div>
        <?php } ?>
          <h3 class="ckh"><i class="fa fa-car" aria-hidden="true"></i> <?php echo $this->lang->line('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 myInput" placeholder="<?php echo $this->lang->line('First_Name');?>" id="customer_name" name="customer_name" required="" data-error="<?php echo $this->lang->line('Error_First_Name');?>">
          </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 myInput" data-error="<?php echo $this->lang->line('Error_Last_Name');?>" placeholder="<?php echo $this->lang->line('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 myInput" 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 myInput" 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}" data-error="<?php echo $this->lang->line('Error_mobile');?>" data-pattern-error="<?php echo $this->lang->line('Error_pattern_mobile');?>" placeholder="<?php echo $this->lang->line('Your_Contact_Number');?>" required="">
          </div>
          <h3><?php echo $this->lang->line('Your_Home_Address');?></h3>
          <?php
            if (isset($custData['customer_id'])) {
          ?>
          <p class="instP"><?php echo $this->lang->line('This_is_your');?> <span id="edit-address" data-id="1"><?php echo $this->lang->line('Click_here');?></span></p>
          <?php
            }
          ?>
          <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 myInput sameAsInput" placeholder="<?php echo $this->lang->line('Address');?>" data-error="<?php echo $this->lang->line('Error_address');?>" 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-location-arrow" aria-hidden="true"></i></button>
              </span>
              <input onkeyup="findAddressByZip(this.value)" pattern="^([0-9]){5}([-])([0-9]){3}$" 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 myInput sameAsInput" placeholder="<?php echo $this->lang->line('Zipcode');?>" data-error="<?php echo $this->lang->line('Error_zipcode');?>" required="">
            </div>
            <div class="input-group form-group" style="width: 100%;">
              <input type="text" id="customer_city" name="customer_city" value="<?=set_value('customer_city', isset($custData['customer_city'])? $custData['customer_city'] : '');?>" data-value="<?=set_value('customer_city', isset($custData['customer_zip'])? $custData['customer_city'] : '');?>" class="form-control bod-form commonInputClass myInput generatedCity sameAsInput" placeholder="<?php echo $this->lang->line('City');?>" data-error="<?php echo $this->lang->line('Error_city');?>" required="" readonly
              >
            </div>
            <p class="instP"><?php echo $this->lang->line('This_will_be_used');?></p>
            <div class="input-group form-group" style="width: 100%;">
              <input type="text" id="customer_state" name="customer_state" value="<?=set_value('customer_state', isset($custData['customer_state'])? $custData['customer_state'] : '');?>" data-value="<?=set_value('customer_state', isset($custData['customer_zip'])? $custData['customer_state'] : '');?>" class="form-control bod-form commonInputClass myInput generatedState sameAsInput" placeholder="<?php echo $this->lang->line('State');?>" data-error="<?php echo $this->lang->line('Error_State');?>" required="" readonly
              >
            </div>
          </div>

          <h3><?php echo $this->lang->line('Billing_Address');?></h3>
          <p class="instP" style="vertical-align: middle;">
            <input style="vertical-align: middle; margin: 0px;" type="checkbox" name="same_billing_address" id="same_billing_address" value="1" onclick="sameAddress(this)">
            <span style="vertical-align: middle;">
              <?php echo $this->lang->line('Same_as_home_address');?>
            </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_billing_street" name="customer_billing_street" value="<?=set_value('customer_billing_street');?>" class="form-control bod-form commonBilling" placeholder="<?php echo $this->lang->line('Billing_Address');?>" 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-location-arrow" aria-hidden="true"></i></button>
              </span>
              <input onkeyup="findAddressByZip(this.value, 'customer_billing_city', 'customer_billing_state')" pattern="^([0-9]){5}([-])([0-9]){3}$" type="text" id="customer_billing_zip" name="customer_billing_zip" value="<?=set_value('customer_billing_zip');?>" class="form-control bod-form commonBilling" placeholder="<?php echo $this->lang->line('Zipcode');?>" data-error="<?php echo $this->lang->line('Error_zipcode');?>" required="">
            </div>
            <div class="input-group form-group" style="width: 100%;">
              <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_billing_city" name="customer_billing_city" value="<?=set_value('customer_billing_city');?>" class="form-control bod-form commonBilling" placeholder="<?php echo $this->lang->line('City');?>" data-error="<?php echo $this->lang->line('Error_city');?>" required="" readonly>
            </div>
            <div class="input-group form-group" style="width: 100%;">
              <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_billing_state" name="customer_billing_state" value="<?=set_value('customer_billing_state');?>" class="form-control bod-form commonBilling" placeholder="<?php echo $this->lang->line('State');?>" data-error="<?php echo $this->lang->line('Error_State');?>" required="" readonly>
            </div>
          </div>

          <h3><i class="fa fa-comments" aria-hidden="true"></i> <?php echo $this->lang->line('Instructions');?> <span class="DIexample"><?php echo $this->lang->line('eg.Gate');?></span></h3>
          <div class="form-group">
            <textarea class="form-control bod-form myInput" rows="5" id="instructions" name="instructions"><?=set_value('instructions');?></textarea>
          </div>
          <?php
            if (!$this->session->userdata('logged_in_customer')) {
          ?>
          <h3><?php echo $this->lang->line('Create_Account');?> <small>(<?php echo $this->lang->line('optional');?></small>)</h3>
          <p class="instP"><?php echo $this->lang->line('Enter_password');?></p>
          <div class="col-md-12 custom-padding-0">
            <div class="form-group">
              <input type="password" id="customer_password" name="customer_password" class="form-control bod-form myInput" placeholder="<?php echo $this->lang->line('Password');?>" data-minlength="6">
            </div>
          </div>
          <?php
            }
          ?>
        </div>
        <div class="checkBg mctop30">
          <h3 class="ckh"><i class="fa fa-credit-card-alt" aria-hidden="true"></i> <?php echo $this->lang->line('Provide_Payment');?></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="<?php echo $this->lang->line('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"><?php echo $this->lang->line('Card_Type');?></option>
                  <option value="Visa" <?=isset($cc_type)&&strtolower($cc_type)=='visa'?$selected:''?> >Visa</option>
                  <option value="MasterCard" <?=isset($cc_type)&&strtolower($cc_type)=='mastercard'?$selected:''?> >Master Card</option>
                  <option value="Discover" <?=isset($cc_type)&&strtolower($cc_type)=='discover'?$selected:''?> >Discover</option>
                  <option value="Amex" <?=isset($cc_type)&&strtolower($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"><?php echo $this->lang->line('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"><?php echo $this->lang->line('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="<?php echo $this->lang->line('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"><?php echo $this->lang->line('Your_order');?>(<?=$serviceType ? $serviceType : "NA";?>)</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>
                      <?php echo $this->lang->line('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"><?php echo $this->lang->line('We_appreciate_your');?></p>
             <div class="form-group">
              <div class="tipsWrap">
                <label class="tips"><?php echo $this->lang->line('Tips');?>:</label>
                <input type="radio" name="ifTip" value="tip_yes" id="ifTip_yes" checked="">
                <label for="ifTip_yes"><?php echo $this->lang->line('Yes');?></label>
                <input type="radio" name="ifTip" value="tip_no" id="ifTip_no">
                <label for="ifTip_no"><?php echo $this->lang->line('No');?></label>
              </div>
              <div class="clearfix"></div>
              <div class="tipsWrap tipsIPWrap" id="tipsIPWrap">
                <div class="clearfix"></div>
                <p><?php echo $this->lang->line('Enter_Fixed_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"><?php echo $this->lang->line('Percentage');?></label>
                <input type="radio" name="TipType" value="fix" id="TipType_fix">
                <label for="ifTip_no"><?php echo $this->lang->line('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="<?php echo $this->lang->line('Fixed')."(".SITENAME_CURRENCY.")";?>" 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;" id="checkOutGrandTotalRow">
                  <td class="text-right" width="75%"><?php echo $this->lang->line('Total');?>:</td>
                  <td width="20%" id="checkOutGrandTotal"><?=SITENAME_CURRENCY?>0.00</td>
                </tr>
              </tbody>
            </table>
            <p class="earnft"><?php echo $this->lang->line('If_you_prefer');?></p>
          </div>
          <?php if(isset($rewardAvailability) && $rewardAvailability){
              if(isset($redemptionAvailability) && $redemptionAvailability){?>
                        <div class="col-md-8 col-sm-8 col-xs-12 hide">
                            <div class="form-group">
                                <input type="checkbox" name="ifPointUsed" value="Yes" id="ifPointUsed" onchange="applyToOrder();">
                                <label for="ifPointUsed"><?php echo $this->lang->line('pointUsedAmount');?><br/><span><?=SITENAME_CURRENCY.$pointDetails["points"]?></span></label>
                                <input type="hidden" id="pointUsedAmount" name="pointUsedAmount" value="0.00" />
                                <input type="hidden" id="pointAmountBalance" name="pointAmountBalance" value="<?=$pointDetails["amount"]?>" />
                            </div>
                        </div>
                    <?php }
                }?>
          <div class="clearfix"></div>
          <div class="col-md-8 col-sm-8 col-xs-12">
             <div class="form-group">
              <label for="sel1"><?php echo $this->lang->line('Enter_Coupon_Code');?></label>
              <input type="hidden" id="CouponHidden" value="0.00"></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()"><?php echo $this->lang->line('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()"><?php echo $this->lang->line('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;"><?php echo $this->lang->line('ADD_MORE_ITEMS');?></button>
          </div>
          <div class="clearfix"></div>
          <div class="col-md-12 text-center btn-over">
            <div class="alert alert-warning" role="alert" id="checkoutFormError" style="display: none;">
                <strong><?php echo $this->lang->line('Warning');?></strong> <?php echo $this->lang->line('Warningmsg');?>
            </div>
            <button type="submit" class="btn cos-mh-btn col-xs-12" style="float:none;"><?php echo $this->lang->line('Checkout');?></button>
            <p class="orgp terms"><?php echo $this->lang->line('By_placing_this');?> <a href="<?=base_url();?>terms" target="blank"><?php echo $this->lang->line('terms');?></a></p>
          </div>
          <?php
            }
          ?>
        </div>
        <!-- <div class="cart__header">
            <div class="cart__header__title d-bar">
                <span class="default-delivery-label">Delivery Order For <?=SITENAME?></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"> -->
  <?php $parameters = array('name' => 'addOrderForm', 'id' => 'addOrderForm'); echo form_open('', $parameters); ?>
  <span id="menuDetailsWrap"></span>
  </form>
</div>
<div class="clearfix"></div>
<?php
  if ($this->session->userdata('tempCustData') && !isset($custData['customer_id'])) {
?>
<script type="text/javascript">
  $(document).ready(function() {
    $('#customer_name').val('<?=$this->session->userdata('tempCustData')['customer_name']?>');
    $('#customer_lastname').val('<?=$this->session->userdata('tempCustData')['customer_lastname']?>');
    $('#customer_email').val('<?=$this->session->userdata('tempCustData')['customer_email']?>');
    $('#customer_phone').val('<?=$this->session->userdata('tempCustData')['customer_phone']?>');
    $('#customer_street').val('<?=$this->session->userdata('tempCustData')['customer_street']?>');
    $('#customer_city').val('<?=$this->session->userdata('tempCustData')['customer_city']?>');
    $('#customer_state').val('<?=$this->session->userdata('tempCustData')['customer_state']?>');
    $('#customer_zip').val('<?=$this->session->userdata('tempCustData')['customer_zip']?>');
    $('#instructions').val('<?=$this->session->userdata('tempCustData')['instructions']?>');
    $('#customer_password').val('<?=$this->session->userdata('tempCustData')['customer_password']?>');
  })
</script>
<?php
  }
?>
<script type="text/javascript">
  $(document).ready(function() {
    $('#checkoutForm').validator();
    $('#checkoutForm').validator().on('submit', function (e) {
      if (e.isDefaultPrevented()) {
        $('#checkoutFormError').fadeIn();
      } else {
        $('#checkoutFormError').fadeOut();
        var cartSubtotal = parseFloat($('#subtotal').val());
        if (cartSubtotal == 0.00) {
          alert('Your cart is empty! Please add items in your cart to continue.');
          return false;
        }
        else if ($('#ifTip_yes').is(':checked') && $('#TipType_fix').is(':checked') && $('#tip_fix').val() != '' && parseFloat($('#tip_fix').val()) > cartSubtotal) {
          alert('<?php echo $this->lang->line('Tip_amount_should');?>');
          return false;
        }
        else if ($('#orderType').val() == 'delivery' && $('#orderTypeValidation').val() == '0') {
          e.preventDefault();
          $('#myLoader').show();
          var customer_street = $('#customer_street').val();
          var customer_zip = $('#customer_zip').val();
          var customer_city = $('#customer_city').val();
          var customer_state = $('#customer_state').val();
          base_url='<?php echo base_url(); ?>';
          url= base_url+'createorderfrontend/checkDeliveryArea';
          $.ajax({
            url: url,
            type: 'POST',
            data: {customer_street: customer_street, customer_zip: customer_zip, customer_city: customer_city, customer_state: customer_state, csrf_token_apm: myCsrfHash},
            success: function(data) {
              $('#myLoader').hide();
              var myData = JSON.parse(data);
              if (myData['isDeliveryAvailable']) {
                // updateCartView();
                swal({
                  title: '',
                  text: '<?php echo $this->lang->line('Delivery_Charge_Change');?>: <?=SITENAME_CURRENCY?>'+myData['deliveryCharge']+'. <?php echo $this->lang->line('Continue');?>',
                  type: 'warning',
                  showCancelButton: true,
                  confirmButtonText: "Ok",
                  closeOnConfirm: true
                },
                function(){
                  $('#orderTypeValidation').val('1');
                  $('#deliveryCharge').val(myData['deliveryCharge']);
                  $('#checkoutForm').submit();
                });
              }
              else {
                swal('', '<?php echo $this->lang->line('Delivery_available');?>', 'error');
                $('#orderTypeValidation').val('0');
              }
            }
          })
        }
        else {
          $('#myLoader').show();
        }
      }
    })
    $('#ifTip_yes').click(function() {
      if ($(this).is(':checked')) {
        $('#tipsIPWrap').show();
        updateTipPer();
        updateTipFix();
      }
    })
    $('#ifTip_no').click(function() {
      if ($(this).is(':checked')) {
        $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>'+$('#subtotalWithTaxWithDelCharge').val());
        $('#tipsIPWrap').hide();
        $('#TipsHidden').val(0.00);
        /*added on 26th Sept 2016*/
        updateFullCheckoutCount();
        /*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'));
      }
    });

    $('.myInput').on('change keyup', function() {
      var customer_name = $('#customer_name').val();
      var customer_lastname = $('#customer_lastname').val();
      var customer_email = $('#customer_email').val();
      var customer_phone = $('#customer_phone').val();
      var customer_street = $('#customer_street').val();
      var customer_city = $('#customer_city').val();
      var customer_state = $('#customer_state').val();
      var customer_zip = $('#customer_zip').val();
      var instructions = $('#instructions').val();
      var customer_password = $('#customer_password').val();
      //console.log(customer_name+'|'+customer_lastname+'|'+customer_email+'|'+customer_phone+'|'+customer_street+'|'+customer_city+'|'+customer_state+'|'+customer_zip+'|'+instructions+'|'+customer_password);
      url='<?php echo base_url(); ?>createorderfrontend/saveTempData';
      $.ajax({
        url: url,
        type: 'POST',
        data: {
          customer_name:      customer_name, 
          customer_lastname:  customer_lastname, 
          customer_email:     customer_email, 
          customer_phone:     customer_phone, 
          customer_street:    customer_street, 
          customer_city:      customer_city, 
          customer_state:     customer_state, 
          customer_zip:       customer_zip, 
          instructions:       instructions, 
          customer_password:  customer_password,
          csrf_token_apm:     myCsrfHash 
        },
        success: function(data) {
          //console.log(data);
        }
      })
    })
    $('.sameAsInput').on('change keyup', function() {
      if ($('#same_billing_address').is(':checked')) {
        $('#customer_billing_street').val($('#customer_street').val());
        $('#customer_billing_city').val($('#customer_city').val());
        $('#customer_billing_state').val($('#customer_state').val());
        $('#customer_billing_zip').val($('#customer_zip').val());
      }
    })
  })
  function sameAddress(myThis) {
    if ($(myThis).is(':checked')) {
      $('.commonBilling').attr('readonly', true);
      $('#customer_billing_street').val($('#customer_street').val());
      $('#customer_billing_city').val($('#customer_city').val());
      $('#customer_billing_state').val($('#customer_state').val());
      // $('#customer_billing_city').val($('#customer_city option:selected').attr('data-value'));
      // $('#customer_billing_state').val($('#customer_state option:selected').attr('data-value'));
      $('#customer_billing_zip').val($('#customer_zip').val());
    }
    else {
      $('.commonBilling').attr('readonly', false);
      $('#customer_billing_city').attr('readonly', true);
      $('#customer_billing_state').attr('readonly', true);
      // $('#customer_billing_street').val('');
      // $('#customer_billing_city').val('');
      // $('#customer_billing_state').val('');
      // $('#customer_billing_zip').val('');
    }
  }
  function updateTipFix() {
    if ($('#TipType_fix').is(':checked') && $('#ifTip_yes').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 subtotal = parseFloat($('#subtotal').val());
      var couponAmount = $('#CouponHidden').val();
      var salesTax = $('#salesTax').val();
      var deliveryCharge = $('#deliveryCharge').val();

      var newSubtotal = subtotal - couponAmount;
      if (newSubtotal < 0) {
        newSubtotal = 0.00;
        couponAmount = subtotal;
      }

      var tipCalc = tip;
      var newTaxAmount = (parseFloat(subtotal) + parseFloat(deliveryCharge)) * (salesTax / 100);
      // var newSubtotalWithTax = parseFloat(newSubtotal) + parseFloat(newTaxAmount) + parseFloat(deliveryCharge);
      var newSubtotalWithTax = parseFloat(subtotal) + parseFloat(newTaxAmount) + parseFloat(deliveryCharge);
      // var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(tipCalc);
      var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(tipCalc) - parseFloat(couponAmount);

      $('#totalItemCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(subtotal).toFixed(2));
      $('#taxCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(newTaxAmount).toFixed(2));
      $('#subtotalWithTaxCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(newSubtotalWithTax).toFixed(2));
      $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));

      $('#TipsHidden').val(parseFloat(tipCalc).toFixed(2));
      
      $('#tipCheckoutRow').remove();
      if (parseFloat(tipCalc).toFixed(2) != 0.00) {
        $('#tipCheckoutRow').remove();
        var myHtml = '<tr class="" id="tipCheckoutRow">'+
                    '<td class="text-right" width="75%"><?php echo $this->lang->line('Tips');?>:</td>'+
                    '<td width="25%" id="tipCheckoutAmt"><?=SITENAME_CURRENCY?>'+parseFloat(tipCalc).toFixed(2)+'</td>'+
                  '</tr>';
        $('#checkOutGrandTotalRow').before(myHtml);
      }
      $('#couponDiscountCheckoutRow').remove();
      if (couponAmount != 0.00 && couponAmount !== undefined) {
        $('#couponDiscountCheckoutRow').remove();
        var myHtml = '<tr class="" id="couponDiscountCheckoutRow">'+
                    '<td class="text-right" width="75%"><?php echo $this->lang->line('Coupon_Discount');?>:</td>'+
                    '<td width="25%" id="couponDiscountCheckoutAmt">-<?=SITENAME_CURRENCY?>'+couponAmount+'</td>'+
                  '</tr>';
        // $('#totalItemCheckoutRow').after(myHtml);
        $('#checkOutGrandTotalRow').before(myHtml);
      }

    }
      applyRewardPoints();
  }
  function updateTipPer() {
    if ($('#TipType_per').is(':checked') && $('#ifTip_yes').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;
      if (newSubtotal < 0) {
        newSubtotal = 0.00;
        couponAmount = subtotal;
      }
      //var tipCalc = newSubtotal * (tip / 100);
      var tipCalc = subtotal * (tip / 100);
      var newTaxAmount = (parseFloat(subtotal) + parseFloat(deliveryCharge)) * (salesTax / 100);
      // var newSubtotalWithTax = parseFloat(newSubtotal) + parseFloat(newTaxAmount) + parseFloat(deliveryCharge);
      var newSubtotalWithTax = parseFloat(subtotal) + parseFloat(newTaxAmount) + parseFloat(deliveryCharge);
      // var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(tipCalc);
      var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(tipCalc) - parseFloat(couponAmount);

      $('#totalItemCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(subtotal).toFixed(2));
      $('#taxCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(newTaxAmount).toFixed(2));
      $('#subtotalWithTaxCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(newSubtotalWithTax).toFixed(2));
      $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));
      $('#TipsHidden').val(parseFloat(tipCalc).toFixed(2));
      
      $('#tipCheckoutRow').remove();
      if (parseFloat(tipCalc).toFixed(2) != 0.00) {
        $('#tipCheckoutRow').remove();
        var myHtml = '<tr class="" id="tipCheckoutRow">'+
                    '<td class="text-right" width="75%"><?php echo $this->lang->line('Tips');?>:</td>'+
                    '<td width="25%" id="tipCheckoutAmt"><?=SITENAME_CURRENCY?>'+parseFloat(tipCalc).toFixed(2)+'</td>'+
                  '</tr>';
        $('#checkOutGrandTotalRow').before(myHtml);
      }
      $('#couponDiscountCheckoutRow').remove();
      if (couponAmount != 0.00 && couponAmount !== undefined) {
        $('#couponDiscountCheckoutRow').remove();
        var myHtml = '<tr class="" id="couponDiscountCheckoutRow">'+
                    '<td class="text-right" width="75%"><?php echo $this->lang->line('Coupon_Discount');?>:</td>'+
                    '<td width="25%" id="couponDiscountCheckoutAmt">-<?=SITENAME_CURRENCY?>'+couponAmount+'</td>'+
                  '</tr>';
        // $('#totalItemCheckoutRow').after(myHtml);
        $('#checkOutGrandTotalRow').before(myHtml);
      }

    }
      applyRewardPoints();
  }
  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, csrf_token_apm: myCsrfHash},
          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;
                var msg = '<div>Coupon applied successfully!</div>';
                if (obj['type'] == 'per') {
                  msg += '<div>'+obj['offer']+'% off on this order</div>';
                  var newAmt = grandTotal - (subtotal * (obj['offer']/100));
                  discountAmount = subtotal * (obj['offer']/100);
                }
                else {
                  msg += '<div><?=SITENAME_CURRENCY?>'+obj['offer']+' off on this order</div>';
                  var newAmt = grandTotal - obj['offer'];
                  discountAmount = obj['offer'];
                }
                $('#CouponHidden').val(discountAmount);
                $('#successMsg').html(msg).show();
                $('#coupon_type').val(obj['type']);
                $('#coupon_value').val(obj['offer']);
                $('#discard_coupon').show();
                updateFullCheckoutCount();
              }
              else if (obj['msg'] == 'invalid') {
                $('#CouponHidden').val(0.00);
                $('#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.00);
    $('#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*/
    updateFullCheckoutCount();
    /*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',
    data: {csrf_token_apm: myCsrfHash},
    success: function(data) {
      //console.log(data);
      obj = JSON.parse(data);
      $('#cartDetailsWrap').html(obj['myHtml']);
      $('#cartSubtotal').html(obj['subtotal']);
      $('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);

      $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>'+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('<?=SITENAME_CURRENCY?>'+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*/
      updateFullCheckoutCount();
      /*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, csrf_token_apm: myCsrfHash},
    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, csrf_token_apm: myCsrfHash},
    success: function(data) {
      obj = JSON.parse(data);
      $('#cartDetailsWrap').html(obj['myHtml']);
      $('#cartSubtotal').html(obj['subtotal']);
      $('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);

      $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>'+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*/
      updateFullCheckoutCount();
      /*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, csrf_token_apm: myCsrfHash},
    success: function(data) {
      obj = JSON.parse(data);
      $('#cartDetailsWrap').html(obj['myHtml']);
      $('#cartSubtotal').html(obj['subtotal']);
      $('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);

      $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>'+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, csrf_token_apm: myCsrfHash},
      success: function(data) {
          $('#myLoader').hide();
          $("#menuDetailsWrap").html(data);
          $('#myModal').modal("show");
      },
      error: function(data) {
          $('#myLoader').hide();
          console.log(data);
      }
  })
}
function updateFullCheckoutCount() {
  var subtotal = parseFloat($('#subtotal').val());
  var couponAmount = $('#CouponHidden').val();
  var salesTax = $('#salesTax').val();
  var deliveryCharge = $('#deliveryCharge').val();
  updateTipFix();
  updateTipPer();
  var newSubtotal = subtotal - couponAmount;
  if (newSubtotal < 0) {
    newSubtotal = 0.00;
    couponAmount = subtotal;
  }
  var tipCalc = $('#TipsHidden').val();
  var newTaxAmount = (parseFloat(subtotal) + parseFloat(deliveryCharge)) * (salesTax / 100);
  // var newSubtotalWithTax = parseFloat(newSubtotal) + parseFloat(newTaxAmount) + parseFloat(deliveryCharge);
  var newSubtotalWithTax = parseFloat(subtotal) + parseFloat(newTaxAmount) + parseFloat(deliveryCharge);
  // var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(tipCalc);
  var newSubtotalWithTaxWithDelCharge = parseFloat(newSubtotalWithTax) + parseFloat(tipCalc) - parseFloat(couponAmount);

  $('#totalItemCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(subtotal).toFixed(2));
  $('#taxCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(newTaxAmount).toFixed(2));
  $('#subtotalWithTaxCheckout').html("<?=SITENAME_CURRENCY?>"+parseFloat(newSubtotalWithTax).toFixed(2));
  $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>'+parseFloat(newSubtotalWithTaxWithDelCharge).toFixed(2));

  $('#tipCheckoutRow').remove();
  if (parseFloat(tipCalc).toFixed(2) != 0.00) {
    $('#tipCheckoutRow').remove();
    var myHtml = '<tr class="" id="tipCheckoutRow">'+
                '<td class="text-right" width="75%"><?php echo $this->lang->line('Tips');?>:</td>'+
                '<td width="25%" id="tipCheckoutAmt"><?=SITENAME_CURRENCY?>'+parseFloat(tipCalc).toFixed(2)+'</td>'+
              '</tr>';
    $('#checkOutGrandTotalRow').before(myHtml);
  }
  $('#couponDiscountCheckoutRow').remove();
  if (couponAmount != 0.00 && couponAmount !== undefined) {
    $('#couponDiscountCheckoutRow').remove();
    var myHtml = '<tr class="" id="couponDiscountCheckoutRow">'+
                '<td class="text-right" width="75%"><?php echo $this->lang->line('Coupon_Discount');?>:</td>'+
                '<td width="25%" id="couponDiscountCheckoutAmt">-<?=SITENAME_CURRENCY?>'+parseFloat(couponAmount).toFixed(2)+'</td>'+
              '</tr>';
    // $('#totalItemCheckoutRow').after(myHtml);
    $('#checkOutGrandTotalRow').before(myHtml);
  }
    applyRewardPoints();
}

function applyToOrder(){
    updateFullCheckoutCount();
}
function applyRewardPoints()
{
    //alert();
    $('#rewardsPointCheckoutRow').remove();
    $("#pointUsedAmount").val(0);
    $("#cc_number, #cc_type, #cc_exp_month, #cc_exp_year, #cc_cvv").prop("required", true);
    if($("#ifPointUsed").is(":checked")) {
        var grandTotal = parseFloat($('#checkOutGrandTotal').text().replace("$", "")).toFixed(2);
        var pointAmountBalance = parseFloat($('#pointAmountBalance').text()).toFixed(2);
        var pointUsed = pointAmountBalance;
        if (pointAmountBalance > grandTotal) {
            pointUsed = grandTotal;
        }
        $("#pointUsedAmount").val(parseFloat(pointUsed).toFixed(2));
        var myHtml = '<tr class="" id="rewardsPointCheckoutRow">' +
            '<td class="text-right" width="75%"><?php echo $this->lang->line('RewardsPoint');?>:</td>' +
            '<td width="25%" id="rewardsPointCheckoutAmt">-<?=SITENAME_CURRENCY?>' + parseFloat(pointUsed).toFixed(2) + '</td>' +
            '</tr>';
        $('#checkOutGrandTotalRow').before(myHtml);
        $('#checkOutGrandTotal').html('<?=SITENAME_CURRENCY?>' + parseFloat(grandTotal - pointUsed).toFixed(2));
        if(parseFloat(grandTotal - pointUsed).toFixed(2) <= 0)
        {
            $("#cc_number, #cc_type, #cc_exp_month, #cc_exp_year, #cc_cvv").removeAttr("required");
        }
    }
}
</script>
<?php
  if (!isset($cc_type) || !isset($cc_exp_month) || !isset($cc_exp_year)) {
?>
<script type="text/javascript">
  $(document).ready(function() {
    window.onload = setTimeout(function() {
      $('#cc_number').val('');
      $('#cc_cvv').val('');
    }, 500)
  })
</script>
<?php
  }
?>
<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>

Anon7 - 2022
AnonSec Team