| Server IP : 162.214.74.102 / Your IP : 216.73.216.139 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/restaurantadmin/ |
Upload File : |
<!-- Left side column. contains the logo and sidebar -->
<div class="container">
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper leftNone">
<!-- Content Header (Page header) -->
<section class="content-header address-book" style="margin-top: 50px;">
<h1>Create Order</h1>
<div class="breadcrumb topright">
<button data-toggle="control-sidebar" onclick="window.history.back();" class="btn btn-outline green btn-sm opo addressEdit opened btn-circle mcfr addcatbtn active pad2_10"><i style="font-size: 16px;" class="fa fa-arrow-left"></i> Back</button>
</div>
<?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($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 } ?>
<?php if($error_msg != '') { ?>
<div class="alert alert-danger text-center">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong><?php echo $error_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 } ?>
</section>
<!-- Main content -->
<section class="content">
<!-- tab section -->
<div class="nav-tabs-custom">
<div class="tab-content no-padding">
<div id="home" class="tab-pane fade in active">
<div class="box-body">
<!--Steps-->
<div class="col-md-12 custom-padding-0 col-sm-6 col-xs-12">
<div class="steps one">
<div> </div>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
<!-- <form>
<div class="form-group col-md-6 col-xs-12 col-sm-6 paddingleft0">
<input class="fs_input" type="text" placeholder="Order ID">
</div>
</form> -->
<div class="clearfix"></div>
<?php $validator = array('role' => 'form', 'id' => 'cartFullForm'); echo form_open('restaurantadmin/createorder', $validator); ?>
<input type="hidden" name="customer_id" id="customer_id" value="<?=set_value('customer_id');?>">
<input type="hidden" name="subtotal" id="subtotal">
<input type="hidden" name="taxAmount" id="taxAmount">
<input type="hidden" name="subtotalWithTax" id="subtotalWithTax">
<input type="hidden" name="deliveryCharge" id="deliveryCharge">
<input type="hidden" name="subtotalWithTaxWithDelCharge" id="subtotalWithTaxWithDelCharge">
<input type="hidden" name="orderType" id="orderType">
<input type="hidden" name="orderTypeValidation" id="orderTypeValidation" value="0">
<input type="hidden" name="tempCode" id="tempCode" value="<?=set_value('tempCode');?>">
<div class="col-md-6 custom-padding-0 col-sm-6 col-xs-12">
<h4>Delivery Information</h4>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 custom-padding-0">
<fieldset>
<legend class="ps_inform">Customer Info</legend>
<hr class="hr_border"></hr>
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="form-group float-label-control">
<input onkeyup="get_customer_details(this.value)" id="customer_name" class="fs_input" type="text" name="customer_name" autocomplete="off" placeholder="Enter First Name" required="" data-error="Please enter customer name" value="<?=set_value('customer_name');?>">
<div class="help-block with-errors"></div>
<div id="auto_sug" style="display:none"></div>
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="form-group float-label-control">
<input id="customer_lastname" class="fs_input" type="text" name="customer_lastname" autocomplete="off" placeholder="Enter Last Name" required="" data-error="Please enter customer Last name" value="<?=set_value('customer_lastname');?>">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="clearfix"></div>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="form-group">
<input type="email" class="fs_input" id="customer_email" name="customer_email" placeholder="Email Address" required="" data-error="Please enter a valid email address" value="<?=set_value('customer_email');?>">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-6 col-sm-6 col-xs-12">
<div class="form-group">
<input type="text" class="fs_input placeholderChangeable" id="customer_phone" 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}" name="customer_phone" placeholder="Phone Number" data-current-placeholder="Phone Number" data-focus-placeholder="(000) 000-0000" required="" data-error="Please enter phone number" data-pattern-error="Please enter valid phone number" value="<?=set_value('customer_phone');?>">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend class="ps_inform">Address</legend>
<hr class="hr_border"></hr>
<div class="form-group col-md-6 col-xs-12 col-sm-12 paddingleft0">
<input class="fs_input placeholderChangeable" type="text" placeholder="Street Address" id="customer_street" name="customer_street" data-current-placeholder="Street Address" data-focus-placeholder="Street Number and Name" required="" data-error="Please enter customer address" value="<?=set_value('customer_street');?>">
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-md-6 col-xs-12 col-sm-12 paddingright0">
<input class="fs_input" id="customer_buildtype" name="customer_buildtype" type="text" placeholder="Apt / Suite" value="<?=set_value('customer_buildtype');?>">
</div>
<div class="clearfix"></div>
<div class="form-group col-md-3 col-xs-12 col-sm-12">
<input onkeyup="findAddressByZip(this.value)" pattern="^([0-9]){5}([-])([0-9]){3}$" class="fs_input" id="customer_zip" name="customer_zip" type="text" placeholder="Postcode" data-current-placeholder="Postcode" data-focus-placeholder="000000" required="" data-error="Please enter zipcode" value="<?=set_value('customer_zip');?>">
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-md-3 col-xs-12 col-sm-12">
<!-- <select class="fs_input" id="customer_city" name="customer_city" required="">
<option value="">Select City</option>
<?php
if ($CityList && is_array($CityList)) {
foreach ($CityList as $key => $value) {
if (set_value('customer_city') && $value->city_id == set_value('customer_city')) {
$mySelect = 'selected';
}
else {
$mySelect = '';
}
?>
<option value="<?=$value->city_id?>" <?=$mySelect?>><?=$value->cityname?></option>
<?php
}
}
?>
</select> -->
<input class="fs_input generatedCity" id="customer_city" name="customer_city" type="text" placeholder="City (Fill out Zipcode first)" required="" value="<?=set_value('customer_city');?>" readonly>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-md-3 col-xs-12 col-sm-12">
<!-- <select class="fs_input" id="customer_state" name="customer_state">
<?php
if ($StateList && is_array($StateList)) {
foreach ($StateList as $key => $value) {
if (set_value('customer_state') && $value->state_id == set_value('customer_state')) {
$mySelect = 'selected';
}
else {
$mySelect = '';
}
?>
<option value="<?=$value->state_id?>" <?=$mySelect?>><?=$value->statename?></option>
<?php
}
}
?>
</select> -->
<input class="fs_input generatedState" id="customer_state" name="customer_state" type="text" placeholder="State (Fill out Zipcode first)" required="" value="<?=set_value('customer_state');?>" readonly>
<div class="help-block with-errors"></div>
</div>
<div class="form-group col-md-3 col-xs-12 col-sm-12">
<button type="button" class="btn btn-info btn-lg active text-center" onclick="checkDeliveryArea()">Check Delivery</button>
</div>
<div class="form-group col-md-12 col-xs-12 col-sm-12 custom-padding-0">
<textarea class="fs_input placeholderChangeable" placeholder="Notes" data-current-placeholder="Notes" data-focus-placeholder="Callbox Number, Door Instructions etc." name="instructions"><?=set_value('instructions');?></textarea>
</div>
</fieldset>
<div class="col-md-12 custom-padding-0 col-sm-12 col-xs-12">
<h4 style="float:left;">Menu Information</h4>
<button class="btn btn-info green btn-outline btn-circle pull-right mcbottom" type="button" data-toggle="modal" data-target="#cartDetails">View Cart</button>
</div>
<div class="col-md-12 col-xs-12 col-sm-12 custom-padding-0 mannualEntry">
<div class="form-group col-md-8 col-xs-12 col-sm-12 paddingleft0">
<select onchange="fetchMenuByCategory(this.value)" class="fs_input">
<option value="">Select Menu Category</option>
<?php
if (isset($CategoryList) && is_array($CategoryList)) {
foreach ($CategoryList as $key => $value) {
?>
<option value="<?=$value->maincateid?>"><?=$value->maincatename?></option>
<?php
}
}
?>
</select>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-md-12 col-xs-12 col-sm-12 custom-padding-0 commonHide">
<div class="col-md-8 item-listbox alert-success">
<label>Choose category to get item list</label>
</div>
</div>
<div class="col-md-12 col-xs-12 col-sm-12 custom-padding-0 commonHide" id="pleaseWait" style="display: none;">
<div class="col-md-6 item-listbox">
<label>Please wait...</label>
</div>
</div>
<div class="col-md-12 col-xs-12 col-sm-12 custom-padding-0 commonHide" id="noItemFound" style="display: none;">
<div class="col-md-6 item-listbox alert-danger">
<label>No item found</label>
</div>
</div>
<div id="menuListWrap" class="commonHide" style="display: none;">
<!-- menu list will appear here -->
</div>
<div class="row">
<div class="col-md-12 col-xs-12 col-sm-12 custom-padding-0 cartSection">
<div class="col-md-2 text-left">
<p><strong>Sub Total</strong></p>
</div>
<div class="col-md-10 text-left"><i class="fa fa-usd"></i><span id="cartSubtotal"> 0.00</span></div>
</div>
</div>
<div class="col-md-8 col-xs-12 col-sm-12 paddingleft0">
<h5><b>Apply Discount</b></h5>
<div class="form-group col-md-7 col-xs-12 col-sm-12 custom-padding-0">
<label><input type="radio" name="discountOption" id="discountFix" value="fix" class="minimal discountOption" checked/> Amount</label> <br/>
<label><input type="radio" name="discountOption" id="discountPer" value="per" class="minimal discountOption"/> Percentage</label>
</div>
<div class="form-group col-md-5 col-xs-12 col-sm-12 custom-padding-0">
<input class="fs_input" name="cart_discount" id="cart_discount" type="text" placeholder="Discount" value="0.00" onkeypress="return isDecimal(event)" onkeyup="return checkAmount(event, this)" onblur="return checkAmount(event, this)">
</div>
</div>
<div class="row">
<div class="col-md-12 col-xs-12 col-sm-12 custom-padding-0 cartSection">
<div class="col-md-2 text-left">
<p><strong>Grand Total</strong></p>
</div>
<div class="col-md-10 text-left"><i class="fa fa-usd"></i><span id="cartGrandtotal"> 0.00</span></div>
</div>
</div>
<!-- <div class="col-md-6 col-xs-12 col-sm-12 custom-padding-0">
<h5><b>Apply Tax</b></h5>
<label><input type="checkbox" name="applytaxCharges[]" class="minimal itemOption" value="5" checked/> Service Tax</label>
<label><input type="checkbox" name="applytaxCharges[]" class="minimal itemOption" value="6"/> Additional Tax</label>
<label><input type="checkbox" name="applytaxCharges[]" class="minimal itemOption" value="6"/> VAT</label>
<div class="clearfix"></div>
<div class="col-md-6 text-left custom-padding-0" style="margin-top:10px;">
<p><strong>Grand Total</strong></p>
</div>
<div class="col-md-6 text-left custom-padding-0" style="margin-top:10px;"><i class="fa fa-usd"> <strong>160.75</strong></i></div>
</div> -->
</div>
<div class="clearfix"></div>
<!-- payment section -->
<div class="col-md-8 col-xs-12 col-sm-12 paddingleft0">
<div class="checkBg mctop30">
<h4 class="ckh" style="margin-bottom: 0px;">Payment Details</h4>
<button class="btn btn-info green btn-outline btn-circle mcbottom mcTop12 commonActive active" type="button" id="cod" style="display: none;">Cash On Delivery</button>
<button class="btn btn-info green btn-outline btn-circle mcbottom mcTop12 commonActive" type="button" id="pbc" style="display: none;">Pay By Card</button>
<input type="hidden" name="paymentOption" id="paymentOption" value="cc">
<div class="clearfix"></div>
<div class="row editSection" style="display: block;">
<div class="col-md-8 col-sm-8 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" placeholder="Card Number" type="text" required="" value="<?=set_value('cc_number');?>">
<span class="input-group-addon" id="basic-addon1"><i class="fa fa-cc"></i></span>
</div>
</div>
<div class="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="">Card Type</option>
<option value="Visa" <?=set_value('cc_type') == 'Visa'? 'selected' : '' ?>>Visa</option>
<option value="MasterCard" <?=set_value('cc_type') == 'MasterCard'? 'selected' : '' ?>>Master Card</option>
<option value="Discover" <?=set_value('cc_type') == 'Discover'? 'selected' : '' ?>>Discover</option>
<option value="Amex" <?=set_value('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="">Expiration Month</option>
<option value="01" <?=set_value('cc_exp_month') == '01'? 'selected' : '' ?>>Jan</option>
<option value="02" <?=set_value('cc_exp_month') == '02'? 'selected' : '' ?>>Feb</option>
<option value="03" <?=set_value('cc_exp_month') == '03'? 'selected' : '' ?>>Mar</option>
<option value="04" <?=set_value('cc_exp_month') == '04'? 'selected' : '' ?>>Apr</option>
<option value="05" <?=set_value('cc_exp_month') == '05'? 'selected' : '' ?>>May</option>
<option value="06" <?=set_value('cc_exp_month') == '06'? 'selected' : '' ?>>Jun</option>
<option value="07" <?=set_value('cc_exp_month') == '07'? 'selected' : '' ?>>Jul</option>
<option value="08" <?=set_value('cc_exp_month') == '08'? 'selected' : '' ?>>Aug</option>
<option value="09" <?=set_value('cc_exp_month') == '09'? 'selected' : '' ?>>Sep</option>
<option value="10" <?=set_value('cc_exp_month') == '10'? 'selected' : '' ?>>Oct</option>
<option value="11" <?=set_value('cc_exp_month') == '11'? 'selected' : '' ?>>Nov</option>
<option value="12" <?=set_value('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 (set_value('cc_exp_year') == $i) {
$selected = 'selected';
}
else {
$selected = '';
}
?>
<option value="<?=$i?>" <?=$selected?>><?=$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');?>">
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- payment section -->
<div class="clearfix"></div>
<center><button class="btn btn-info btn-lg active text-center" style="text-align: center;margin-top: 20px;" type="submit" >Proceed</button></center>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ./tab section -->
<div class="clearfix"></div>
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<div class="clearfix"></div>
</div><!-- ./wrapper -->
<!-- Menu Details Modal -->
<div id="menuDetails" class="modal fade" role="dialog">
<?php $parameters = array('name' => 'addOrderForm', 'id' => 'addOrderForm'); echo form_open('', $parameters); ?>
<span id="menuDetailsWrap"></span>
</form>
</div>
<!-- Menu Details Modal -->
<!-- Cart Modal -->
<div id="cartDetails" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header" style="">
<button type="button" class="close" data-dismiss="modal"></button>
<h4 class="modal-title text-center">Your cart</h4>
</div>
<div class="modal-body">
<div class="col-md-12 custom-padding-0 price-body">
<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>
<!-- <div class="table-responsive">
<table class="table table-hover table-bordered" id="add-cart">
<tbody>
<tr class="text-center">
<td><i class="fa fa-minus-square-o" style="cursor:pointer" aria-hidden="true"></i> 3 <i class="fa fa-plus-square-o" style="cursor:pointer" aria-hidden="true"></i></td>
<td>$ 60.00</td>
<td>Cheese Sandwich</td>
<td><img src="<?=base_url();?>assets/img/cancel.png" style="cursor:pointer"></td>
</tr>
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-hover table-bordered" id="">
<tbody>
<tr class="" colspan="4">
<td class="text-right">Total Item:</td>
<td>$ 100.00</td>
</tr>
<tr class="">
<td class="text-right">Tax(7.10 %):</td>
<td>$ 4.26</td>
</tr>
</tbody>
<tbody id="delivery-charge1">
<tr style="font-weight:600;">
<td class="text-right">Subtotal:</td>
<td>$ 104.26</td>
</tr>
<tr style="color: rgb(11, 80, 158);">
<td class="text-right">Delivery Charge:</td>
<td>$ 4.00</td>
</tr>
</tbody>
<tbody>
<tr style="font-weight:600;">
<td class="text-right">Total:</td>
<td>$ 108.26</td>
</tr>
</tbody>
</table>
</div> -->
</span>
<div class="table-responsive" style="display:none;">
<table class="table table-hover table-bordered" id="">
<tbody>
<tr class="">
<td><input name="1" class="raco" type="radio"> Pickup <img src="<?=base_url();?>assets/img/front-end/briefcase.png"></td>
<td><input name="1" class="raco" type="radio"> Delivery <img src="<?=base_url();?>assets/img/front-end/bicycle.png"></td>
<td><input name="1" class="raco" type="radio"> Dine In <img src="<?=base_url();?>assets/img/front-end/restaurant-cutlery-symbol-of-a-cross.png"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Cart Modal -->
<script type="text/javascript">
$(function() {
setTimeout(function() {
$('#cc_number').val('');
$('#cc_cvv').val('');
},1000);
$(".placeholderChangeable").focus(function(){
$(this).attr("placeholder", $(this).attr('data-focus-placeholder'));
});
$(".placeholderChangeable").blur(function(){
$(this).attr("placeholder", $(this).attr('data-current-placeholder'));
});
$("#cod").click(function(){
$('.commonActive').removeClass('active');
$(this).addClass('active');
$(".editSection").hide();
$("#paymentOption").val('cod');
$('.cardClass').attr('required', false);
$('#cartFullForm').validator('update');
});
$("#pbc").click(function(){
$('.commonActive').removeClass('active');
$(this).addClass('active');
$(".editSection").show();
$("#paymentOption").val('cc');
$('.cardClass').attr('required', true);
$('#cartFullForm').validator('update');
});
base_url='<?php echo base_url(); ?>';
url= base_url+'createorder/updateCartView';
$.ajax({
url: url,
type: 'POST',
data: {csrf_token_apm: myCsrfHash},
success: function(data) {
obj = JSON.parse(data);
$('#cartDetailsWrap').html(obj['myHtml']);
$('#cartSubtotal').html(obj['subtotal']);
$('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
}
})
$('#cartFullForm').validator().on('submit', function (e) {
if (e.isDefaultPrevented()) {
// handle the invalid form...
} else {
var cartSubtotal = parseFloat($('#cartSubtotal').html());
var orderType = $('#orderType').val();
if (cartSubtotal == 0.00) {
$('#cartDetails').modal('show');
return false;
}
else if (orderType == '') {
swal('', 'Please choose order receive medthod.', 'warning');
swal({
title: '',
text: 'Please choose order receive medthod.',
type: 'warning',
confirmButtonText: "Ok",
closeOnConfirm: true
},
function(){
$('#cartDetails').modal('show');
});
return false;
}
else if (orderType == '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+'createorder/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']) {
// swal('', 'Delivery available! Delivery charge is: <?=SITENAME_CURRENCY?>'+myData['deliveryCharge'], 'success');
$('#orderTypeValidation').val('1');
// updateCartView();
$('#cartFullForm').submit();
}
else {
swal('', '<?php echo $this->lang->line('Delivery_available');?>', 'error');
$('#orderTypeValidation').val('0');
}
}
})
}
else {
return true;
}
}
})
$(document).click(function() {
document.getElementById("auto_sug").style.display="none";
})
})
function get_customer_details(strnm){
base_url='<?php echo base_url(); ?>';
url= base_url+'createorder/search_customer';
$.ajax({
type: "POST",
url: url,
data: {usersearchkey: strnm, csrf_token_apm: myCsrfHash},
success: function(data) {
if (data!="") {
document.getElementById("auto_sug").style.display="block";
document.getElementById("auto_sug").innerHTML=data;
}
else {
document.getElementById("auto_sug").innerHTML="";
document.getElementById("auto_sug").style.display="none";
}
}
});
}
function setCustDetails(customer_id, customer_name, customer_lastname, customer_street, customer_zip, customer_phone, customer_email, cc_type, cc_number, cc_exp_month, cc_exp_year, cc_cvv, tempCode) {
$('#auto_sug').fadeOut();
if (cc_exp_month.length == 1) {
cc_exp_month = 0 +''+ cc_exp_month;
}
document.getElementById('customer_id').value = customer_id;
document.getElementById('customer_name').value = customer_name;
document.getElementById('customer_lastname').value = customer_lastname;
document.getElementById('customer_street').value = customer_street;
document.getElementById('customer_zip').value = customer_zip;
findAddressByZip(customer_zip);
document.getElementById('customer_phone').value = customer_phone;
document.getElementById('customer_email').value = customer_email;
document.getElementById('cc_type').value = cc_type;
document.getElementById('cc_number').value = cc_number;
document.getElementById('cc_exp_month').value = cc_exp_month;
document.getElementById('cc_exp_year').value = cc_exp_year;
document.getElementById('tempCode').value = tempCode;
if (cc_cvv != 0 && cc_cvv != '') {
document.getElementById('cc_cvv').value = cc_cvv;
}
setTimeout(function() {
checkDeliveryArea();
}, 2000);
$('#cartFullForm').validator('update');
}
function checkDeliveryArea() {
var customer_street = $('#customer_street').val();
var customer_zip = $('#customer_zip').val();
var customer_city = $('#customer_city').val();
var customer_state = $('#customer_state').val();
if (customer_street === '' || customer_zip === '') {
swal('', 'Plesae fill up Street address and Postcode first.', 'warning');
return false;
}
$('#myLoader').show();
base_url='<?php echo base_url(); ?>';
url= base_url+'createorder/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']) {
swal('', 'Delivery available! Delivery charge is: <?=SITENAME_CURRENCY?>'+myData['deliveryCharge'], 'success');
}
else {
swal('', '<?php echo $this->lang->line('Delivery_available');?>', 'error');
}
updateCartView();
}
})
}
function updateCartView() {
url='<?php echo base_url(); ?>createorder/updateCartView';
$('#myLoader').show();
$.ajax({
url: url,
type: 'POST',
data: {csrf_token_apm: myCsrfHash},
success: function(data) {
obj = JSON.parse(data);
$('#cartDetailsWrap').html(obj['myHtml']);
$('#cartSubtotal').html(obj['subtotal']);
$('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
updateDiscount();
$('#myLoader').hide();
}
})
}
function fetchMenuByCategory(menu_category) {
$('.commonHide').hide();
$('#pleaseWait').fadeIn();
base_url='<?php echo base_url(); ?>';
url= base_url+'createorder/MenuByCategory';
$.ajax({
url: url,
type: 'POST',
data: {menu_category: menu_category, csrf_token_apm: myCsrfHash},
success: function(data) {
var myData = JSON.parse(data);
var myHtml = '';
if (myData.length != 0 && myData != false) {
$.each(myData, function(key, value) {
myHtml += '<div class="col-md-12 col-xs-12 col-sm-12 custom-padding-0">'+
'<div class="col-md-6 item-listbox">'+
'<label>'+$.trim(value['menu_name'])+'</label>'+
'<div class="ftrt">'+
'<span>$'+$.trim(value['menu_price'])+'</span>'+
'<span style="cursor: pointer;" onclick="showDetails('+$.trim(value['id'])+')"><i class="fa fa-plus-square-o" aria-hidden="true"></i></span>'+
'</div>'+
'</div>'+
'</div>';
})
$('.commonHide').hide();
$('#menuListWrap').html(myHtml);
$('#menuListWrap').fadeIn();
}
else {
$('.commonHide').hide();
$('#noItemFound').fadeIn();
}
//console.log(data);
}
})
}
function showDetails(my_id) {
if (my_id === undefined) {
my_id = 0;
}
url='<?php echo base_url(); ?>createorder/showItemDetails';
$.ajax({
url: url,
type: 'POST',
data: {id: my_id, csrf_token_apm: myCsrfHash},
success: function(data) {
$("#menuDetailsWrap").html(data);
$("#menuDetails").modal("show");
},
error: function(data) {
console.log(data);
}
})
}
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(); ?>createorder/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']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
updateDiscount();
$('#cartLoader').hide();
}
})
$("#menuDetails").modal("hide");
}
function editOrder(rowid, menu_id) {
$('#cartDetails').modal("hide");
$('#myLoader').show();
url='<?php echo base_url(); ?>createorder/showEditItemDetails';
$.ajax({
url: url,
type: 'POST',
data: {rowid: rowid, id: menu_id, csrf_token_apm: myCsrfHash},
success: function(data) {
$('#myLoader').hide();
$("#menuDetailsWrap").html(data);
$('#menuDetails').modal("show");
},
error: function(data) {
$('#myLoader').hide();
console.log(data);
}
})
}
function deleteFromCart(rowid) {
//$('#row_'+rowid).fadeOut();
url='<?php echo base_url(); ?>createorder/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']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
updateDiscount();
$('#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(); ?>createorder/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']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
updateDiscount();
}
})
}
function checkAmount(evt, myThis) {
if (parseInt($(myThis).val()) > 100) {
$(myThis).val(100)
}
updateDiscount();
}
$(function() {
$('#discountFix').on('ifChanged', function() {
updateDiscount();
});
$('#discountPer').on('ifChanged', function() {
updateDiscount();
});
})
function updateDiscount() {
var subtotalWithTaxWithDelCharge = $('#subtotalWithTaxWithDelCharge').val();
var subtotal = $('#subtotal').val();
var cart_discount = $('#cart_discount').val();
var newGrandTotal = subtotalWithTaxWithDelCharge;
var calcDiscount = 0.00;
if ($('#discountFix').is(':checked')) {
if (cart_discount != '') {
newGrandTotal = newGrandTotal - cart_discount;
calcDiscount = cart_discount;
}
}
else if($('#discountPer').is(':checked')) {
if (cart_discount != '') {
newGrandTotal = newGrandTotal - (subtotal * (cart_discount / 100));
calcDiscount = subtotal * (cart_discount / 100);
}
}
if (newGrandTotal > 0) {
newGrandTotal = parseFloat(newGrandTotal).toFixed(2);
$('#cartGrandtotal').html('$'+newGrandTotal);
$('#cartPopTotal').html('$'+newGrandTotal);
}
if (calcDiscount != 0.00) {
console.log(calcDiscount);
var myHtml = "<tr class='' id='popDiscountRow'>"+
"<td class='text-right' width='75%''>Discount:</td>"+
"<td width='20%''>-$"+parseFloat(calcDiscount).toFixed(2)+"</td>"+
"</tr>";
$('#popDiscountRow').remove();
$('#popGrandTotalRow').prepend(myHtml);
}
}
function changeOrderType(myThis) {
$('#myLoader').show();
$('#orderType').val($(myThis).attr('data-type'));
url='<?php echo base_url(); ?>createorder/changeOrderType';
$.ajax({
url: url,
type: 'POST',
data: {orderType: $(myThis).attr('data-type'), csrf_token_apm: myCsrfHash},
success: function(data) {
obj = JSON.parse(data);
$('#cartDetailsWrap').html(obj['myHtml']);
$('#cartSubtotal').html(obj['subtotal']);
$('#cartGrandtotal').html(obj['subtotalWithTaxWithDelCharge']);
$('#subtotal').val(obj['subtotal']);
$('#taxAmount').val(obj['taxAmount']);
$('#subtotalWithTax').val(obj['subtotalWithTax']);
$('#deliveryCharge').val(obj['deliveryCharge']);
$('#subtotalWithTaxWithDelCharge').val(obj['subtotalWithTaxWithDelCharge']);
$('#myLoader').hide();
},
error: function(data) {
$('#myLoader').hide();
console.log(data);
}
})
}
</script>
<style type="text/css">
.suggestionlist{
background-color:#F9F7F7;
height:auto;
padding:5px;
}
.suggestionlist:hover{
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#e2e2e2+0,dbdbdb+5,dbdbdb+16,fefefe+100 */
background: #e2e2e2;
border-radius: 3px;
background: #e2e2e2;
cursor:pointer;
}
#auto_sug{
position:absolute;
z-index:2;
margin-top:0px;
width:300px;
height: auto;
max-height: 300px !important;
box-shadow: 2px 1px 2px #CCCCCC;
border: 1px solid #DDDBDB;
overflow-y: scroll;
}
#auto_sug::-webkit-scrollbar
{
width: 8px; /* for vertical scrollbars */
}
#auto_sug::-webkit-scrollbar-track
{
background: rgba(226, 226, 226, 1);
}
#auto_sug::-webkit-scrollbar-thumb
{
background: rgba(44, 134, 189, 1);
}
.formErrorContent{
color: #ee0101;
font-size: 16px;
min-width: 160px;
padding: 0 2px;
position: relative;
width: 100%;
}
.item-listbox{
background: #31B0D5;
padding: 12px;
color: white;
border-radius: 4px;
margin-bottom: 15px;
display: block;
}
.item-listbox * {
vertical-align: middle;
}
.item-listbox label {
margin-bottom: 0px;
}
.item-listbox span{
margin-right: 20px;
}
.ftrt{
float: right;
}
.value-box {
padding: 5px;
border-bottom: 1px solid rgba(0, 0, 0, 0.19);
}
.areatext {
border: 1px solid rgba(0, 0, 0, 0.34);
width: 100%;
height: 78px;
}
.close{text-indent: 1px;}
.cartItemAddon {
font-size: 12px;
}
#cartSubtotal, #cartGrandtotal {
margin-left: 5px;
}
</style>