fixed confilt
This commit is contained in:
@@ -62,14 +62,14 @@ $(function() {
|
||||
|
||||
+'</div>'
|
||||
|
||||
+"<div class='add_icon p-t-65 p-b-65' data-item-code='"
|
||||
+"<div class='add_icon product_item p-t-65 p-b-65' data-item-code='"
|
||||
+ product[field].item_code +"' data-name='"
|
||||
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
|
||||
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instances = '"
|
||||
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ JSON.stringify(options) +"' data-opt = '"
|
||||
+ JSON.stringify(options) +"' data-image='"+image_path+"'>"
|
||||
+ JSON.stringify(options) +"' data-id = '"+ JSON.stringify(item_attributes) +"' data-opt = '"
|
||||
+ JSON.stringify(options) +"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer custom-flex-footer">'
|
||||
+'<span style="font-weight:900;flex-grow:1;">'+ product[field].unit_price +'</span>'
|
||||
@@ -93,21 +93,21 @@ $(function() {
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3 mt-1">'
|
||||
+'<div class="card custom-card testimonial-card fadeInRight" style="height:100%;">'
|
||||
+'<div class="custom-card-head custom-card-no-img-head card-head row" style="margin:0px;display:flex;!important">'
|
||||
+"<div class='col-12 add_icon p-t-65 p-b-65' data-item-code='"
|
||||
+"<div class='col-12 add_icon product_item p-t-65 p-b-65' data-item-code='"
|
||||
+ product[field].item_code +"' data-name='"
|
||||
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
|
||||
+ product[field].name +"' data-promotion-price = '"+ 1 +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-id = '"+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ JSON.stringify(options) +"' data-opt = '"
|
||||
+ JSON.stringify(options) +"' data-image=''>"
|
||||
+ JSON.stringify(options) +"' data-image='' data-toggle='modal' data-target='.sx_item_detailModal'>"
|
||||
+'<div class="product_box">'+ product[field].name +'</div>'
|
||||
+'</div>'
|
||||
|
||||
|
||||
+'</div>'
|
||||
|
||||
+"<div class='add_icon' data-item-code='"
|
||||
+"<div class='add_icon' product_item data-item-code='"
|
||||
+ product[field].item_code +"' data-name='"
|
||||
+ product[field].name +"' data-qty = '"+ qty +"' data-price = '"
|
||||
+ product[field].unit_price +"' data-instance-code = '"+ product[field].item_code +"' data-instance = '"
|
||||
@@ -231,12 +231,12 @@ $(function() {
|
||||
instances = $(this).data('instances');
|
||||
item_options = $(this).data('options');
|
||||
|
||||
|
||||
for(var field in item_sets) {
|
||||
|
||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||
|
||||
value = item_sets[field]["instances"];
|
||||
|
||||
$(value).each(function(i){
|
||||
menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
@@ -247,10 +247,19 @@ $(function() {
|
||||
for(var iii in items) {
|
||||
var result = items[iii]["instances"];
|
||||
for(var v in result) {
|
||||
|
||||
if (value[i]["id"] == result[v]["id"]) {
|
||||
if (result[v].out_of_stock) {
|
||||
price_tag = '<span class="text-danger">out of stock</span>'
|
||||
pointer_event = 'none'
|
||||
opacity = '0.5'
|
||||
}
|
||||
else {
|
||||
price_tag = '<span>'+result[v]["price"]+'</span>'
|
||||
pointer_event = 'cursor'
|
||||
opacity = ''
|
||||
}
|
||||
|
||||
row = '<div class="col-md-4 " >'
|
||||
row = '<div class="col-md-4 " style="pointer-events: '+pointer_event+'; opacity: '+opacity+'">'
|
||||
+"<div class='card custom-card instance_box' data-name='"+result[v]["name"]
|
||||
+"' data-code='"+result[v]["code"]
|
||||
+"' data-price='"+result[v]["price"]
|
||||
@@ -269,7 +278,7 @@ $(function() {
|
||||
+' <small style="float:" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer">'
|
||||
+' <span>'+result[v]["price"]+'</span>'
|
||||
+price_tag
|
||||
// +' <small style="float:right" id="instance_option"></small>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
@@ -362,6 +371,7 @@ $(function() {
|
||||
rowCount = $('.selected-instance');
|
||||
setCount = $('.selected-set');
|
||||
item_options = $(this).data('option');
|
||||
console.log(item_options);
|
||||
|
||||
min_qty = $(this).data('min-qty');
|
||||
max_qty = $(this).data('max-qty');
|
||||
@@ -374,7 +384,7 @@ $(function() {
|
||||
type = item_options[field]["type"];
|
||||
row = "<p style='font-size:16px;margin-bottom:3px'>"+type+"</p>"
|
||||
$(value).each(function(i){
|
||||
row +="<button class='btn btn-default btn-sm check_option_btn"+ type +"' data-type='"
|
||||
row +="<button class='btn btn-default btn-sm check_option_btn "+ type +"' data-type='"
|
||||
+type+"' data-value='"+value[i]+"' data-code='"+code+"' data-group='set_menu'>"
|
||||
+value[i]+"</button>";
|
||||
});
|
||||
@@ -540,6 +550,90 @@ $(function() {
|
||||
|
||||
//click item row for add order
|
||||
$(document).on('click', '.menu_item_box', function(event){
|
||||
attributes = $(this).data('id');
|
||||
selected_item = $(this).data('item');
|
||||
instances = $(this).data('instance');
|
||||
item_options = $(this).data('option');
|
||||
data = $(this).parent().siblings('.add_icon');
|
||||
|
||||
show_attribute_selection_modal(attributes, selected_item, instances, item_options, data)
|
||||
|
||||
});
|
||||
|
||||
// click plus icon for add
|
||||
$(document).on('click', '.add_icon', function(event){
|
||||
|
||||
if($(this).hasClass('product_item')) {
|
||||
$('.sx_item_detailModal').modal('hide');
|
||||
|
||||
var item_data = $(this);
|
||||
code = $(this).data('instance-code');
|
||||
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
}
|
||||
show_item_detail(item_data,"add_icon");
|
||||
calculate_sub_total();
|
||||
autoScrollToItem(code)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if ($(this).data('instances').length == 1) {
|
||||
|
||||
$('.sx_item_detailModal').modal('hide');
|
||||
|
||||
if ($(this).data('instances')[0].out_of_stock == false ) {
|
||||
var item_data = $(this);
|
||||
code = $(this).data('instance-code');
|
||||
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
}
|
||||
show_item_detail(item_data,"add_icon");
|
||||
calculate_sub_total();
|
||||
autoScrollToItem(code)
|
||||
|
||||
}
|
||||
return
|
||||
|
||||
} else {
|
||||
count = 0
|
||||
for (var i in $(this).data('instances')) {
|
||||
if(!$(this).data('instances')[i].out_of_stock) {
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (count === 1) {
|
||||
$('.sx_item_detailModal').modal('hide');
|
||||
|
||||
var item_data = $(this);
|
||||
code = $(this).data('instance-code');
|
||||
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
}
|
||||
show_item_detail(item_data,"add_icon");
|
||||
calculate_sub_total();
|
||||
autoScrollToItem(code)
|
||||
return
|
||||
}
|
||||
|
||||
attributes = $(this).data('id');
|
||||
selected_item = $(this).data('attributes');
|
||||
instances = $(this).data('instances');
|
||||
item_options = $(this).data('options');
|
||||
data = $(this)
|
||||
|
||||
show_attribute_selection_modal(attributes, selected_item, instances, item_options, data)
|
||||
}
|
||||
}); //End Add Icon Click
|
||||
|
||||
function show_attribute_selection_modal(attributes, selected_item, instances, item_options, data) {
|
||||
$('.attributes-list').empty();
|
||||
$('.options-list').empty();
|
||||
$('#modal_box_img').empty();
|
||||
@@ -553,19 +647,16 @@ $(function() {
|
||||
$('.add_to_order').removeAttr('data-name');
|
||||
$('.add_to_order').removeAttr('data-attributes');
|
||||
$('.add_to_order').removeAttr('data-options');
|
||||
$('.add_to_order').removeAttr('disabled');
|
||||
$('#minus').removeAttr('disabled');
|
||||
$('#plus').removeAttr('disabled');
|
||||
$('#count').removeAttr('readonly');
|
||||
$('#wanring_text').text('');
|
||||
$('#total_price').text(0.0);
|
||||
|
||||
$('#count').val(1);
|
||||
$('#count').val(1);
|
||||
change_qty_plus_minus("count","plus","minus");
|
||||
|
||||
// data = $(this).parent().children().children('.add_icon');
|
||||
data = $(this).parent().siblings('.add_icon');
|
||||
|
||||
$('#total_price').text(data.attr('data-price'));
|
||||
attributes = $(this).data('id');
|
||||
selected_item = $(this).data('item');
|
||||
instances = $(this).data('instance');
|
||||
item_options = $(this).data('option');
|
||||
|
||||
if (data.attr('data-image')) {
|
||||
if (modify_order) {
|
||||
image = "<img id='' width='200px' src='../../"+data.attr('data-image')+"'>";
|
||||
@@ -585,37 +676,39 @@ $(function() {
|
||||
$('#modal_box_img').append(image);
|
||||
|
||||
instance_attributes = []
|
||||
oos_values = ''
|
||||
total_price = 0
|
||||
|
||||
for(var field in instances) {
|
||||
if (instances[field].out_of_stock) {
|
||||
oos_values = instances[field].values;
|
||||
$('#add_to_order').attr('disabled', true);
|
||||
$('#minus').attr('disabled', true);
|
||||
$('#plus').attr('disabled', true);
|
||||
$('#count').attr('readonly', true)
|
||||
} else {
|
||||
$('.add_to_order').removeAttr('disabled');
|
||||
$('#minus').removeAttr('disabled');
|
||||
$('#plus').removeAttr('disabled');
|
||||
$('#count').removeAttr('readonly');
|
||||
}
|
||||
|
||||
value = instances[field].values;
|
||||
$(value).each(function(i){
|
||||
options = value[i];
|
||||
instance_attributes.push(options);
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: '../../api/restaurant/menu_item_attributes/'+value[i],
|
||||
// data: {id:value[i]},
|
||||
// success:function(result){
|
||||
|
||||
// options = result["name"];
|
||||
// instance_attributes.push(options);
|
||||
// }
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
// selected_arr = []
|
||||
// $(selected_item).each(function(i){
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: '../../api/restaurant/menu_item_attributes/'+selected_item[i],
|
||||
// data: {id:selected_item[i]},
|
||||
// success:function(result){
|
||||
// name = result["name"];
|
||||
// selected_arr.push(name);
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
selected_item = selected_item.sort()
|
||||
|
||||
if(oos_values) {
|
||||
oos_values = oos_values.sort()
|
||||
}
|
||||
|
||||
if (attributes.length === 0) { // for product_box
|
||||
total_price = data.attr('data-price');
|
||||
}
|
||||
|
||||
for(var field in attributes) {
|
||||
value = attributes[field]["values"];
|
||||
@@ -625,18 +718,27 @@ $(function() {
|
||||
$(value).each(function(i){
|
||||
disabled = "false";
|
||||
status ="";
|
||||
|
||||
if(parseInt(jQuery.inArray(value[i], selected_item)) !== -1){
|
||||
status = "selected-attribute";
|
||||
if(JSON.stringify(oos_values) != JSON.stringify(selected_item)) {
|
||||
status = "selected-attribute";
|
||||
total_price = data.attr('data-price')
|
||||
}
|
||||
}
|
||||
|
||||
if(parseInt(jQuery.inArray(value[i], instance_attributes)) == -1){
|
||||
// disabled = "disabled";
|
||||
}
|
||||
|
||||
row +="<button id='selected-attribute' data-instances='"+JSON.stringify(instances)+"' data-type='"
|
||||
+type+"' data-value='"+value[i]+"' class='btn btn- waves-effect attribute_btn "
|
||||
+ status +" "+ type +" '"+ disabled +" >"
|
||||
+ status +" "+ type +" '"
|
||||
+ "data-attributes = '"+ JSON.stringify(attributes) +"'"
|
||||
+ disabled +" >"
|
||||
+value[i]
|
||||
+"</button>";
|
||||
});
|
||||
|
||||
$(".attributes-list").append(row);
|
||||
}
|
||||
|
||||
@@ -658,17 +760,21 @@ $(function() {
|
||||
$('#instance_name').text(data.attr('data-instance'));
|
||||
$('#instance_code').text(data.attr('data-instance-code'));
|
||||
$('#promotion_price').text(data.attr('data-promotion-price'));
|
||||
$('#total_price').text(data.attr('data-price'));
|
||||
$('#total_price').text(total_price);
|
||||
$('#unit_price').text(data.attr('data-price'));
|
||||
});
|
||||
}
|
||||
|
||||
// click select option icon for add
|
||||
$(document).on('click', '.attribute_btn', function(event){
|
||||
|
||||
$('.attributes-list button').removeClass('bg-gray box-shadow-none');
|
||||
|
||||
// $('.change_qty').val(1);
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
instances = $(this).data('instances');
|
||||
item_attributes = $(this).data('attributes');
|
||||
selected_values = []
|
||||
|
||||
attributes = $(".attribute_btn");
|
||||
$(attributes).each(function(i){
|
||||
@@ -678,29 +784,118 @@ $(function() {
|
||||
});
|
||||
$(this).addClass('selected-attribute');
|
||||
|
||||
// if ($(".attribute_btn").attr("data-type")==type){
|
||||
// $('.'+type).removeClass("selected-attribute");
|
||||
// }
|
||||
// $(this).addClass('selected-attribute');
|
||||
$('button.selected-attribute').each(function(i) {
|
||||
selected_values.push($(this).data('value'));
|
||||
})
|
||||
|
||||
for(var sv in selected_values) {
|
||||
current_type = $('.attributes-list').find(`button[data-value='${selected_values[sv]}']`).data('type')
|
||||
for (var i in item_attributes) {
|
||||
available_btn = []
|
||||
if (item_attributes[i].type != current_type) {
|
||||
for(var j in instances) {
|
||||
if (instances[j].values.includes(selected_values[sv]) && instances[j].out_of_stock == false) {
|
||||
$.map(instances[j].values, function(v) {
|
||||
if (v != selected_values[sv]) {
|
||||
available_btn.push(v)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (available_btn.length == 0) {
|
||||
element = $('.attributes-list').find(`button[data-type!='${current_type}']`)
|
||||
$.map(element, function(elem) {
|
||||
if (!$(elem).hasClass('bg-gray')) {
|
||||
$(elem).addClass('bg-gray box-shadow-none');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.map(available_btn, function(btn) {
|
||||
element = $('.attributes-list').find(`button[data-type !='${current_type}'][data-value!='${btn}']`)
|
||||
$.map(element, function(elem) {
|
||||
if (!$(elem).hasClass('bg-gray') && !available_btn.includes($(elem).data('value'))) {
|
||||
$(elem).addClass('bg-gray box-shadow-none')
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var selected_attr = get_selected_attributes('selected-attribute');
|
||||
|
||||
qty = $('.change_qty').val();
|
||||
|
||||
if($('#total_price').text() > 0) {
|
||||
$('#add_to_order').removeAttr('disabled')
|
||||
$('#total_price').text(0.0)
|
||||
}
|
||||
|
||||
var equal = false;
|
||||
for(var field in instances) {
|
||||
item_attr = instances[field].values;
|
||||
|
||||
item_attr = item_attr.sort()
|
||||
selected_attr = selected_attr.sort()
|
||||
if(JSON.stringify(item_attr) == JSON.stringify(selected_attr)){
|
||||
unit_price = instances[field].price ;
|
||||
total_price = qty * unit_price ;
|
||||
$('#instance_name').text(instances[field].name);
|
||||
$('#instance_code').text(instances[field].code);
|
||||
$('#promotion_price').text(instances[field].promotion_price);
|
||||
$('#total_price').text(total_price);
|
||||
$('#unit_price').text(unit_price);
|
||||
if (instances[field].out_of_stock) {
|
||||
var text = ''
|
||||
var length = 0
|
||||
for (var i in selected_attr) {
|
||||
length += 1;
|
||||
if (length == selected_attr.length) {
|
||||
text += selected_attr[i]
|
||||
}
|
||||
else {
|
||||
text += selected_attr[i]+'-'
|
||||
}
|
||||
}
|
||||
$('#wanring_text').text('')
|
||||
$('#wanring_text').append('<strong>' + text + '</strong> is out of stock.')
|
||||
$('#add_to_order').attr('disabled', true)
|
||||
$('#minus').attr('disabled', true);
|
||||
$('#plus').attr('disabled', true);
|
||||
$('#count').attr('readonly', true)
|
||||
return
|
||||
} else {
|
||||
equal = true
|
||||
unit_price = instances[field].price ;
|
||||
total_price = qty * unit_price ;
|
||||
$('#instance_name').text(instances[field].name);
|
||||
$('#instance_code').text(instances[field].code);
|
||||
$('#promotion_price').text(instances[field].promotion_price);
|
||||
$('#total_price').text(total_price);
|
||||
$('#unit_price').text(unit_price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (equal) {
|
||||
$('#wanring_text').text('');
|
||||
$('#add_to_order').removeAttr('disabled');
|
||||
$('#minus').removeAttr('disabled');
|
||||
$('#plus').removeAttr('disabled');
|
||||
$('#count').removeAttr('readonly')
|
||||
} else {
|
||||
var text = ''
|
||||
var length = 0
|
||||
for (var i in selected_attr) {
|
||||
length += 1;
|
||||
if (length == selected_attr.length) {
|
||||
text += selected_attr[i]
|
||||
}
|
||||
else {
|
||||
text += selected_attr[i]+'-'
|
||||
}
|
||||
}
|
||||
$('#wanring_text').text('')
|
||||
$('#wanring_text').append('<strong>' + text + '</strong> is not available.')
|
||||
$('#add_to_order').attr('disabled', true)
|
||||
$('#minus').attr('disabled', true);
|
||||
$('#plus').attr('disabled', true);
|
||||
$('#count').attr('readonly', true)
|
||||
}
|
||||
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
// click select option icon for add
|
||||
@@ -709,7 +904,6 @@ $(function() {
|
||||
value = $(this).data('value');
|
||||
type = $(this).data('type');
|
||||
group = $(this).data('group');
|
||||
console.log(group);
|
||||
options = $(".option_btn");
|
||||
$(options).each(function(i){
|
||||
if ($(options[i]).attr('data-type')==type){
|
||||
@@ -781,14 +975,13 @@ $(function() {
|
||||
total_price = $('#total_price').text();
|
||||
qty = parseInt($('#count').val());
|
||||
|
||||
var item_row = $('.selected-attribute');
|
||||
var item_row = $('.selected-attribute');
|
||||
|
||||
attribute_arr = get_selected_attributes('selected-attribute');
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
if (item_row.length>0) {
|
||||
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
|
||||
|
||||
|
||||
for(var field in instances) {
|
||||
|
||||
attrbu = JSON.stringify(attribute_arr);
|
||||
@@ -803,9 +996,9 @@ $(function() {
|
||||
}
|
||||
|
||||
}
|
||||
if (JSON.stringify(attribute_arr) === JSON.stringify(instances[field].values)) {
|
||||
console.log('instances');
|
||||
console.log(attrbu);
|
||||
attribute_arr = attribute_arr.sort()
|
||||
instance_arr = instances[field].values.sort()
|
||||
if (JSON.stringify(attribute_arr) === JSON.stringify(instance_arr)) {
|
||||
$('.add_to_order').attr('data-instance-code',instances[field].code);
|
||||
$('.add_to_order').attr('data-instance',instances[field].name);
|
||||
$('.add_to_order').attr('data-price',instances[field].price);
|
||||
@@ -833,33 +1026,14 @@ $(function() {
|
||||
console.log(item_data);
|
||||
show_item_detail(item_data,"add_to_order");
|
||||
calculate_sub_total();
|
||||
code = $('#item_code').text()
|
||||
code = $('#instance_code').text()
|
||||
autoScrollToItem(code);
|
||||
|
||||
}); //End add order Click
|
||||
|
||||
// click plus icon for add
|
||||
$(document).on('click', '.add_icon', function(event){
|
||||
|
||||
if (window.location.pathname != '/settings/out_of_stock/new') {
|
||||
var item_data = $(this);
|
||||
code = $(this).data('item-code');
|
||||
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2) {
|
||||
item = get_item(item_data,"add_icon");
|
||||
customer_display_view(item,"add");
|
||||
}
|
||||
|
||||
show_item_detail(item_data,"add_icon");
|
||||
calculate_sub_total();
|
||||
autoScrollToItem(code)
|
||||
}
|
||||
|
||||
}); //End Add Icon Click
|
||||
|
||||
// scroll to element
|
||||
function autoScrollToItem(code) {
|
||||
console.log(code)
|
||||
element = $('.summary-items').find(`[data-code='${code}']`);
|
||||
element = $('.summary-items').find(`[data-instance-code='${code}']`);
|
||||
item_qty = element.find('#item_qty').text()
|
||||
parent = element.parents('.card-text')
|
||||
|
||||
@@ -895,12 +1069,10 @@ $(function() {
|
||||
function isNotInView(elem, parent){
|
||||
// for scroll up | for scroll down
|
||||
result = (($(elem).offset().top - 100) < $(elem).height() || $(parent).height() < (elem.position().top + elem.outerHeight(true)));
|
||||
console.log(result)
|
||||
return result // reutn boolean
|
||||
}
|
||||
|
||||
function scrollToELement(elem) {
|
||||
console.log('Scroll into view')
|
||||
elem[0].scrollIntoView();
|
||||
}
|
||||
|
||||
@@ -962,7 +1134,7 @@ $(function() {
|
||||
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance +''+option_name+'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(price).toFixed(2)
|
||||
+ parseFloat(price * qty).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".summary-items tbody").append(row);
|
||||
@@ -1018,7 +1190,8 @@ $(function() {
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (type == "quick_service" || type=="food_court") {
|
||||
window.location.href = "/origami/"+type;
|
||||
module_name = window.location.href.includes('foodcourt') ? 'foodcourt' : 'origami'
|
||||
window.location.href = "/"+module_name+"/"+type;
|
||||
}else{
|
||||
if(table_type == "Table"){
|
||||
window.location.href = "/origami/table/" + table_id;
|
||||
@@ -1097,7 +1270,13 @@ $(function() {
|
||||
});
|
||||
|
||||
}else if(result.data == 'OK'){
|
||||
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
|
||||
if (window.location.pathname.includes('foodcourt')) {
|
||||
order_id = $('#order_id').val()
|
||||
window.location.href = '/foodcourt/food_court/'+order_id+'/request_bill'
|
||||
}
|
||||
else {
|
||||
window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text();
|
||||
}
|
||||
}else{
|
||||
if(result.current_user_role == 'cashier'){
|
||||
window.location.href = "/foodcourt/sale/"+result.data["sale_id"]+"/"+type+"/payment";
|
||||
@@ -1538,9 +1717,17 @@ $(function() {
|
||||
// price = $("#unit_price").text();
|
||||
// $("#total_price").text(qty*price);
|
||||
// });
|
||||
function truncateString(str, num) {
|
||||
if (str.length <= num) {
|
||||
return str
|
||||
} else {
|
||||
return str.slice(0, num) + '...'
|
||||
}
|
||||
}
|
||||
function show_menu_list(menu_items) {
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
console.log(menu_items);
|
||||
for(var field in menu_items) {
|
||||
if (menu_items[field].is_sub_item == false) {
|
||||
instances = menu_items[field].instances ;
|
||||
@@ -1585,7 +1772,7 @@ $(function() {
|
||||
menu_instances = [];
|
||||
|
||||
$(instances).each(function(i){
|
||||
if (instances[i].is_default === true) {
|
||||
if (instances[i].is_default === true && !instances[i].out_of_stock) {
|
||||
code = instances[i].code;
|
||||
name = instances[i].name;
|
||||
price = parseFloat(instances[i].price).toFixed(2);
|
||||
@@ -1603,6 +1790,65 @@ $(function() {
|
||||
});
|
||||
}
|
||||
|
||||
pointer_event = 'cursor'
|
||||
opacity = ''
|
||||
status = ''
|
||||
count = 0;
|
||||
$(instances).each(function(i) {
|
||||
if (instances[i].out_of_stock == true) {
|
||||
count += 1
|
||||
if (instances.length == count) { // all attributes out of stock
|
||||
pointer_event = 'none'
|
||||
status = 'out of stock'
|
||||
opacity = '0.5'
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
if (JSON.stringify(menu_items[field].item_sets)!='[]') { // check all item_sets out of stock??
|
||||
item_sets = menu_items[field].item_sets
|
||||
oos_count = 0
|
||||
available_count = 0
|
||||
for(var f in item_sets) {
|
||||
value = item_sets[f]["instances"];
|
||||
$(value).each(function(i){
|
||||
menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
for(var j in menus) {
|
||||
var categories = menus[j]["categories"];
|
||||
for(var ii in categories) {
|
||||
var items = categories[ii]["items"];
|
||||
for(var iii in items) {
|
||||
var result = items[iii]["instances"];
|
||||
for(var v in result) {
|
||||
if (value[i]["id"] == result[v]["id"]) {
|
||||
if (result[v].is_available) {
|
||||
available_count += 1
|
||||
if (result[v].out_of_stock) {
|
||||
oos_count += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
if(available_count == oos_count) {
|
||||
pointer_event = 'none'
|
||||
opacity = '0.5'
|
||||
status = 'out of stock'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status) {
|
||||
price_tag = '<span class="text-danger" style="font-weight:900;flex-grow:1;">'+status+'</span>'
|
||||
} else {
|
||||
price_tag ='<span style="font-weight:900;flex-grow:1;">'+price+'</span>'
|
||||
}
|
||||
|
||||
if (menu_items[field].image) {
|
||||
if (modify_order) {
|
||||
@@ -1610,134 +1856,127 @@ $(function() {
|
||||
}else{
|
||||
image_path = menu_items[field].image;
|
||||
}
|
||||
if (out_of_stock === true) {
|
||||
oos_item = out_of_stock_item
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;pointer-events: none;opacity: 0.4;">'
|
||||
oos_header = '<div class="head'+code+'" style="position: absolute;z-index: 5;top: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
|
||||
}else{
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
|
||||
oos_header = ''
|
||||
}
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3">'
|
||||
+ oos_item + oos_header
|
||||
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" >'
|
||||
+'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>'
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height: 100%; pointer-events: '+pointer_event+';">'
|
||||
name = menu_items[field].name
|
||||
short_name = truncateString(name, 30)
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3 m-t-2">'
|
||||
+ oos_item
|
||||
+'<div class="custom-card-head card-head row" style="margin:0px; height: 40px; font-size: 0.9em; opacity: '+opacity+'" >'
|
||||
+'<div class="col-md-10 " style="padding:0px !important;">'+ short_name +'</div>'
|
||||
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+"' "
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='"+ menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
+" data-price = '" + price +"' "
|
||||
+" data-instance-code = '"+ code +"' "
|
||||
+" data-instance = '" + name +"' "
|
||||
+" data-promotion-price = '"+ promotion_price +"' "
|
||||
+" data-id= '" + JSON.stringify(menu_items[field].attributes) +"'"
|
||||
+" data-attributes = '" + JSON.stringify(item_attributes) +"' "
|
||||
+" data-options = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-opt = '" + JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-image='"+image_path+"' "
|
||||
+" data-toggle='modal' "
|
||||
+" data-target='."+data_target+"' "
|
||||
+" data-item-sets = '"+JSON.stringify(menu_items[field].item_sets)+"'"
|
||||
+" data-instances = '"+JSON.stringify(menu_items[field].instances)+"'"
|
||||
+" style='height: 80px;'>"
|
||||
+ '<img src = "../../'+image_path+'" class="img-fluid" style="opacity: '+opacity+'; height: 100%; width: 100%;"/>'
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer custom-flex-footer" style="height: 40px;">'
|
||||
+ price_tag
|
||||
+ "<div class='offset-4 col-2 "+menu_item_box
|
||||
+ "' data-item-code='" + menu_items[field].code
|
||||
+ "' data-instance='" + JSON.stringify(menu_items[field].instances)
|
||||
+ "' data-id='" + JSON.stringify(menu_items[field].attributes)
|
||||
+ "' data-item='" + JSON.stringify(item_attributes)
|
||||
+ "' data-option='" + JSON.stringify(menu_items[field].options)
|
||||
+ "' data-opt='" + JSON.stringify(menu_items[field].options)
|
||||
+ "' data-item-sets='" + JSON.stringify(menu_items[field].item_sets)
|
||||
+ "' data-toggle='modal'"
|
||||
+ " data-target='." + data_target +"'"
|
||||
+ " style='padding:0px 5px 0px 5px; opacity: "+opacity+"; pointer-events: "+pointer_event+";'>"
|
||||
+ "<i class='m-l--5 fa " + fa_plus + "'>"
|
||||
+ add
|
||||
+ "</i>"
|
||||
+'</div>'
|
||||
|
||||
+'</div>'
|
||||
+'</div>'; ;
|
||||
}else{
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%; pointer-events: '+pointer_event+';">'
|
||||
|
||||
name = menu_items[field].name
|
||||
short_name = truncateString(name, 50)
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3 m-t-2">'
|
||||
+ oos_item
|
||||
+'<div class="custom-card-no-img-head card-head h-100 '+add_icon+' " id="oos'+ code +'" style="margin:0px;display:flex; opacity: '+opacity+';"'
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='" + menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
+" data-price = '" + price +"' "
|
||||
+" data-instance-code = '"+ code +"' "
|
||||
+" data-instance = '" + name +"' "
|
||||
+" data-promotion-price = '"+ promotion_price +"' "
|
||||
+" data-attributes = '" + JSON.stringify(item_attributes) +"' "
|
||||
+ "data-id= '" + JSON.stringify(menu_items[field].attributes)+"'"
|
||||
+" data-options = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-opt = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-image='' data-toggle='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="product_box" style="width:100%;"><span>'+ short_name +'<span></div>'
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+"' "
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='" + menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
+" data-price = '" + price +"' "
|
||||
+" data-instance-code = '"+ code +"' "
|
||||
+" data-instance = '" + name +"' "
|
||||
+" data-promotion-price = '"+ promotion_price +"' "
|
||||
+" data-attributes = '" + JSON.stringify(item_attributes) +"' "
|
||||
+" data-options = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-opt = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-image='' 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>'
|
||||
+"<div class='"+add_icon+" p-t-65 p-b-65 m-r-' "
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='"+ menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
+" data-price = '" + price +"' "
|
||||
+" data-instance-code = '"+ code +"' "
|
||||
+" data-instance = '" + name +"' "
|
||||
+" data-promotion-price = '"+ promotion_price +"' "
|
||||
+" data-attributes = '" + JSON.stringify(item_attributes) +"' "
|
||||
+" data-options = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-opt = '" + JSON.stringify(menu_items[field].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-footer custom-card-no-img-footer custom-flex-footer" style="height: 50px;">'
|
||||
+ price_tag
|
||||
+" <div class='offset-4 col-2 menu_item_no_img_box "+menu_item_box+" ' "
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-instance = '" +JSON.stringify(menu_items[field].instances)+"' "
|
||||
+" data-id = '"+JSON.stringify(menu_items[field].attributes)+"' "
|
||||
+" data-item = '" +JSON.stringify(item_attributes)+"' "
|
||||
+" data-option = '"+JSON.stringify(menu_items[field].options)+"'"
|
||||
+" data-opt = '"+JSON.stringify(menu_items[field].options)+"' "
|
||||
+" data-item-sets = '"+JSON.stringify(menu_items[field].item_sets)+"' "
|
||||
+" data-toggle='modal' "
|
||||
+" data-target='."+data_target+"' "
|
||||
+" style='padding:0px 5px 0px 5px; opacity: "+opacity+"; pointer-envents: "+pointer_event+";'>"
|
||||
+"<i class='m-l--5 fa "+fa_plus+"' >"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="card-footer custom-card-footer custom-flex-footer" style="opacity:0.7">'
|
||||
+'<span style="font-weight:900;flex-grow:1;">'+ price +'</span>'
|
||||
+ "<div class='offset-4 col-2 "+menu_item_box
|
||||
+ "' data-item-code='" + menu_items[field].code
|
||||
+ "' data-menu-instances='" + JSON.stringify(menu_instances)
|
||||
+ "' data-instance='" + JSON.stringify(menu_items[field].instances)
|
||||
+ "' data-id='" + JSON.stringify(menu_items[field].attributes)
|
||||
+ "' data-item='" + JSON.stringify(item_attributes)
|
||||
+ "' data-option='" + JSON.stringify(menu_items[field].options)
|
||||
+ "' data-opt='" + JSON.stringify(menu_items[field].options)
|
||||
+ "' data-item-sets='" + JSON.stringify(menu_items[field].item_sets)
|
||||
+ "' data-toggle='modal'"
|
||||
+ " data-target='." + data_target +"'"
|
||||
+ " style='padding:0px 5px 0px 5px' >"
|
||||
+ "<i class='m-l--5 fa " + fa_plus + "'>"
|
||||
+ add
|
||||
+ "</i>"
|
||||
+'</div>'
|
||||
|
||||
+'</div>'
|
||||
+'</div>'; ;
|
||||
}else{
|
||||
if (out_of_stock === true) {
|
||||
// oos_item = out_of_stock_item
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%; pointer-events: none;opacity: 0.4;">'
|
||||
oos_header = '<div class="head'+code+'" style="position: absolute;z-index: 5;top: 0;left: 0;right: 0;text-align: center;background: #fb483a;margin: auto;color: #fff;padding: 8px;font-weight: bolder;">OUT OF STOCK</div>'
|
||||
}else{
|
||||
oos_item = '<div class="card custom-card testimonial-card fadeInRight" id="'+ code +'" style="height:100%;">'
|
||||
oos_header = ''
|
||||
}
|
||||
row = '<div class="col-md-6 col-sm-6 col-lg-3 mt-1">'
|
||||
+ oos_item + oos_header
|
||||
+'<div class="custom-card-no-img-head card-head '+add_icon+' " id="oos'+ code +'" style="margin:0px;display:flex;!important "'
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='" + menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
+" data-price = '" + price +"' "
|
||||
+" data-instance-code = '"+ code +"' "
|
||||
+" data-instance = '" + name +"' "
|
||||
+" data-promotion-price = '"+ promotion_price +"' "
|
||||
+" data-attributes = '" + JSON.stringify(item_attributes) +"' "
|
||||
+" data-options = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-opt = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-image='' 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="product_box" style="width:100%;"><span>'+ menu_items[field].name +'<span></div>'
|
||||
+'</div>'
|
||||
+"<div class='"+add_icon+"' "
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-name='" + menu_items[field].name +"' "
|
||||
+" data-qty = '"+ qty +"' "
|
||||
+" data-price = '" + price +"' "
|
||||
+" data-instance-code = '"+ code +"' "
|
||||
+" data-instance = '" + name +"' "
|
||||
+" data-promotion-price = '"+ promotion_price +"' "
|
||||
+" data-attributes = '" + JSON.stringify(item_attributes) +"' "
|
||||
+" data-options = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-opt = '"+ JSON.stringify(menu_items[field].options) +"' "
|
||||
+" data-image='' 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>'
|
||||
+'<div class="card-footer custom-card-no-img-footer custom-flex-footer">'
|
||||
+'<span style="font-weight:900;flex-grow:1;">'+ price + '</span>'
|
||||
+" <div class='offset-4 col-2 menu_item_no_img_box "+menu_item_box+" ' "
|
||||
+" data-item-code='"+ menu_items[field].code +"' "
|
||||
+" data-menu-instances = '" +JSON.stringify(menu_instances)+"' "
|
||||
+" data-instance = '" +JSON.stringify(menu_items[field].instances)+"' "
|
||||
+" data-id = '"+JSON.stringify(menu_items[field].attributes)+"' "
|
||||
+" data-item = '" +JSON.stringify(item_attributes)+"' "
|
||||
+" data-option = '"+JSON.stringify(menu_items[field].options)+"'"
|
||||
+" data-opt = '"+JSON.stringify(menu_items[field].options)+"' "
|
||||
+" data-item-sets = '"+JSON.stringify(menu_items[field].item_sets)+"' "
|
||||
+" data-toggle='modal' "
|
||||
+" data-target='."+data_target+"' "
|
||||
+" style='padding:0px 5px 0px 5px'>"
|
||||
+"<i class='m-l--5 fa "+fa_plus+" '>"
|
||||
+add+ '</i>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
|
||||
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
+'</div>'
|
||||
+'</div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$('.menu_items_list').append(row);
|
||||
}
|
||||
//end instances in menu-items alest 1 instance
|
||||
}
|
||||
//end is_sub_item false
|
||||
$('.menu_items_list').append(row);
|
||||
}
|
||||
//end instances in menu-items alest 1 instance
|
||||
}
|
||||
//end is_sub_item false
|
||||
}
|
||||
}
|
||||
$("#add_to_existing_order").on('click', function(e){
|
||||
$(this).attr('disabled', 'disabled');
|
||||
|
||||
@@ -23,6 +23,16 @@ $(document).ready(function() {
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#foodcourt-table-slimscroll').slimScroll({
|
||||
height: '100%',
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 50
|
||||
});
|
||||
|
||||
$('#foodcourt-order-slimscroll').slimScroll({
|
||||
height: '100%',
|
||||
size: '5px',
|
||||
|
||||
@@ -311,7 +311,7 @@ i.logout_icon{
|
||||
text-align:center;
|
||||
font-weight:900;
|
||||
color:#fff;
|
||||
font-size:1.5em;
|
||||
font-size:1.2em;
|
||||
margin:auto;
|
||||
}
|
||||
.custom-card-no-img-head{
|
||||
|
||||
@@ -27,6 +27,14 @@ table.fixed-header {
|
||||
}
|
||||
}
|
||||
|
||||
.bg-gray {
|
||||
background-color: #D7D7D7;
|
||||
}
|
||||
|
||||
.box-shadow-none {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
font-family: 'Material Icons';
|
||||
font-weight: normal;
|
||||
|
||||
@@ -12,7 +12,7 @@ class BaseFoodcourtController < ActionController::Base
|
||||
rescue_from CanCan::AccessDenied do |exception|
|
||||
flash[:warning] = exception.message
|
||||
# redirect_to origami_root_path
|
||||
redirect_to origami_dashboard_path
|
||||
redirect_to foodcourt_food_court_path
|
||||
end
|
||||
|
||||
def check_user
|
||||
|
||||
@@ -54,9 +54,6 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
end
|
||||
end
|
||||
def app_orders
|
||||
# @pending_orders = Sale.pending_order('food_court')
|
||||
# @completed = Sale.completed_sale('food_court')
|
||||
|
||||
if !params[:booking_id].nil? && !params[:booking_id].blank?
|
||||
@booking = Booking.select("orders.*,bookings.*,customers.*")
|
||||
.joins("JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
|
||||
@@ -67,10 +64,211 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
@booking_id =@booking.booking_id
|
||||
@order_id =@booking.order_id
|
||||
@sale_data = Sale.find_by_sale_id(@booking.sale_id)
|
||||
|
||||
elsif params[:pending_id]
|
||||
id = params[:pending_id]
|
||||
if id.include? "SAL"
|
||||
@pending = Sale.includes(:sale_items).find_by(sale_id: id)
|
||||
if @pending.sale_status == "new"
|
||||
@status = "sale"
|
||||
end
|
||||
elsif id.include? "BKI"
|
||||
@pending = Booking.includes(:order_items).find_by(booking_id: id)
|
||||
@status = "order"
|
||||
end
|
||||
end
|
||||
@current_shift = ShiftSale.current_shift
|
||||
status = ['completed', 'void']
|
||||
|
||||
@pending_sales = Sale.where('shift_sale_id = ? AND sale_status NOT IN (?)', @current_shift.id, status)
|
||||
@pending_completed = Sale.where('shift_sale_id = ? AND sale_status IN (?)', @current_shift.id, status)
|
||||
@pending_orders = Sale.pending_order('food_court')
|
||||
|
||||
@completed, @bookings = Sale.get_foodcourt_current_shift_orders
|
||||
end
|
||||
|
||||
def current_shift_order_count
|
||||
@current_shift = ShiftSale.current_shift
|
||||
@pending_sales = Sale.where('shift_sale_id = ? AND sale_status NOT IN (?)', @current_shift.id, status)
|
||||
@pending_orders = Sale.pending_order('food_court')
|
||||
@occupied_table = @pending_sales.length + @pending_orders.length
|
||||
render json: @occupied_table
|
||||
end
|
||||
|
||||
def modify_order
|
||||
@cashier_type = "food_court"
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
|
||||
@menus = []
|
||||
@menu = []
|
||||
|
||||
if params[:id].include? "BKI"
|
||||
@table_id = nil
|
||||
@table = nil
|
||||
@booking = Booking.find(params[:id])
|
||||
else
|
||||
@table_id = params[:id]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
@booking = @table.get_booking
|
||||
end
|
||||
|
||||
@completed, @bookings = Sale.get_mobile_orders
|
||||
@sale_id = @booking.sale_id
|
||||
|
||||
if @booking
|
||||
@booking_id = @booking.booking_id
|
||||
@obj_order = @booking.orders.first
|
||||
@customer = @obj_order.customer
|
||||
@date = @obj_order.created_at
|
||||
@order_items = @booking.order_items
|
||||
end
|
||||
|
||||
render "foodcourt/addorders/detail"
|
||||
end
|
||||
|
||||
def update_modify_order
|
||||
booking = Booking.find(params[:booking_id])
|
||||
sale = booking.sale
|
||||
if sale && sale.sale_status != 'new'
|
||||
render :json => { :status => false }
|
||||
end
|
||||
|
||||
is_extra_time = false
|
||||
extra_time = ''
|
||||
cashier_type = "quick_service"
|
||||
|
||||
items_arr = []
|
||||
JSON.parse(params[:order_items]).each { |i|
|
||||
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
|
||||
if i["item_instance_code"].include? "ext"
|
||||
is_extra_time = true
|
||||
arr_exts = i["item_instance_code"].split("_")
|
||||
if arr_exts[1].match(/^(\d)+$/)
|
||||
time = arr_exts[1].to_i*60*i["quantity"].to_i
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
if i["parent_order_item_id"]
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
# begin
|
||||
order = Order.new
|
||||
order.source = params[:order_source]
|
||||
order.order_type = params[:order_type]
|
||||
# order.customer_id = params[:customer_id].present? ? params[:customer_id] : walkin.customer_id # for no customer id from mobile
|
||||
order.items = items_arr
|
||||
order.guest = params[:guest_info]
|
||||
order.table_id = params[:table_id] # this is dining facilities's id
|
||||
order.waiters = current_login_employee.name
|
||||
order.employee_name = current_login_employee.name
|
||||
|
||||
order.is_extra_time = is_extra_time
|
||||
order.extra_time = extra_time
|
||||
|
||||
order.new_booking = false
|
||||
order.booking_id = booking.booking_id
|
||||
|
||||
if order.generate
|
||||
if sale
|
||||
Sale.add_to_existing_pending_invoice(nil, sale.sale_id, booking)
|
||||
render :json => { :status => true, :data => sale }
|
||||
else
|
||||
render :json => { :status => true, :data => 'OK' }
|
||||
end
|
||||
else
|
||||
render :json => { :status => false }
|
||||
end
|
||||
end
|
||||
|
||||
def request_bill
|
||||
sale_data =[]
|
||||
if !ShiftSale.current_shift.nil?
|
||||
order_id = params[:order_id] # order_id
|
||||
order = Order.find(order_id)
|
||||
booking = order.booking
|
||||
if booking.checkin_at.utc > Time.now.utc && booking.checkout_at.nil?
|
||||
@status = false
|
||||
@error_message = "Operation failed, Could not request bill!"
|
||||
else
|
||||
table = DiningFacility.find_by(id: booking.dining_facility_id)
|
||||
|
||||
if booking.sale_id.nil?
|
||||
if sale_data = Sale.generate_invoice_from_booking(booking, current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
|
||||
# in-duty update
|
||||
in_duties = InDuty.where("booking_id=?", booking.id)
|
||||
if !in_duties.empty?
|
||||
in_duties.each do |in_duty|
|
||||
induty = InDuty.find(in_duty.id)
|
||||
induty.sale_id = sale_data.sale_id
|
||||
induty.out_time = Time.now.utc
|
||||
induty.save
|
||||
end
|
||||
end
|
||||
|
||||
action_by = current_user.name
|
||||
type = "REQUEST_BILL"
|
||||
|
||||
remark = "Request bill Receipt No #{sale_data.receipt_no}"
|
||||
sale_audit = SaleAudit.record_audit_sale(sale_data.sale_id,remark,action_by,type )
|
||||
|
||||
# Promotion Activation
|
||||
Promotion.promo_activate(sale_data)
|
||||
|
||||
#bill channel
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
else
|
||||
from = ""
|
||||
end
|
||||
|
||||
if ["quick_service", "cashier"].include? order.source
|
||||
ActionCable.server.broadcast "bill_channel", table: table, from: from
|
||||
end
|
||||
|
||||
unless ["quick_service", "food_court"].include? order.source
|
||||
#check checkInOut pdf print
|
||||
checkout_time = Lookup.collection_of('checkout_time')
|
||||
if !booking.dining_facility_id.nil?
|
||||
terminal = DiningFacility.find_by_id(booking.dining_facility_id)
|
||||
cashier_terminal = CashierTerminal.find_by_id(terminal.zone_id)
|
||||
|
||||
if (!checkout_time.empty?) && (ENV["SERVER_MODE"] != "cloud") #no print in cloud server
|
||||
unique_code = "CheckInOutPdf"
|
||||
printer = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# print when complete click
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(printer)
|
||||
|
||||
if !printer.nil?
|
||||
order_queue_printer.print_check_in_out(printer, cashier_terminal, booking, table)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@status = true
|
||||
sale_id = sale_data.sale_id
|
||||
else
|
||||
@status = false
|
||||
sale_id = nil
|
||||
end
|
||||
else
|
||||
@status = true
|
||||
sale_id = booking.sale_id
|
||||
end
|
||||
end
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift for This Employee"
|
||||
end
|
||||
if ["quick_service", "food_court"].include? order.source
|
||||
redirect_to "/foodcourt/sale/#{sale_data.sale_id}/food_court/payment#"
|
||||
end
|
||||
#
|
||||
end
|
||||
|
||||
def completed
|
||||
|
||||
@@ -67,7 +67,7 @@ class CardSaleTran < ApplicationRecord
|
||||
shift_closed_at As closing_date,")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" , from)
|
||||
byebug
|
||||
# byebug
|
||||
end
|
||||
|
||||
end
|
||||
@@ -64,6 +64,6 @@ class CardSettleTran < ApplicationRecord
|
||||
shift_closed_at As closing_date,")
|
||||
.order("shift_sales.id DESC")
|
||||
return query = query.where("shift_sales.shift_started_at >= ?" , from)
|
||||
byebug
|
||||
# byebug
|
||||
end
|
||||
end
|
||||
|
||||
@@ -673,26 +673,28 @@ class Sale < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.get_mobile_orders
|
||||
def self.get_foodcourt_current_shift_orders
|
||||
@current_shift = ShiftSale.current_shift
|
||||
@bookings = Booking.select("bookings.*,customers.*")
|
||||
.joins(" JOIN sales ON bookings.sale_id=sales.sale_id")
|
||||
.joins(" JOIN booking_orders ON booking_orders.booking_id=bookings.booking_id")
|
||||
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
|
||||
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
|
||||
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
|
||||
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and DATE(bookings.created_at)=?",'completed','paid', Date.today)
|
||||
.order("bookings.created_at desc").uniq
|
||||
.where("sales.sale_status =? and sales.payment_status =? and orders.source='app' and sales.shift_sale_id = ?",
|
||||
'completed','paid', @current_shift.id
|
||||
).order("bookings.created_at desc").uniq
|
||||
|
||||
@competed = []
|
||||
@completed = []
|
||||
@assigns = []
|
||||
@bookings.each do |b|
|
||||
if b.booking_status == 'completed'
|
||||
@competed << b
|
||||
@completed << b
|
||||
else
|
||||
@assigns << b
|
||||
end
|
||||
end
|
||||
return @competed, @assigns
|
||||
return @completed, @assigns
|
||||
end
|
||||
|
||||
#Generate new Receipt No when it is not assigned
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
<% @order_id = params[:order_id].gsub('"', '') if params[:order_id] %>
|
||||
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
|
||||
<input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>">
|
||||
<input type="hidden" name="link_type" id="link_type" value="<%= @cashier_type %>">
|
||||
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
|
||||
<input type="hidden" name="order_id" id="order_id" value= "<%= @order_id %>">
|
||||
<div class="row m-t--10 h-100">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 hidden d-flex flex-column h-100" id="menu_data">
|
||||
<li class="list-menu">
|
||||
@@ -80,7 +82,7 @@
|
||||
|
||||
|
||||
<div class="col-lg-2 col-md-2 col-sm-2 hidden h-100 d-flex flex-column m-t-10" id="menu_cache">
|
||||
<div class="card h-100">
|
||||
<div class="card h-100" style="margin-bottom: 10px;">
|
||||
<div class="card-header">
|
||||
<li class="list-menu" style="background: none">
|
||||
<a href="javascript:void(0);" id="menu_dropdown" class="menu-toggle dropdown-toggle toggled my-toggle ">
|
||||
@@ -106,8 +108,9 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10 d-flex flex-column h-100" >
|
||||
<div class="card h-100">
|
||||
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10 d-flex flex-column h-100" style="margin-left: -10px;
|
||||
margin-right: -10px;">
|
||||
<div class="card h-100" style="margin-bottom: 10px;">
|
||||
<div class="card-block d-flex flex-column h-100" style="">
|
||||
<div class="card-text" id="foodcourt-slimscroll">
|
||||
<div class="row menu_items_list" style="margin:0px 1px 0px 1px ;">
|
||||
@@ -154,11 +157,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10 d-flex flex-column h-100 ">
|
||||
<div class="card h-100">
|
||||
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10 d-flex flex-column h-100">
|
||||
<div class="card h-100" style="margin-right: -20px; margin-bottom: 10px;">
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-12" id='app_order'>
|
||||
Mobile Orders <span class="badge badge-danger" style="font-size: 0.75rem;border-radius: 5px;"><%= @app_order_new_count %></span>
|
||||
Orders
|
||||
</button>
|
||||
<div class="row ">
|
||||
<div class="col-md-9 col-lg-9 col-sm-9 ">
|
||||
@@ -174,8 +177,15 @@
|
||||
</div>
|
||||
|
||||
<div class="card-block d-flex flex-column h-100">
|
||||
<div class="table-responsive">
|
||||
<table class="table" id="append-table">
|
||||
<!-- <div class="table-responsive">
|
||||
<table class="table m-b-0" id="append-table">
|
||||
<thead>
|
||||
|
||||
</thead>
|
||||
</table>
|
||||
</div> -->
|
||||
<div class="card-text h-100" id="foodcourt-order-slimscroll">
|
||||
<table class="table table-striped summary-items" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
@@ -184,10 +194,6 @@
|
||||
<th class="text-nowrap text-right">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-text h-100" id="foodcourt-order-slimscroll">
|
||||
<table class="table table-striped summary-items fixed-header" id="order-items-table" >
|
||||
<tbody class="font-13" >
|
||||
|
||||
</tbody>
|
||||
@@ -198,15 +204,20 @@
|
||||
<div class="card-footer flex-grow-1 custom-card-footer" id="orders-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td colspan="2" style="padding:2px; text-align:" class="charges-name"><strong>Total:</strong></td>
|
||||
<td style="padding:2px; text-align: center;"><strong id="total_qty">0</strong></td>
|
||||
<td style="padding:2px; text-align:" class="item-attr float-right"><strong id="sub_total">0.00</strong></td>
|
||||
<td colspan="2" style="padding:2px;" class="charges-name"><strong>Total:</strong></td>
|
||||
<td style="padding:2px 20px 2px 2px;"><strong id="total_qty">0</strong></td>
|
||||
<td style="padding:2px;" class="item-attr <%= params[:modify] ? '' : 'text-right'%>"><strong id="sub_total">0.00</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% if @sale_id.nil?%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% if params[:update] %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12 m-t-5" id="create_pay_order" disabled="disabled" style=" height: 50px; width: 100%;">Update Order & Pay</button>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="add_to_existing_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% if @sale_id.nil?%>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-4 d-inline" id="create_pay_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-4 d-inline" id="add_to_existing_order" disabled="disabled" style="padding-top:4px !important;padding-bottom:4px !important;"><i class="material-icons" style="font-size:34px;width:34px">attach_money</i></button>
|
||||
<% end %>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-7 m-l-15 d-inline" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -325,7 +336,8 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="mr-auto">
|
||||
<h4 class=" pull-left">Total : <span id="total_price"></span></h4>
|
||||
<h4 class=" pull-left d-inline">Total : <span id="total_price"></span></h4>
|
||||
<div id="wanring_text" class="d-inline text-danger" style="margin-left: 50px"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
@@ -342,14 +354,15 @@
|
||||
|
||||
|
||||
<!-- Large modal -->
|
||||
<div class="modal sx_item_set_detailModal" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="sx_item_set_detailLabel" aria-hidden="true" >
|
||||
<div class="modal-dialog custom-modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal sx_item_set_detailModal h-100" id="sx_item_set_detailModal" tabindex="-1" role="dialog" aria-labelledby="sx_item_set_detailLabel" aria-hidden="true" >
|
||||
<div class="modal-dialog custom-modal-dialog modal-lg h-100">
|
||||
<div class="modal-content h-100">
|
||||
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
|
||||
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" data-height="50">
|
||||
<div class="modal-body h-100" id="set-menu-item-slimscroll" data-height="50">
|
||||
<!-- id="set-menu-item-slimscroll" -->
|
||||
<div class="row set-item">
|
||||
<div class="col-md-4">
|
||||
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
@@ -465,6 +478,9 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(document).on('click', '.menu_click', function(event){
|
||||
|
||||
$('.category_list').find('li').find('.nav-link').removeClass('active');
|
||||
|
||||
var menu_id = $(this).attr("data-id");
|
||||
var name = $(this).attr("data-name");
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
|
||||
@@ -8,95 +8,186 @@
|
||||
</style>
|
||||
<%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %>
|
||||
|
||||
<!-- <button type="button" class="btn btn-block btn-default waves-effect float-right" id='back' style="width: 112px; margin-right: -10px">
|
||||
<i class="material-icons">reply</i>
|
||||
Back
|
||||
</button> -->
|
||||
|
||||
<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;margin-top:20px">
|
||||
<div id="oqs_loading_wrapper" style="display:none;">
|
||||
<div id="oqs_loading"></div>
|
||||
</div>
|
||||
|
||||
<div class="row m-t--20 h-100">
|
||||
<% if !@booking.nil?%>
|
||||
<div class="col-md-7 col-lg-7 col-sm-12 float-left h-100 d-flex flex-column m-l-5 m-r-10" style="padding-right: 10px;">
|
||||
<% if !@booking.nil? || @pending %>
|
||||
<div class="col-md-6 col-lg-6 col-sm-12 float-left h-100 d-flex flex-column m-l-5 m-r-10" style="padding-right: 15px;">
|
||||
<% else %>
|
||||
<div class="col-md-11 col-lg-11 col-sm-12 h-100 d-flex flex-column" style="padding: 0 !important;">
|
||||
<div class="col-md-10 col-lg-10 col-sm-12 h-100 d-flex flex-column" style="padding: 0 15px 0 20px !important;">
|
||||
<% end %>
|
||||
<!-- Nav tabs -->
|
||||
<ul class="nav nav-tabs tab-col-teal m-t--10" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= 'active' if params[:active].blank? %>" data-toggle="tab" href="#mobile_orders" role="tab">Mobile Orders</a>
|
||||
<a class="nav-link <%= params[:active] == 'completed' ? 'active' : '' %>" data-toggle="tab" href="#complete" role="tab"><%= t :competed %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= params[:active] ? 'active' : '' %>" data-toggle="tab" href="#complete" role="tab"><%= t :competed %></a>
|
||||
<a class="nav-link <%= 'active' if params[:active].blank? %>" data-toggle="tab" href="#pending_order" role="tab">Pending Orders</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <%= params[:active] == 'mobile' ? 'active' : '' %>" data-toggle="tab" href="#mobile_orders" role="tab">Mobile Orders</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- Nav tabs - End -->
|
||||
<div class="tab-content h-100">
|
||||
<!-- Panel 0 - Mobile Orders -->
|
||||
<div class="tab-pane <%= 'active' if params[:active].blank? %>" id='mobile_orders' role='tabpanel'>
|
||||
<div id="foodcourt-slimscroll" class="flex-grow-1">
|
||||
<div class="card-columns">
|
||||
<% bk_color ='' %>
|
||||
<% @bookings.each do |bk|
|
||||
bk_status ='new'
|
||||
<div class="tab-content h-100 d-flex flex-column">
|
||||
<!--- Panel 0 - Completed Orders -->
|
||||
<div class="tab-pane h-100 <%= params[:active] == 'completed' ? 'active' : '' %>" id="complete" role="tabpanel">
|
||||
<div class="d-flex flex-column h-100">
|
||||
<div id="foodcourt-menu-slimscroll" class="flex-grow-1">
|
||||
<div class="card-columns p-l-10">
|
||||
<% bk_color ='' %>
|
||||
<% @completed.each do |c| %>
|
||||
<%
|
||||
if !@booking.nil?
|
||||
if c.booking_id == @booking.booking_id
|
||||
bg_color ='bg-secondary'
|
||||
else
|
||||
if c.sale.sale_status == 'void'
|
||||
bg_color = 'bg-danger'
|
||||
elsif c.sale.sale_status == 'completed'
|
||||
bg_color = 'bg-success'
|
||||
end
|
||||
end
|
||||
else
|
||||
if c.sale.sale_status == 'void'
|
||||
bg_color = 'bg-danger'
|
||||
elsif c.sale.sale_status == 'completed'
|
||||
bg_color = 'bg-success'
|
||||
end
|
||||
end
|
||||
%>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id: c.booking_id, active: 'completed'), class: 'item-card' do %>
|
||||
<div class="card <%= bg_color %> text-white" data-id ="<%= c.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= c.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= c.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= c.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= c.booking_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
if !@booking.nil?
|
||||
if bk.booking_id == @booking.booking_id
|
||||
bk_color ='bg-secondary'
|
||||
<% @pending_completed.each do |pc| %>
|
||||
<% if @pending.present? %>
|
||||
<% if @pending.sale_id == pc.sale_id %>
|
||||
<% bg_color = 'bg-secondary' %>
|
||||
<% else %>
|
||||
<% if pc.sale_status == 'void' %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% elsif pc.sale_status == 'completed' %>
|
||||
<% bg_color = 'bg-success' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if pc.sale_status == 'void' %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% elsif pc.sale_status == 'completed' %>
|
||||
<% bg_color = 'bg-success' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(pending_id: pc.sale_id, active: 'completed'), class: 'item-card' do %>
|
||||
<div class="card <%= bg_color %> text-white">
|
||||
<div class="card-block">
|
||||
<%= pc.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= pc.created_at.utc.getlocal.strftime("%I:%M %p") %></span>
|
||||
<br>
|
||||
<span style="font-size:12px;float:right;line-height: 30px;"><%= pc.sale_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 1 - Pending Orders -->
|
||||
<div class="tab-pane <%= 'active' if params[:active].blank? %> h-100" id="pending_order" role="tabpanel">
|
||||
<div class="h-100 d-flex flex-column">
|
||||
<div id="foodcourt-order-slimscroll" class="h-100">
|
||||
<div class="card-columns p-l-10">
|
||||
<% @pending_sales.each do |sale| %>
|
||||
<% if @pending.present? %>
|
||||
<% if @pending.sale_id == sale.sale_id %>
|
||||
<% bg_color = 'bg-secondary' %>
|
||||
<% else %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% bg_color = 'bg-danger' %>
|
||||
<% end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(pending_id: sale.sale_id), class: 'item-card' do %>
|
||||
<div class="card sales <%= bg_color %> text-white" data-id = "<%= sale.sale_id %>">
|
||||
<div class="card-block">
|
||||
<%= sale.receipt_no %>
|
||||
<span class="float-right"><%= sale.created_at.strftime('%I:%M %p') %></span>
|
||||
<br>
|
||||
<span class = 'float-right m-t-5'>Billed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% @pending_orders.each do |order| %>
|
||||
<% if @pending.present? && @status == 'order' %>
|
||||
<% if @pending.booking_id == order.booking_id %>
|
||||
<% bg_color = 'bg-secondary' %>
|
||||
<% else %>
|
||||
<% bg_color = 'blue' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% bg_color = 'blue' %>
|
||||
<% end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(pending_id: order.booking_id), class: 'item-card' do %>
|
||||
<div class="card sales <%= bg_color %> text-white" data-id = "<%= order.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= order.booking_id %>
|
||||
<span class="float-right"><%= order.created_at.strftime('%I:%M-%p') %></span>
|
||||
<br>
|
||||
<span class="float-right m-t-5">new</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Panel 2 - Mobile Orders -->
|
||||
<div class="tab-pane h-100 <%= params[:active] == 'mobile' ? 'active' : '' %>" id='mobile_orders' role='tabpanel'>
|
||||
<div class="h-100 d-flex flex-column">
|
||||
<div id="foodcourt-slimscroll" class="flex-grow-1">
|
||||
<div class="card-columns p-l-10">
|
||||
<% bk_color ='' %>
|
||||
<% @bookings.each do |bk|
|
||||
bk_status ='new'
|
||||
|
||||
if !@booking.nil?
|
||||
if bk.booking_id == @booking.booking_id
|
||||
bk_color ='bg-secondary'
|
||||
else
|
||||
bk_color =bk.booking_status
|
||||
end
|
||||
else
|
||||
bk_color =bk.booking_status
|
||||
end
|
||||
else
|
||||
bk_color =bk.booking_status
|
||||
end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id), class: 'item-card' do %>
|
||||
<div class="card <%= bk_color %> text-white" data-id ="<%= bk.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= bk.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= bk_status %></span>
|
||||
end %>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id:bk.booking_id, active: 'mobile'), class: 'item-card' do %>
|
||||
<div class="card <%= bk_color %> text-white" data-id ="<%= bk.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= bk.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= bk.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= bk.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;"><%= bk_status %></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--- Panel 1 - Completed Orders -->
|
||||
<div class="tab-pane <%= params[:active] ? 'active' : '' %>" id="complete" role="tabpanel">
|
||||
<div class="card-columns">
|
||||
<% bk_color ='' %>
|
||||
<% @completed.each do |c| %>
|
||||
<%
|
||||
if !@booking.nil?
|
||||
if c.booking_id == @booking.booking_id
|
||||
bk_color ='bg-secondary'
|
||||
else
|
||||
bk_color = c.booking_status
|
||||
end
|
||||
else
|
||||
bk_color = c.booking_status
|
||||
end
|
||||
%>
|
||||
<%= link_to foodcourt_app_order_by_booking_path(booking_id: c.booking_id, active: 'completed'), class: 'item-card' do %>
|
||||
<div class="card <%= bk_color %> text-white" data-id ="<%= c.booking_id %>">
|
||||
<div class="card-block">
|
||||
<%= c.contact_no %><span style="font-size:12px;float:right;line-height:inherit;"> <%= c.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span><br>
|
||||
<%= c.orders.first.try(:order_id) %><span style="font-size:12px;float:right;line-height:inherit;">competed</span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if !@booking.nil?%>
|
||||
<div class="col-md-4 col-lg-4 col-sm-12 h-100 d-flex flex-column m-l--15">
|
||||
<div class="col-md-5 col-lg-5 col-sm-12 h-100 d-flex flex-column m-l--15" style="padding-right: 15px">
|
||||
<span id="sale_id" style="display:none"><%= @booking.sale_id %></span>
|
||||
<div class="card h-100" style="margin-bottom: 10px !important">
|
||||
<div class="card-header" style="padding: 0.12rem 0.25rem">
|
||||
@@ -111,7 +202,7 @@
|
||||
<span class="font-14 float-left d-inline"><b>Booking</b> - <%=@booking.booking_id%></span>
|
||||
<span class="font-14 float-right d-inline"><b>Order No</b> - <%=@booking.order_id%></span>
|
||||
</div>
|
||||
<div class="card-text h-100" id="foodcourt-order-slimscroll" style="overflow-y: auto">
|
||||
<div class="card-text h-100" id="foodcourt-table-slimscroll" style="overflow-y: auto">
|
||||
<table class="table table-striped summary-items fixed-header">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -164,20 +255,185 @@
|
||||
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total"><%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary action-btn create col-md-12" id="done_order" style="margin: 10px 0 -2px 12px; width: 95%; font-size: 1.3rem">
|
||||
DONE
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="col-md-1 col-lg-1 col-sm-12 h-100 d-flex flex-column" style="padding-right: 10px;">
|
||||
|
||||
<% if @pending %>
|
||||
<div class="col-md-5 col-lg-5 col-sm-12 h-100 d-flex flex-column m-l--15" style="padding-right: 15px">
|
||||
<% if @status == 'sale' %>
|
||||
<span id="sale_id" style="display:none"><%= @pending.try(:sale_id) %></span>
|
||||
<% elsif @status == 'order' %>
|
||||
<span id="sale_id" style="display:none"><%= @pending.try(:booking_id) %></span>
|
||||
<% end %>
|
||||
<div class="card" style="height: 100%; margin-bottom: 10px;">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<strong id="order-title">INVOICE DETAILS </strong>| Table - <%= @pending.dining_facility.name rescue "" %>
|
||||
</div>
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<% if @status == 'sale' || @pending.try(:sale_status) == 'completed' || @pending.try(:sale_status) == 'void' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
Receipt No:
|
||||
<span id="receipt_no">
|
||||
<%= @pending.receipt_no rescue '' %>
|
||||
</span>
|
||||
</div>
|
||||
<% else%>
|
||||
<!-- <input type="hidden" id="save_order_id" value="<%#=@bookings.booking_orders[0].order_id%>"> -->
|
||||
<div class="col-lg-8 col-md-8 col-sm-8">
|
||||
Order No: <span id="receipt_no">
|
||||
<%= @pending.booking_orders.first.order_id rescue '' %></span>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
<% if @status == 'sale' || @pending.try(:sale_status) == 'completed' || @pending.try(:sale_status) == 'void' %>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||
Date: <span id="receipt_date"><%= @pending.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% else%>
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 text-right">
|
||||
Date: <span id="receipt_date"><%= @pending.orders.first.created_at.strftime("%I:%M %p") rescue '-'%> </span>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="row customer_detail p-l-5 p-r-5">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<% if @status == 'sale' %>
|
||||
Customer: <%= @pending.customer.name rescue "-" %>
|
||||
<% else%>
|
||||
Customer: <%= @pending.orders.first.customer.name rescue "-" %>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-block d-flex flex-column h-100">
|
||||
<div class="card-text h-100" id="foodcourt-table-slimscroll" style="overflow-y: auto">
|
||||
<table class="table table-striped fixed-header" id="order-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="item-name">Items</th>
|
||||
<th class="item-attr">QTY</th>
|
||||
<th class="item-attr">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @status == 'sale' %>
|
||||
<% sub_total = 0
|
||||
@pending.sale_items.each do |sale_item|
|
||||
sub_total = sub_total + sale_item.price %>
|
||||
<tr>
|
||||
<td class='item-name'><%= sale_item.product_name %></td>
|
||||
<td class='item-attr'><%= sale_item.qty %></td>
|
||||
<td class='item-attr'><%= sale_item.price %></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<% sub_total = 0
|
||||
total = 0
|
||||
@pending.order_items.each do |order_item|
|
||||
total = order_item.qty * order_item.price
|
||||
sub_total = sub_total + total %>
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= total %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<% if @status == 'sale' %>
|
||||
<tr>
|
||||
<%if @pending.discount_type == 'member_discount'%>
|
||||
<td class="charges-name"><strong>Member Discount:</strong></td>
|
||||
<%else%>
|
||||
<td class="charges-name"><strong>Discount:</strong></td>
|
||||
<%end%>
|
||||
<td class="item-attr"><strong id="order-discount">(<%= @sale.total_discount rescue 0%>)</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Tax:</strong></td>
|
||||
<td class="item-attr"><strong id="order-Tax"><%= @sale.total_tax rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||
<td class="item-attr"><strong id="order-round-adj"><%= @sale.rounding_adjustment rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-grand-total"><%= @sale.grand_total rescue 0%></strong></td>
|
||||
</tr>
|
||||
<tr class="rebate_amount"></tr>
|
||||
<% else%>
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<% end%>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if @pending || @booking %>
|
||||
<div class="col-md-1 col-lg-1 col-sm-12 h-100 d-flex flex-column" style="padding-right: 5px; margin-left: -5px;">
|
||||
<% else %>
|
||||
<div class="col-md-2 col-lg-2 col-sm-12 h-100 d-flex flex-column" style="padding: 0 15px 0 5px;">
|
||||
<% end %>
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
<% if !@booking.nil?%>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% if @booking && @booking.booking_status == 'assign' %>
|
||||
<button type="button" class="btn btn-primary btn-block waves-effect create" id="done_order">
|
||||
DONE
|
||||
</button>
|
||||
<% end %>
|
||||
<% if @booking && @booking.booking_status != 'void' %>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void </a>
|
||||
<% end %>
|
||||
|
||||
<!-- pending order button list -->
|
||||
<% if @pending && params[:active].nil? %>
|
||||
|
||||
<% if current_user.role != "waiter" || @status != "sale"%>
|
||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Update Order</button>
|
||||
<%end%>
|
||||
|
||||
<% if current_user.role != "waiter" && @status != "order"%>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<%end%>
|
||||
|
||||
<% if @status != "sale"%>
|
||||
<!-- <button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button> -->
|
||||
<% order_id = @pending.try(:orders).try(:first).try(:order_id) if @status == 'order' %>
|
||||
<%= link_to 'Req.Bill', "/foodcourt/food_court/#{order_id}/request_bill", class: 'btn btn-block bg-blue waves-effect' %>
|
||||
<%end%>
|
||||
|
||||
<% elsif @pending && params[:active] == 'completed' %>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<% if @pending.sale_status != 'void' && @pending.sale_status != 'waste' && @pending.sale_status != 'spoile' %>
|
||||
<% if current_user.role == "cashier" %>
|
||||
<% if @pending.payment_status != 'foc' %>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<% end %>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
|
||||
<% else %>
|
||||
<% if @pending.payment_status != 'foc' %>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" readonly= "<%= (can? :overall_void, :void)? 'true': 'false' %>" > Void </button>
|
||||
<% end %>
|
||||
<button type="button" id="reprint" class="btn bg-blue btn-block">Re.Print</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -239,6 +495,33 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
$('#pay').on('click', function () {
|
||||
var cashier_type = 'food_court';
|
||||
var sale_id = $('#sale_id').text();
|
||||
window.location.href = '/foodcourt/sale/' + sale_id + "/"+cashier_type+"/payment";
|
||||
});
|
||||
|
||||
$('#addorder').on('click', function () {
|
||||
var status = "<%= @status %>"
|
||||
if (status == 'sale'){
|
||||
var table_id = "<%= @pending.try(:bookings).try(:first).try(:dining_facility).try(:id) %>"
|
||||
var booking_id = "<%= @pending.try(:bookings).try(:first).try(:id) %>"
|
||||
}
|
||||
else {
|
||||
var table_id = "<%= @pending.try(:dining_facility).try(:id) %>";
|
||||
var booking_id = "<%= @pending.try(:booking_id) %>";
|
||||
var order_id = "<%= @pending.try(:orders).try(:first).try(:order_id) %>";
|
||||
}
|
||||
|
||||
var sale_id = $("#sale_id").text();
|
||||
if (table_id) {
|
||||
window.location.href = '/foodcourt/food_court/modify_order/' + table_id + "/"+sale_id +'?update=true';
|
||||
}else{
|
||||
window.location.href = '/foodcourt/food_court/modify_order/'+ booking_id+"/" +sale_id +'?update=true&order_id="'+order_id+'"'
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#back').on('click', function () {
|
||||
window.location.href ="<%=foodcourt_food_court_path %>";
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<div class="row clearfix h-100">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 d-flex flex-column h-100">
|
||||
<div class="card h-100">
|
||||
<div class="card h-100" style="margin-bottom: 15px">
|
||||
<div class="card-header m-l-5 m-r-5">
|
||||
<div id="order-title">
|
||||
<div class="row p-l-5 p-r-5">
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<div class="card-block m-l-5 m-r-5 m-t--10 d-flex flex-column h-100">
|
||||
<div class="card-title">
|
||||
<div id="table-details" class="card-text">
|
||||
<div class="card-text">
|
||||
<table class="table" id="append-table">
|
||||
<tr>
|
||||
<!-- <tr> -->
|
||||
@@ -66,7 +66,7 @@
|
||||
<div id="foodcourt-slimscroll" class="h-100">
|
||||
<!-- <div id="table-details" class="card-text" style="min-height:400px; max-height:400px; overflow-x:scroll"> -->
|
||||
<div id="table-details" class="card-text m-t--10" >
|
||||
<table class="table" id="append-table">
|
||||
<table class="table summary-items" id="append-table">
|
||||
<tbody>
|
||||
<% sub_total = 0
|
||||
count = 0
|
||||
@@ -159,12 +159,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 d-flex flex-column h-100">
|
||||
<div class="card h-100">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 d-flex flex-column h-100" style="padding-right: 10px;">
|
||||
<div class="card h-100" style="margin-bottom: 15px">
|
||||
<div class="card-header" style="margin-bottom: 20%;">
|
||||
<div class="row m-l-5 m-r-5 m-t-20" style="padding-bottom: 14px;">
|
||||
<div class="col-md-8"><strong class='amount_balance' style="font-size: 30px">Amount Due: <% if !@sale_payment.nil? %>( Credit )<% end %></strong></div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-4 text-right">
|
||||
<strong>
|
||||
<span id="grand_total" class="hidden">
|
||||
<% if @sale_payment.nil? %>
|
||||
@@ -196,6 +196,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||
<%= link_to '/foodcourt/app_orders', class: 'btn btn-block btn-default waves-effect', style: "padding-top: 0;" do%>
|
||||
<i class="material-icons">reply</i>
|
||||
BACK
|
||||
<% end %>
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
|
||||
Refresh
|
||||
</button>
|
||||
@@ -444,7 +448,7 @@
|
||||
<div id="sxModal-Content">
|
||||
<h3>Card Tap</h3>
|
||||
</div>
|
||||
<div class="m-r-20" align="right">
|
||||
<div style="position: absolute; bottom: 0; margin-left: 45%; margin-bottom: 60px;">
|
||||
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -254,14 +254,29 @@
|
||||
$('.close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/foodcourt/shift/cashier/close';
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: "Are you sure you want to close cashier?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
html: true
|
||||
}, function() {
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
var count = ''
|
||||
var text = ''
|
||||
$.ajax({
|
||||
url: '/foodcourt/current_shift_order_count',
|
||||
method: 'get',
|
||||
success: function(data) {
|
||||
count = JSON.stringify(data)
|
||||
console.log(count)
|
||||
if (count > 0) {
|
||||
text = "<h5><span style=\"color: #CC0000\"> We have "+count+" pending orders and sales</span> </h5>.<br>Are you sure you want to close cashier? ";
|
||||
}else{
|
||||
text = "Are you sure you want to close cashier?";
|
||||
}
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: text,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
html: true
|
||||
}, function() {
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -38,14 +38,9 @@
|
||||
<!-- #END# Overlay For Sidebars -->
|
||||
<%= render 'layouts/header' %>
|
||||
<section>
|
||||
<%food_court = Lookup.find_by_lookup_type_and_value("food_court", "1")%>
|
||||
<% if food_court && current_user.role=='cashier'%>
|
||||
<%= render 'layouts/foodcourt_left_sidebar' %>
|
||||
<% else %>
|
||||
<%= render 'layouts/left_sidebar' %>
|
||||
<%end%>
|
||||
|
||||
<%= render 'layouts/right_sidebar' %>
|
||||
<%= render 'layouts/left_sidebar' %>
|
||||
|
||||
<%= render 'layouts/right_sidebar' %>
|
||||
</section>
|
||||
|
||||
<!-- Main Content -->
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<!-- #END# Overlay For Sidebars -->
|
||||
<%= render 'layouts/header' %>
|
||||
<section>
|
||||
<%= render 'layouts/foodcourt_left_sidebar' %>
|
||||
<%= render 'layouts/left_sidebar' %>
|
||||
<%= render 'layouts/right_sidebar' %>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -441,7 +441,7 @@
|
||||
<h4 class="modal-title" style="color:#fff;" id="set_name"></h4>
|
||||
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#fff;">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="set-menu-item-slimscroll" data-height="50">
|
||||
<div class="modal-body" data-height="50">
|
||||
<div class="row set-item">
|
||||
<div class="col-md-4">
|
||||
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
|
||||
@@ -698,6 +698,10 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get "food_court" => "food_court#index"
|
||||
get "app_orders" => "orders#app_orders",:as => "app_order_by_booking"
|
||||
post ':booking_id/:order_id/completed' => "orders#completed", :defaults => { :format => 'json' }
|
||||
get "food_court/modify_order/:id/:sale_id" => "orders#modify_order"
|
||||
post '/food_court/update_modify_order' => "orders#update_modify_order", :defaults => { :format => 'json' }
|
||||
get '/food_court/:order_id/request_bill' => 'orders#request_bill', :as => 'food_court_request_bill'
|
||||
get 'current_shift_order_count' => 'orders#current_shift_order_count', :as => 'food_court_order_count'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user