update add order
This commit is contained in:
@@ -123,8 +123,10 @@ $(function() {
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
|
||||
fa_plus = '';
|
||||
add = '';
|
||||
menu_item_box = 'set_item_box';
|
||||
menu_item_box = 'add_icon';
|
||||
data_target = 'sx_item_set_detailModal';
|
||||
data_modal = 'modal'
|
||||
add_icon = "set_item_box"
|
||||
code = menu_items[field].code;
|
||||
name = menu_items[field].name;
|
||||
instances = menu_items[field].instances;
|
||||
@@ -144,6 +146,8 @@ $(function() {
|
||||
add = 'add'
|
||||
menu_item_box = 'menu_item_box';
|
||||
data_target = 'sx_item_detailModal';
|
||||
data_modal = ''
|
||||
add_icon = "add_icon"
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default === true) {
|
||||
@@ -164,11 +168,11 @@ $(function() {
|
||||
}else{
|
||||
image_path = "/image/logo.png";
|
||||
}
|
||||
if (menu_item_box == "set_item_box") {
|
||||
add_icon = "set_item_box"
|
||||
}else{
|
||||
add_icon = "add_icon"
|
||||
}
|
||||
// if (menu_item_box == "set_item_box") {
|
||||
|
||||
// }else{
|
||||
|
||||
// }
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight" style="">'
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;">'
|
||||
@@ -190,7 +194,10 @@ $(function() {
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"' >"
|
||||
+ options +"' data-image='"+image_path+"' data-toggle='"
|
||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
|
||||
+"<div class='card-block custom-card-block'>"
|
||||
+"<img id='logo' height='125px' src='"+image_path+"'>"
|
||||
@@ -218,10 +225,12 @@ $(function() {
|
||||
$('.set_change_qty').val(1);
|
||||
change_qty_plus_minus("set_count","set_plus","set_minus");
|
||||
data = $(this).parent().children().children('.add_icon');
|
||||
|
||||
instances = $(this).data('instance');
|
||||
// data = $(this).parent().siblings('.add_icon');
|
||||
//instances = $(this).data('instance');
|
||||
item_sets = $(this).data('item-sets');
|
||||
|
||||
instances = $(this).data('instances');
|
||||
// item_sets = $(data).attr('data-item-sets');
|
||||
console.log(instances)
|
||||
for(var field in item_sets) {
|
||||
|
||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||
@@ -274,11 +283,11 @@ $(function() {
|
||||
|
||||
$('#set_change_qty').val(1);
|
||||
$('#set_item_instances').text(instances);
|
||||
$('#set_name').text(data.attr('data-name'));
|
||||
$('#set_item_code').text(data.attr('data-item-code'));
|
||||
$('#set_total_price').text(data.attr('data-price'));
|
||||
$('#set_name').text($(this).attr('data-name'));
|
||||
$('#set_item_code').text($(this).attr('data-item-code'));
|
||||
$('#set_total_price').text($(this).attr('data-price'));
|
||||
// $('#set_total_price').text(0);
|
||||
$('#set_unit_price').text(data.attr('data-price'));
|
||||
$('#set_unit_price').text($(this).attr('data-price'));
|
||||
// $('#set_unit_price').text(0);
|
||||
});
|
||||
// click instance for add item set
|
||||
@@ -735,7 +744,7 @@ $(function() {
|
||||
if (type == 'true') {
|
||||
type = 'cashier'
|
||||
|
||||
var table_type = $('#table_id').find("option:selected").data('type');
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').val();
|
||||
var customer_id = $('#customer_id').val();
|
||||
var booking_id = $('#booking_id').text();
|
||||
@@ -762,21 +771,28 @@ $(function() {
|
||||
'customer_id': customer_id, 'guest_info': "",
|
||||
'table_id': table_id,
|
||||
'order_items': order_items };
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
if (table_id.length>0) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajax_url,
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$(this).removeAttr('disabled', '');
|
||||
$("#oqs_loading_wrapper").hide();
|
||||
|
||||
swal("Opps","Please Select Table or Room","warning");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user