Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into ui_ux_changes

This commit is contained in:
phyusin
2018-05-11 13:06:13 +06:30
65 changed files with 2677 additions and 1366 deletions

View File

@@ -1,7 +1,9 @@
$(function() {
var role = $('#role').val();
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
//click menu sidebar menu category
$(".product").on("click", function(){
var url = $(this).attr('data-ref');
@@ -62,8 +64,8 @@ $(function() {
+JSON.stringify(item_attributes)+"' data-id = '"
+JSON.stringify(item_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(product[field].options)+"'data-opt = '"
+JSON.stringify(product[field].options)+"' data-item-sets = '"
+JSON.stringify(item_attributes)+"' data-image='"+image_path+"' data-toggle='modal' data-target='.sx_item_detailModal'>"
+"<i class='fa fa-bars material-icons'>"
+'view_list</i>'
@@ -76,8 +78,8 @@ $(function() {
+ 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(menu_items[field].options) +"' data-opt = '"
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"'>"
+ JSON.stringify(product[field].options) +"' data-opt = '"
+ JSON.stringify(product[field].options) +"' data-image='"+image_path+"'>"
// +"<div class='card-block custom-card-block'>"
// +"<img id='logo' height='125px' src='"+image_path+"'>"
@@ -96,162 +98,78 @@ $(function() {
}
//end show list function
//click menu sidebar menu category
$(document).on('click', '.menu_category', function(event){
event.preventDefault();
$(document).on('click', '.menu_category', function(e){
e.preventDefault();
$('.sub_category_list').addClass("hidden");
var menu_id = $(this).attr("data-id");
var url = "get_menu_category/"+menu_id;
show_menu_item_list(url);
var url = "get_menu_category/"+menu_id;
show_menu_item_list(url,menu_id);
var sub_id = $(this).attr("data-sub-id");
if (sub_id == "true") {
var sub_url = "get_menu_sub_category/"+menu_id;
sub_category = $(this).find('.sub_category_list');
show_sub_category_list(sub_url,sub_category);
sub_category = $(this).siblings('.sub_category_list');
show_sub_category_list(sub_url,sub_category,menu_id);
}
});
});
//End menu category Click
//click menu sidebar menu category
$(document).on('click', '.menu_sub_category', function(event){
// event.preventDefault();
// $(".menu_sub_category").on("click", function(){
$('.sub_category_list').addClass("hidden");
var menu_id = $(this).attr("data-id");
console.log(menu_id);
var url = "get_menu_category/"+menu_id;
show_menu_item_list(url,menu_id);
});
//End menu category Click
//show menu item list when click menu category
function show_menu_item_list(url_item){
function show_menu_item_list(url_item,menu_id){
var menu_list = $('.menu_items_list');
menu_list.empty();
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
url_item = '../../../addorders/'+url_item;
}if(modify_order == -1 && type != -1){
url_item = 'addorders/'+url_item;
}
if (type ==-1 && modify_order == -1){
url_item = url_item
}
//Start Ajax
$.ajax({
type: "GET",
url: url_item,
data: {},
dataType: "json",
success: function(data) {
var menu_items_list = $('.menu_items_list');
menu_items_list.empty();
menu_items = data.menu_items;
for(var field in menu_items) {
if (menu_items[field].is_sub_item == false) {
instances = menu_items[field].instances ;
if (!instances.length > 0) {
swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
}
if (instances.length > 0) {
qty = 1;
options = [];
price = 0;
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
fa_plus = '';
add = '';
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;
$(instances).each(function(i){
if (instances[i].is_default == true) {
price = parseFloat(instances[i].price).toFixed(2);
}else{
price = 0;
}
});
is_available = menu_items[field].is_available ;
is_on_promotion = 0;
item_attributes = menu_items[field].attributes;
promotion_price = menu_items[field].promotion_price;
}else{
fa_plus = 'material-icons';
add = 'view_list'
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) {
code = instances[i].code;
name = instances[i].name;
price = parseFloat(instances[i].price).toFixed(2);
is_available = instances[i].is_available ;
is_on_promotion = instances[i].is_on_promotion;
item_attributes = instances[i].values;
promotion_price = instances[i].promotion_price;
code = instances[i].code;
}
});
}
if (menu_items[field].image) {
if (modify_order) {
image_path = "../../"+menu_items[field].image;
}else{
image_path = menu_items[field].image;
}
}else{
if (modify_order) {
image_path = "../../image/logo.png";
}else{
image_path = "image/logo.png";
}
}
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
+"<div class='col-md-3 "+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+"' >"
+"<i class='fa "+fa_plus+" '>"
+add+ '</i>'
+'</div>'
+'</div>'
+"<div class='"+add_icon+" p-t-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-block custom-card-block'>"
// +"<img id='logo' height='' src='"+image_path+"'>"
// +"</div>"
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
+'<span>'+ price +'</span>'
+'</div>'
+'</div>';
$('.menu_items_list').append(row);
}
//end instances in menu-items alest 1 instance
menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
for(var i in menus) {
var categories = menus[i]["categories"];
for(var ii in categories) {
if (categories[ii]["id"] == menu_id) {
var menu_items = categories[ii]["items"];
show_menu_list(menu_items);
}
//end is_sub_item false
}
}
});
//end Ajax
}else{
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
url_item = '../../../addorders/'+url_item;
}if(modify_order == -1 && type != -1){
url_item = 'addorders/'+url_item;
}
if (type ==-1 && modify_order == -1){
url_item = url_item
}
//Start Ajax
$.ajax({
type: "GET",
url: url_item,
data: {},
dataType: "json",
success: function(data) {
var menu_items_list = $('.menu_items_list');
menu_items_list.empty();
menu_items = data.menu_items;
show_menu_list(menu_items);
}
});
//end Ajax
}
}
//end show list function
//click item row for item set
@@ -269,60 +187,106 @@ $(function() {
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){
if (type != -1 && modify_order != -1) {
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) {
url = '../../../addorders/get_item_instance/'+value[i]["id"];
console.log("ssssssss")
}
if(modify_order == -1 && type != -1){
if (value[i]["id"] == result[v]["id"]) {
console.log("ssssssss")
url = 'addorders/get_item_instance/'+value[i]["id"] ;
console.log("aaaaaa")
}
if (type ==-1 && modify_order == -1){
url = '../addorders/get_item_instance/'+value[i]["id"];
console.log("cccccccccc")
}
$.ajax({
type: "GET",
url: url,
// data: {id:value[i]},
success:function(result){
row = '<div class="col-md-4 " >'
+"<div class='card custom-card instance_box' data-name='"+result["name"]
+"' data-code='"+result["code"]
+"' data-price='"+result["price"]
+"' data-option='"+JSON.stringify(result["options"])
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
+"' data-parent-code='"+instances[0]['code']
+"' data-parent-id='"+instances[0]['id']
+"' data-sub-item='true"
+"'>"
+'<div class="custom-card-head card-head" style="line-height:14px;">'
+'<span class="">'+result["name"]+'</span>'
row = '<div class="col-md-4 " >'
+"<div class='card custom-card instance_box' data-name='"+result[v]["name"]
+"' data-code='"+result[v]["code"]
+"' data-price='"+result[v]["price"]
+"' data-option='"+JSON.stringify(items[iii]["options"])
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
+"' data-parent-code='"+instances[0]['code']
+"' data-parent-id='"+instances[0]['id']
+"' data-sub-item='true"
+"'>"
+'<div class="custom-card-head card-head" style="line-height:14px;">'
+'<span class="">'+result[v]["name"]+'</span>'
+'</div>'
+'<div class="card-block custom-card-block">'
+'<img id="" src="/image/logo.png" height="40px">'
+' <small style="float:" id="instance_option"></small>'
+'</div>'
+'<div class="card-footer custom-card-footer">'
+' <span>'+result[v]["price"]+'</span>'
// +' <small style="float:right" id="instance_option"></small>'
+'</div>'
+'</div>'
+'<div class="card-block custom-card-block">'
+'<img id="" src="/image/logo.png" height="40px">'
+' <small style="float:" id="instance_option"></small>'
+'</div>'
+'<div class="card-footer custom-card-footer">'
+' <span>'+result["price"]+'</span>'
// +' <small style="float:right" id="instance_option"></small>'
+'</div>'
+'</div>'
+' </div>'
$(".instance-list").append(row);
+' </div>'
$(".instance-list").append(row);
}
}
}
}
});
}
}else{
type = window.location.href.indexOf("quick_service");
modify_order = window.location.href.indexOf("modify_order");
if (type != -1 && modify_order != -1) {
url = '../../../addorders/get_item_instance/'+value[i]["id"];
console.log("ssssssss")
}
if(modify_order == -1 && type != -1){
url = 'addorders/get_item_instance/'+value[i]["id"] ;
console.log("aaaaaa")
}
if (type ==-1 && modify_order == -1){
url = '../addorders/get_item_instance/'+value[i]["id"];
console.log("cccccccccc")
}
$.ajax({
type: "GET",
url: url,
// data: {id:value[i]},
success:function(result){
row = '<div class="col-md-4 " >'
+"<div class='card custom-card instance_box' data-name='"+result["name"]
+"' data-code='"+result["code"]
+"' data-price='"+result["price"]
+"' data-option='"+JSON.stringify(result["options"])
+"' data-min-qty='"+item_sets[field]["min_selectable_qty"]
+"' data-max-qty='"+item_sets[field]["max_selectable_qty"]
+"' data-parent-code='"+instances[0]['code']
+"' data-parent-id='"+instances[0]['id']
+"' data-sub-item='true"
+"'>"
+'<div class="custom-card-head card-head" style="line-height:14px;">'
+'<span class="">'+result["name"]+'</span>'
+'</div>'
+'<div class="card-block custom-card-block">'
+'<img id="" src="/image/logo.png" height="40px">'
+' <small style="float:" id="instance_option"></small>'
+'</div>'
+'<div class="card-footer custom-card-footer">'
+' <span>'+result["price"]+'</span>'
// +' <small style="float:right" id="instance_option"></small>'
+'</div>'
+'</div>'
+' </div>'
$(".instance-list").append(row);
}
});
}
});
}
@@ -442,10 +406,8 @@ $(function() {
$(document).on('click', '#remove_set', function(event){
code = $(this).parent().parent('.selected-set').attr('data-code');
instance = $(".selected-instance");
console.log(code)
$(instance).each(function(i){
if ($(instance[i]).attr('data-code')==code){
console.log($(instance[i]))
$(instance[i]).removeClass("selected-instance")
}
});
@@ -496,7 +458,6 @@ $(function() {
var rowCount = $('.summary-items tbody tr').length+1;
var set_option = []
$(items).each(function(i){
console.log($(items[0]).attr('data-name'))
code = $(items[i]).attr('data-code');
name = $(items[i]).attr('data-name');
price = $(items[i]).attr('data-price');
@@ -754,7 +715,6 @@ $(function() {
attribute_arr = get_selected_attributes('selected-attribute');
option_arr = get_selected_attributes('selected-option');
console.log(option_arr)
if (item_row.length>0) {
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
@@ -990,7 +950,6 @@ $(function() {
dataType: "json",
success:function(result){
if (result.status) {
console.log(result)
if (result.data == null){
swal({
title: "Please Open Shift !",
@@ -1205,7 +1164,6 @@ $(function() {
$(".keypress_qty").on('keyup change', function (){
// $('.keypress_qty').keyup(function(e){
id = $(this).attr('id');
value = $(this).val();
@@ -1243,54 +1201,68 @@ $(function() {
var menu_id = $(this).attr("data-id");
var url = "get_menu_sub_category/"+menu_id;
sub_category = $(this).find('.sub_category_list');
show_sub_category_list(url,sub_category);
show_sub_category_list(url,sub_category,menu_id);
});
//End menu category Click
//show menu item list when click menu category
function show_sub_category_list(url,sub_category){
function show_sub_category_list(url,sub_category,menu_id){
if (type != -1 && modify_order != -1) {
var url = "../../../addorders/"+url;
}if(modify_order== -1 && type != -1){
var url = 'addorders/'+url;
}
if (type ==-1 && modify_order == -1){
var url = url;
}
var sub_category_list = $('.sub_category_list');
sub_category_list.empty();
var menu_list = $('.sub_category_list');
menu_list.empty();
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
var sub_category_list = $('.sub_category_list');
sub_category_list.empty();
data = data.sub_category;
if (data.length>0) {
// if ((sub_category.hasClass('hidden'))) {
menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
for(var j in menus) {
var categories = menus[j]["categories"];
for(var ii in categories) {
if (menu_id == categories[ii]["parent_id"]) {
$(sub_category).removeClass('hidden');
// }else{
// $(sub_category).addClass('hidden');
// }
for(var i in data) {
row = '<li class="menu_category fadeInTop" data-id="'+data[i].id+'">'
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
+'</li>' ;
$(sub_category).append(row);
//end is_sub_item false
}
row = '<li class="menu_sub_category fadeInTop" data-id="'+categories[ii].id+'">'
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ categories[ii].name+'</a>'
+'</li>' ;
$(sub_category).append(row);
}
}
}
});
//end Ajax
}else{
if (type != -1 && modify_order != -1) {
var url = "../../../addorders/"+url;
}if(modify_order== -1 && type != -1){
var url = 'addorders/'+url;
}
if (type ==-1 && modify_order == -1){
var url = url;
}
//Start Ajax
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
var sub_category_list = $('.sub_category_list');
sub_category_list.empty();
data = data.sub_category;
if (data.length > 0) {
// if ((sub_category.hasClass('hidden'))) {
$(sub_category).removeClass('hidden');
// }else{
// $(sub_category).addClass('hidden');
// }
for(var i in data) {
row = '<li class="menu_sub_category fadeInTop" data-id="'+data[i].id+'">'
+'<a class="nav-link" data-toggle="tab" href="" role="tab">'+ data[i].name+'</a>'
+'</li>' ;
$(sub_category).append(row);
//end is_sub_item false
}
}
}
});
//end Ajax
}
}
/* Get Item rows */
@@ -1378,5 +1350,119 @@ $(function() {
// price = $("#unit_price").text();
// $("#total_price").text(qty*price);
// });
function show_menu_list(menu_items) {
var menu_list = $('.menu_items_list');
menu_list.empty();
for(var field in menu_items) {
if (menu_items[field].is_sub_item == false) {
instances = menu_items[field].instances ;
if (!instances.length > 0) {
swal("Hello Please Check!","Does not have instance item in this menu items ("+ menu_items[field].name+")","warning");
}
if (instances.length > 0) {
qty = 1;
options = [];
price = 0;
if (JSON.stringify(menu_items[field].item_sets)!='[]') {
fa_plus = '';
add = '';
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;
$(instances).each(function(i){
if (instances[i].is_default == true) {
price = parseFloat(instances[i].price).toFixed(2);
}else{
price = 0;
}
});
is_available = menu_items[field].is_available ;
is_on_promotion = 0;
item_attributes = menu_items[field].attributes;
promotion_price = menu_items[field].promotion_price;
}else{
fa_plus = 'material-icons';
add = 'view_list'
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) {
code = instances[i].code;
name = instances[i].name;
price = parseFloat(instances[i].price).toFixed(2);
is_available = instances[i].is_available ;
is_on_promotion = instances[i].is_on_promotion;
item_attributes = instances[i].values;
promotion_price = instances[i].promotion_price;
code = instances[i].code;
}
});
}
if (menu_items[field].image) {
if (modify_order) {
image_path = "../../"+menu_items[field].image;
}else{
image_path = menu_items[field].image;
}
}else{
if (modify_order) {
image_path = "../../image/logo.png";
}else{
image_path = "image/logo.png";
}
}
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
+'<div class="col-md-9">'+ menu_items[field].name +'</div>'
+"<div class='col-md-3 "+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+"' >"
+"<i class='fa "+fa_plus+" '>"
+add+ '</i>'
+'</div>'
+'</div>'
+"<div class='"+add_icon+" p-t-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-block custom-card-block'>"
// +"<img id='logo' height='' src='"+image_path+"'>"
// +"</div>"
+'<div class="card-footer custom-card-footer" style="opacity:0.7">'
+'<span>'+ price +'</span>'
+'</div>'
+'</div>';
$('.menu_items_list').append(row);
}
//end instances in menu-items alest 1 instance
}
//end is_sub_item false
}
}
});

View File

@@ -18,22 +18,30 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
});
// alert(order_lists);
swal({
html: true,
title: 'Information',
target: document.getElementById('notify_new_order'),
text: "You have new orders. <br/>"+
"Are you accept or reject for these orders <b>"+order_lists+"</b>?",
type: 'success',
timer: 1000,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
},function(isConfirm){
if(isConfirm){
swal.close();
}
});
// swal({
// title: 'Information',
// target: document.getElementById("notify_new_order"),
// text: "You have new orders <br/>"+
// "Are you accept or reject for these orders <b>"+order_lists+"</b>?",
// type: 'success',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function (isConfirm) {
// if(isConfirm){
// swal.close();
// }
// });
$("#notify_new_order_lists").text(order_lists);
$("#notify_new_order").on('show.bs.modal', function(e){
$("#notify_order_send_to_kitchen").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
}).on('shown.bs.modal', function(e){
$("#notify_new_order").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_new_order").modal("hide");
}).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -18,22 +18,30 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
});
// alert(order_lists);
swal({
html: true,
title: 'Information',
target: document.getElementById('notify_order_ready_to_delivery'),
text: "You have orders that are ready to deliver. <br/>"+
"Could you ready these orders <b>"+order_lists+"</b> to deliver?",
type: 'success',
timer: 1000,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
},function(isConfirm){
if(isConfirm){
swal.close();
}
});
// swal({
// title: 'Information',
// target: document.getElementById("notify_order_ready_to_delivery"),
// text: "You have orders that are ready to deliver <br/>"+
// "Could you ready these orders <b>"+order_lists+"</b> to deliver?",
// type: 'success',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function (isConfirm) {
// if(isConfirm){
// swal.close();
// }
// });
$("#notify_order_ready_to_delivery_lists").text(order_lists);
$("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_send_to_kitchen").modal('hide');
}).on('shown.bs.modal', function(e){
$("#notify_order_ready_to_delivery").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_order_ready_to_delivery").modal("hide");
}).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -18,22 +18,30 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
});
// alert(order_lists);
swal({
html: true,
title: 'Information',
target: document.getElementById('notify_order_send_to_kitchen'),
text: "You have to send order to kitchen. <br/>"+
"Could you send these orders <b>"+order_lists+"</b> to kitchen?",
type: 'success',
timer: 1000,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
},function(isConfirm){
if(isConfirm){
swal.close();
}
});
// swal({
// title: 'Information',
// target: document.getElementById("notify_order_send_to_kitchen"),
// text: "You have to send order to kitchen <br/>"+
// "Could you send these orders <b>"+order_lists+"</b> to kitchen?",
// type: 'success',
// html: true,
// closeOnConfirm: false,
// closeOnCancel: false,
// allowOutsideClick: false
// }, function (isConfirm) {
// if(isConfirm){
// swal.close();
// }
// });
$("#notify_order_send_to_kitchen_lists").text(order_lists);
$("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
$("#notify_new_order").modal('hide');
$("#notify_order_ready_to_delivery").modal('hide');
}).on('shown.bs.modal', function(e){
$("#notify_order_send_to_kitchen").focus();
}).on('hide.bs.modal', function (e) {
$("#notify_order_send_to_kitchen").modal("hide");
}).modal({show: true, keyboard: false, backdrop: false});
}
}
});

View File

@@ -17,7 +17,7 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
var rowCount = key+1;
var date = new Date(value.created_at);
var time = timeFormat(date);
var created_at = date.getFullYear() +'-'+ (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate()>10?date.getDate() : '0'+date.getDate());
var created_at = date.getFullYear() +'-'+ (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >=10?date.getDate() : '0'+date.getDate());
var delivery_type = "";
if(value.delivery_type == "service"){

View File

@@ -62,6 +62,7 @@ $(document).ready(function() {
railBorderRadius: '0',
touchScrollStep : 45
});
// $('.delete').click(function(){
// var method = $(this).attr('data-method');

View File

@@ -2,6 +2,9 @@
$(function() {
$("#discount").hide();
$(".expected_time").hide();
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
$(function() {
$('.first-1').click();
});
@@ -11,6 +14,9 @@ $(function() {
$(".nav-item").on("click", function(){
type = $(this).attr("data-type");
refreshDetailData();
$('#accepted').hide();
$('#cancel').hide();
$(".tbl_customer").hide();
if (type == "pending") {
$(".first-1").click();
$('#accepted').text("ACCEPT");
@@ -24,19 +30,23 @@ $(function() {
$('#accepted').text("READY TO DELIVERY");
$('#accepted').attr("data-value","delivery");
}else if(type == "completed"){
// $('#cancel').hide();
$(".fourth-1").click();
$('#accepted').text("PICK-UP");
$('#accepted').text("COMPLETE");
$('#accepted').attr("data-value","completed");
}
}else if(type == "processed"){
$(".fifth-1").click();
// $('#accepted').hide();
// $('#cancel').hide();
}
// console.log(type);
});
$("#accepted").on("click", function(){
if($(this).text().trim() == "ACCEPT"){
$("#status").text($(this).attr("data-value"));
var requested_time = $("#requested_date_time").text();
var requested_time = $("#requested_time").text();
$("#requested_order_time").text(requested_time);
showTimePicker(requested_time);
$("#waiting_timeModal").modal({show : true, backdrop: false, keyboard : false});
}else{
var status = $(this).attr("data-value");
@@ -48,38 +58,117 @@ $(function() {
});
$("#cancel").on("click", function(){
var status = $(this).attr("data-value");
var order_id = $('#order_id').text();
var callback = $('#callback_url').text();
var ref_no = $('#ref_no').text();
callback_url(callback,ref_no,order_id,status);
var order_status = $("#order_status").text();
$("#status").text($(this).attr("data-value"));
if(order_status!="new" && order_status!= "accepted" && order_status!="send_to_kitchen"){
$("#AccessCodeModal").modal({show: true, backdrop: false, keyboard: false});
}else{
$("#rejected_reasonModal").modal({show: true, backdrop: false, keyboard: false});
}
});
$("#save").on("click",function(){
$("#waiting_timeErr").text("");
$(".send_status").on("click",function(){
$("#reject_reasonErr").html("");
if($('#reject_reason').val() != ""){
var order_status = $("#order_status").text();
var status = $("#status").text();
var order_id = $('#order_id').text();
var callback = $('#callback_url').text();
var ref_no = $('#ref_no').text();
var reason = "";
var approved_code = $("#approved_code").text();
if(order_status == 'ready_to_delivery'){
reason = "VOID || " + $('#reject_reason').val();
}else{
reason = $('#reject_reason').val();
}
callback_url(callback,ref_no,order_id,status,"","","",reason,approved_code);
}else{
$("#reject_reasonErr").html("This is required field");
}
});
$(".timer_type").on("click",function(){
if($(this).hasClass("selected-item")){
$(this).removeClass("selected-item");
}else{
$(this).addClass("selected-item");
}
});
$(".time_interval").on("click",function(){
var type = '';
if($(".timer_type").hasClass("selected-item")){
type = 'after';
}
var minutes = $(this).attr("data-value");
// console.log(type);
// console.log($(this).attr("data-value"));
var status = $("#status").text();
var order_id = $('#order_id').text();
var ref_no = $('#ref_no').text();
var callback = $('#callback_url').text();
var requested_time = new Date($("#requested_date_time").text());
var date_time = requested_time.getFullYear()+'-'+(requested_time.getMonth() > 10? requested_time.getMonth() : '0'+ (requested_time.getMonth() + 1))+'-'+(requested_time.getDate()> 10? requested_time.getDate() : '0' + requested_time.getDate());
var waiting_time = new Date(date_time+' '+$("#waiting_time").val());
// requested_time.setHours(requested_time.getHours() - 1);
// var requested_time = new Date($("#requested_date_time").text());
// if(type == 'after'){
// requested_time.setMinutes(requested_time.getMinutes() + minutes);
// }else{
// requested_time.setMinutes(requested_time.getMinutes() - minutes);
// }
// console.log(requested_time);
// console.log(date_time);
if(waiting_time.getTime() < requested_time.getTime()){
var time_diff = (requested_time.getTime() - waiting_time.getTime());
var expected_time = (Math.floor(time_diff) / 1000) / 60;
}else{
var time_diff = (waiting_time.getTime() - requested_time.getTime());
var expected_time = (Math.floor(time_diff) / 1000) / 60;
// $("#waiting_time").val("");
// $("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
callback_url(callback,ref_no,order_id,status,type,minutes);
});
$(document).on('click','.access_number', function(event){
if(event.handled !== true) {
var original_value = $('#access_code').val();
var input_type = $(this).attr("data-type");
switch (input_type) {
case 'num':
var input_value = $(this).attr("data-value");
if (original_value){
$('#access_code').val(original_value + input_value);
}else{
$('#access_code').val(original_value + input_value);
}
break;
case 'ok':
var type = $(this).attr("data-action");
code = $('#access_code').val();
check_emp_access_code(code,type)
break;
case 'clr':
$('#access_code').val("");
break;
}
event.handled = true;
} else {
return false;
}
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
});
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
// createAccessCode(code);
$("#approved_code").text(code);
$('#AccessCodeModal').modal('hide');
$("#rejected_reasonModal").modal({show: true, backdrop: false, keyboard: false});
}else{
swal("Opps",result.message,"warning")
}
}
});
}
function customTableClick(){
$(".custom-table .custom-tr").on("click", function(){
$(".custom-tr").removeClass("tr-active");
@@ -96,6 +185,7 @@ function refreshDetailData(){
$("#sr_number").text("");
$("#delivery_info").text("");
$("#contact_info").text("");
$("#invoice_no").text("");
$('.summary-items').html("");
$('#sub_total').text("0.00");
$('#delivery_fee').text("0.00");
@@ -116,20 +206,31 @@ function show_order_detail(url,sr_no){
dataType: "json",
success: function(data) {
// console.log(data);
$(".tbl_customer").show();
if(data.status != "delivered"){
$('#accepted').show();
if(data.status != "ready_to_delivery" && data.status != "send_to_kitchen"){
$('#cancel').show();
}
}else{
$('#accepted').hide();
$('#cancel').hide();
}
var delivery = data["delivery"];
var items = data["order_items"];
var item_list = $('.summary-items');
var newDate = new Date(data.requested_time);
var time = timeFormat(newDate);
var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() > 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() > 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
// var requested_date = newDate.getFullYear() + '-' + (newDate.getMonth() >= 10? newDate.getMonth() : '0' + (newDate.getMonth() + 1)) +'-'+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +' '+time;
var requested_date = getOrderMonth(newDate.getMonth()) +' '+ (newDate.getDate() >= 10? newDate.getDate() : '0' + newDate.getDate()) +', '+newDate.getFullYear()+'('+getOrderDay(newDate.getDay())+')'+' '+time;
if((data.expected_waiting_time!=undefined) && (data.expected_waiting_time!=null)){
var expDate = new Date(data.expected_waiting_time);
var exptime = timeFormat(expDate);
var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() > 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() > 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
// var expDate = new Date(data.expected_waiting_time);
// var exptime = timeFormat(expDate);
// var expected_time = expDate.getFullYear() + '-' + (expDate.getMonth() >= 10? expDate.getMonth() : '0' + (expDate.getMonth() + 1)) +'-'+ (expDate.getDate() >= 10? expDate.getDate() : '0' + expDate.getDate()) +' '+exptime;
$('.expected_time').show();
$('#expected_time').text(expected_time? expected_time : '');
$('#expected_time').text(data.expected_waiting_time? data.expected_waiting_time : '');
}else{
$('.expected_time').hide();
$('#expected_time').text('');
@@ -160,7 +261,8 @@ function show_order_detail(url,sr_no){
$("#discount").show();
}
$('#requested_date_time').text(requested_date);
//customer info detail
// $('#requested_date_time').text(requested_date);
$('#sub_total').text(data.total_amount);
$('#delivery_fee').text((parseFloat(delivery.delivery_fee) > 0)? delivery.delivery_fee : '0.0');
$('#total_charges').text((parseFloat(data.convenience_charge) > 0)? data.convenience_charge : '0.0');
@@ -184,6 +286,7 @@ function show_order_detail(url,sr_no){
$('#callback_url').text(data.callback_url);
$('#order_id').text(data.order_reservation_id);
$("#trans_ref").text(data.transaction_ref);
if(delivery.delivery_type == "service"){
$("#delivery_info").text("(DELIVERY)");
}else if(delivery.delivery_type == "pick_up"){
@@ -197,11 +300,22 @@ function show_order_detail(url,sr_no){
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
$("#order_remark").text(data.reservation_remark);
}
$("#sr_number").text("NO."+sr_no);
if (data["receipt_no"]) {
$("#contact_info").text(data["receipt_no"]);
if(data.remark!=null && data.remark!=""){
var doemal_remark = data.remark.split("||");
var remark = doemal_remark[0] +", "+ doemal_remark[1];
$("#remark").text(remark);
}else{
$("#contact_info").text(data["order_reservation_id"]);
$("#remark").text("");
}
//no and order id info
$("#sr_number").text("NO."+sr_no);
$("#order_status").text(data.status);
if (data["receipt_no"]) {
$("#invoice_no").text(data["receipt_no"]);
}else{
$("#invoice_no").text(data["order_reservation_id"]);
}
}
@@ -211,40 +325,42 @@ function show_order_detail(url,sr_no){
//end Ajax
}
function showTimePicker(requested_time){
// var date = new Date(requested_time);
// var time = timeFormat(date);
// console.log(time);
$('.timepicker').bootstrapMaterialDatePicker({
format: 'HH:mm',
useSeconds: false,
clearButton: true,
date: false
});
}
function callback_url(callback,ref_no,order_id,status,time,exptime){
function callback_url(callback,ref_no,order_id,status,min_type,time,exptime,reason,approved_code){
var url = 'order_reservation/update';
var post_url = "order_reservation/send_status";
var waiting_time = "";
var expected_time = "";
var type = "";
var reject_reason = "";
var access_code = "";
if(time!=undefined && time!=""){
waiting_time = time;
}
var expected_time = "";
if(exptime!=undefined && exptime!=""){
expected_time = exptime;
}
if(min_type!=undefined && min_type!=""){
type = min_type;
}
if(reason!=undefined && reason!=""){
reject_reason = reason;
}
if(approved_code!=undefined && approved_code!=""){
access_code = approved_code;
}
$.ajax({
type: "POST",
url: post_url,
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time},
data: {url: callback, ref_no: ref_no, status: status, waiting_time: waiting_time, min_type: type, reason: reject_reason},
dataType: "json",
success: function(data) {
if(data.status){
$.ajax({
type: "POST",
url: url,
data: {'order_id': order_id, 'status': status, 'expected_time' : expected_time},
data: {order_id: order_id, status: status, min_type: min_type, expected_time: waiting_time, remark: reason, access_code: access_code},
dataType: "json",
success: function(data) {
if (data.status) {
@@ -293,7 +409,14 @@ function showNewOrder(order_reservation){
if((order_reservation!=undefined) && (order_reservation!=null) && (order_reservation!="")){
var date = new Date(order_reservation.requested_time);
var time = timeFormat(date);
var requested_date = date.getFullYear() + '-' + (date.getMonth() > 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() > 10? date.getDate() : '0' + date.getDate()) +' '+time;
var requested_date = date.getFullYear() + '-' + (date.getMonth() >= 10? date.getMonth() : '0' + (date.getMonth() + 1)) +'-'+ (date.getDate() >= 10? date.getDate() : '0' + date.getDate()) +' '+time;
//audio play
var audio = new Audio('/beep.wav'); // define your audio
// setTimeout(function(){
// audio.loop = true;
audio.play();
// },10000);
swal({
html: true,
title: 'Information',
@@ -304,4 +427,14 @@ function showNewOrder(order_reservation){
allowOutsideClick: false
});
}
}
function getOrderMonth(month){
var MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"];
return MONTHS[month];
}
function getOrderDay(day){
var DAYS = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
return DAYS[day];
}

View File

@@ -453,6 +453,10 @@ iframe {
width: 150%;
height: 100%;
}
#receipt_pdf {
height: 400px;
}
/* End iframe */
/* section class for webview */

View File

@@ -6,23 +6,27 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
def check_customer
customer_id = 0
status = false
if !params[:name]
render :json => { :status => false, :message => "name is required!" }
elsif !params[:email]
render :json => { :status => false, :message => "email is required!" }
elsif !params[:membership_id]
render :json => { :status => false, :message => "membership_id is required!" }
end
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
if !check_customer.nil?
customer_id = check_customer.customer_id
else
customer = Customer.addCustomer(params)
customer_id = customer.id
status = true
end
render :json => { :status => true, :data => { :customer_id => customer_id} }
if status
check_customer = Customer.find_by_email_and_membership_id(params[:email],params[:membership_id])
if !check_customer.nil?
customer_id = check_customer.customer_id
else
customer = Customer.addCustomer(params)
customer_id = customer.id
end
render :json => { :status => true, :data => { :customer_id => customer_id} }
end
end
def create
@@ -71,4 +75,42 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
end
end
end
def update_status
order_reservation_id = params[:id]
status = params[:status]
remark = params[:remark]
if params[:status] && params[:remark]
reason = status +"||"+remark
order_reservation = OrderReservation.find(order_reservation_id)
if status == 'REMOVE'
if order_reservation.status == "new" || order_reservation.status == "accepted"
OrderReservation.update_order_reservation(order_reservation_id, nil, "rejected",nil,remark)
result = {:status=> true, :message => "rejected" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't remove!" }
end
elsif status == 'FOC'
if order_reservation.status == "new" || order_reservation.status == "accepted" || order_reservation.status == "send_to_kitchen"
OrderReservation.update_order_reservation(order_reservation_id, nil, nil,nil,reason)
result = {:status=> true, :message => "FOC successfully" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't get FOC!" }
end
elsif status == 'VOID'
if order_reservation.status == "ready_to_delivery"
OrderReservation.update_order_reservation(order_reservation_id, nil, nil,nil,reason)
result = {:status=> true, :message => "VOID successfully" }
else
result = {:status=> false, :message => "Status :: "+order_reservation.status+" cann't VOID!" }
end
end
else
result = { :status => false, :order_reservation_id => order_reservation_id, :message => "status and remark is required!" }
end
render :json => result
end
end

View File

@@ -220,33 +220,39 @@ class Api::OrdersController < Api::ApiController
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
# order queue stations
oqs = assigned_item.order_queue_station
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf"
if !order_slim_pdf.empty?
order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1'
unique_code="OrderItemSlimPdf"
else
unique_code="OrderItemPdf"
end
elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1'
unique_code="OrderSetItemPdf"
else
unique_code="OrderItemPdf"
if !assigned_items.nil?
assigned_items.each do |assign_item|
# order queue stations
oqs = assign_item.order_queue_station
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf"
if !order_slim_pdf.empty?
order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1'
unique_code="OrderItemSlimPdf"
else
unique_code="OrderItemPdf"
end
elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1'
unique_code="OrderSetItemPdf"
else
unique_code="OrderItemPdf"
end
end
end
end
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end
end
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end
return return_json_status_with_code(200, "updated successfully!")

View File

@@ -11,7 +11,10 @@ class Api::Restaurant::MenuController < Api::ApiController
# to hash
menu_array = []
all_menu.each do |m|
menu_array.push(m.to_json(:include => {:menu_categories => { :include => { :menu_items => { :include => [:menu_item_sets, :menu_item_instances => {:include => :menu_instance_item_sets}]} } }}))
menu_array.push(m.to_json(:include => {:menu_categories =>
{ :include => { :menu_items =>
{ :include => [:menu_item_sets, :menu_item_instances =>
{ :include => :menu_instance_item_sets}]} } }}))
end
#export Checksum file generate by md5

View File

@@ -27,49 +27,55 @@ class Oqs::EditController < BaseOqsController
remarks = params[:remarks]
order_item = OrderItem.find(order_items_id)
before_updated_qty = order_item.qty
order = Order.find(order_item.order_id)
if qty_weight.to_i <= order_item.qty.to_i
before_updated_qty = order_item.qty
order_item.item_order_by = current_user.name
order_item.qty = qty_weight
order_item.remark = remarks
order_item.save
order_item.item_order_by = current_user.name
order_item.qty = qty_weight
order_item.remark = remarks
order_item.save
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
# print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
if !assigned_items.nil?
assigned_items.each do |assign_item|
# order queue stations
oqs = assign_item.order_queue_station
if ENV["SERVER_MODE"] != "cloud" && order.source == 'cashier' #no print in cloud server
# print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
if !assigned_items.nil?
assigned_items.each do |assign_item|
# order queue stations
oqs = assign_item.order_queue_station
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf"
if !order_slim_pdf.empty?
order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1'
unique_code="OrderItemSlimPdf"
else
unique_code="OrderItemPdf"
end
elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1'
unique_code="OrderSetItemPdf"
else
unique_code="OrderItemPdf"
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf"
if !order_slim_pdf.empty?
order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1'
unique_code="OrderItemSlimPdf"
else
unique_code="OrderItemPdf"
end
elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1'
unique_code="OrderSetItemPdf"
else
unique_code="OrderItemPdf"
end
end
end
end
end
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end
end
end
render :json => {:status=> true }
else
render :json => {:status=> false, :message => "Not allowed over quantity!" }
end
end

View File

@@ -18,8 +18,15 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile
@webview = true
end
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# if params[:menu] == "true"
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@table_id = params[:id]
@table = DiningFacility.find(@table_id)
@booking = @table.get_booking
@@ -56,7 +63,7 @@ class Origami::AddordersController < BaseOrigamiController
end
def get_item_instance
@id = MenuItemInstance.find(params[:id])
@instance = MenuItemInstance.find(params[:id])
end
def get_menu()
@@ -112,8 +119,6 @@ class Origami::AddordersController < BaseOrigamiController
end
items_arr.push(items)
}
puts items_arr.to_json
puts "sssssssssssssssssssssss"
# begin
# if params[:order_source] == "quick_service"
# customer_id = "CUS-000000000002" # for no customer id from mobile

View File

@@ -3,6 +3,8 @@ class Origami::DashboardController < BaseOrigamiController
def index
@shop = Shop.first
today = DateTime.now.strftime('%Y-%m-%d')
# @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
# @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count()
@@ -81,4 +83,8 @@ class Origami::DashboardController < BaseOrigamiController
end
end
def get_all_menu
@menus = Menu.all
end
end

View File

@@ -30,9 +30,9 @@ class Origami::HomeController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all
bookings = Booking.all
if !bookings.today.nil?
@order_items_count = Hash.new
# bookings = Booking.all
# if !bookings.today.nil?
# @order_items_count = Hash.new
# bookings.each do |booking|
# if booking.sale_id.nil? && booking.booking_status != 'moved'
# if !booking.booking_orders.empty?
@@ -60,7 +60,7 @@ class Origami::HomeController < BaseOrigamiController
# end
# end
# end
end
# end
@dining.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'

View File

@@ -11,6 +11,8 @@ class Origami::MoveroomController < BaseOrigamiController
@orders = Order.all.order('date desc')
@status_order = ""
@status_sale = ""
@sale_array = Array.new
@dining = DiningFacility.find(params[:dining_id])
@dining.bookings.each do |booking|
if booking.sale_id.nil?
@@ -18,21 +20,38 @@ class Origami::MoveroomController < BaseOrigamiController
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
@obj_order = order
@customer = order.customer
@date = order.created_at
@booking= booking
order.order_items.each do |item|
@order_items.push(item)
end
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end
@status_order = 'order'
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed"
if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale)
if @status_order == 'order'
@status_order = 'sale'
end
@booking= booking
@date = sale.created_at
@status_sale = 'sale'
@obj_sale = sale
@customer = sale.customer
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
account = TaxProfile.find(acc)
@account_arr.push(account)
end
end
end
end

View File

@@ -18,7 +18,6 @@ class Origami::MovetableController < BaseOrigamiController
if booking.sale_id.nil?
@order_items = Array.new
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
@obj_order = order
@customer = order.customer
@@ -37,7 +36,7 @@ class Origami::MovetableController < BaseOrigamiController
@status_order = 'order'
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed"
if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale)
if @status_order == 'order'
@status_order = 'sale'

View File

@@ -3,39 +3,40 @@ class Origami::OrderReservationController < BaseOrigamiController
def index
@order = OrderReservation.latest_order #.active
@count_on_order = OrderReservation.get_count_on_order
@count_on_completed = OrderReservation.get_count_on_completed
end
def update
@id = params[:order_id]
@status = params[:status]
expected_waiting_time = params[:expected_time]
min_type = params[:min_type]
if min_type != ""
expected_waiting_time = params[:expected_time]
else
expected_waiting_time = min_type + " " +params[:expected_time]
end
remark = params[:remark]
access_code = params[:access_code]
@order_reservation = OrderReservation.find(@id)
status = true
if status
if @status == "processed"
result = OrderReservation.create_doemal_order(@order_reservation,current_user)
elsif @status == "delivery"
OrderReservation.update_order_reservation(@id, nil, "ready_to_delivery")
response = OrderReservation.send_status_to_ordering(@order_reservation.callback_url,@order_reservation.transaction_ref,"ready_to_delivery")
result = {:status=> true, :message => "ready for delivery" }
elsif @status == "completed"
result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
else
if @status == "cancel"
OrderReservation.update_order_reservation(@id, nil, "cancelled")
result = {:status=> true, :message => "rejected" }
else
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
result = {:status=> true, :message => "accepted" }
end
end
render :json => result.to_json
if @status == "processed"
result = OrderReservation.create_doemal_order(@order_reservation,current_user)
elsif @status == "delivery"
OrderReservation.update_order_reservation(@id, nil, "ready_to_delivery")
response = OrderReservation.send_status_to_ordering(@order_reservation.callback_url,@order_reservation.transaction_ref,"ready_to_delivery")
result = {:status=> true, :message => "ready for delivery" }
elsif @status == "completed"
result = OrderReservation.update_doemal_payment(@order_reservation,current_user)
else
result = {:status=> false, :message => "Order not accepted !" }
render :json => result.to_json
end
if @status == "rejected"
OrderReservation.update_order_reservation(@id, nil, "rejected",nil,remark,access_code,current_user)
result = {:status=> true, :message => "rejected" }
else
OrderReservation.update_order_reservation(@id, nil, "accepted", expected_waiting_time)
result = {:status=> true, :message => "accepted" }
end
end
render :json => result.to_json
end
def get_order
@@ -46,13 +47,7 @@ class Origami::OrderReservationController < BaseOrigamiController
end
def send_status
if params[:status] == "cancel"
status = "rejected"
else
status = params[:status]
end
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],status,params[:waiting_time])
response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason])
render :json => response
end

View File

@@ -10,24 +10,30 @@ class Origami::QuickServiceController < ApplicationController
def index
today = DateTime.now
day = Date.today.wday
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# if params[:menu] == "true"
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@zone = Zone.all
@customer = Customer.all
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
# @tables = Table.all.active.order('zone_id asc').group("zone_id")
# @rooms = Room.all.active.order('zone_id asc').group("zone_id")
# @all_table = Table.all.active.order('status desc')
# @all_room = Room.all.active.order('status desc')
render "origami/addorders/detail"
render "origami/addorders/detail"
end
def modify_order
today = DateTime.now
day = Date.today.wday
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# if params[:menu] == "true"
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
if(params[:id][0,3] == "BKI")
@table_id = nil
@table = nil

View File

@@ -5,8 +5,10 @@ class Origami::SaleEditController < BaseOrigamiController
sale_id = params[:sale_id]
if params[:table_id]
@table_id = params[:table_id]
@table_type = DiningFacility.find(@table_id).type
else
@table_id = nil
@table_type = nil
end
@cashier_type = params[:type]
@@ -48,10 +50,13 @@ class Origami::SaleEditController < BaseOrigamiController
end
end
end
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
# FOr Sale Audit
action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Void Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"SALEITEMVOID" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMVOID" )
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount)
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
@@ -82,10 +87,12 @@ class Origami::SaleEditController < BaseOrigamiController
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
order = Order.find(order_id)
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"SALEITEMFOC" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" )
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source)
ProductCommission.create_product_commission(@newsaleitem, saleitemObj)
@@ -124,10 +131,12 @@ class Origami::SaleEditController < BaseOrigamiController
saleitemObj.unit_price = update_price
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Update Qty #{update_qty} Price [#{saleitemObj.price}]| Receipt No #{sale.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, approved_by.name,remark,"SALEITEMEDIT" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,sale.cashier_id, action_by,remark,"SALEITEMEDIT" )
# saleitemObj.remark = 'edit'
unless saleitemObj.product_name.include? 'updated'
@@ -175,10 +184,12 @@ class Origami::SaleEditController < BaseOrigamiController
order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id
order = Order.find(order_id)
action_by = current_user.id
approved_by = Employee.find_by_emp_id(access_code)
action_by = current_user.name
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}"
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, approved_by.name,remark,"ITEMCANCELVOID" )
sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" )
saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount, order.source)
ProductCommission.remove_product_commission(saleitemObj)

View File

@@ -19,7 +19,9 @@ class Origami::SplitBillController < BaseOrigamiController
table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL")
if !table_bookings.nil?
table_bookings.each do |table_booking|
@sale_data.push(table_booking.sale)
if table_booking.sale.sale_status != 'waste' && table_booking.sale.sale_status != 'spoile'
@sale_data.push(table_booking.sale)
end
end
end

View File

@@ -22,7 +22,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
end
end
#end rounding adjustment
if sale.sale_status != "completed"
if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale)
end
end
@@ -52,7 +52,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
end
end
#end rounding adjustment
if sale.sale_status != "completed" && sale.sale_status != 'void'
if sale.sale_status != "completed" && sale.sale_status != 'void' && sale.sale_status != "waste" && sale.sale_status != "spoile"
@sale_array.push(sale)
end
end

View File

@@ -72,9 +72,12 @@ class Origami::VoidController < BaseOrigamiController
# FOr Sale Audit
action_by = current_user.name
approved_by = Employee.find_by_emp_id(access_code)
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,"SALEVOID" )
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
# For Print

View File

@@ -55,9 +55,11 @@ class Origami::WasteSpoileController < BaseOrigamiController
# FOr Sale Audit
action_by = current_user.name
approved_by = Employee.find_by_emp_id(access_code)
if access_code != "null"
action_by = Employee.find_by_emp_id(access_code).name
end
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,remark )
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,remark )
# For Print

View File

@@ -1,7 +1,7 @@
class Reports::OrderReservationController < BaseReportController
# authorize_resource :class => false
def index
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
@providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]]
from, to = get_date_range_from_params
@@ -17,8 +17,9 @@ class Reports::OrderReservationController < BaseReportController
@shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
end
end
payment_type = params[:payment_type]
@sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type)
provider = params[:provider]
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider)
@from = from
@to = to
# get printer info
@@ -40,7 +41,7 @@ class Reports::OrderReservationController < BaseReportController
def show
from, to = get_date_range_from_params
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
date_arr = Array.new
@sale_data.each do |sale|

View File

@@ -20,7 +20,7 @@ authorize_resource :class => false
payment_type = params[:payment_type]
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
@tax_profiles = TaxProfile.order('order_by asc').limit(2)
@tax_profiles = TaxProfile.where('group_type = "cashier"').order('order_by asc').limit(2)
@from = from
@to = to
# get printer info

View File

@@ -16,10 +16,12 @@ class Settings::CashierTerminalsController < ApplicationController
# GET /settings/cashier_terminals/new
def new
@settings_cashier_terminal = CashierTerminal.new
@server_mode = ENV["SERVER_MODE"]
end
# GET /settings/cashier_terminals/1/edit
def edit
@server_mode = ENV["SERVER_MODE"]
end
# POST /settings/cashier_terminals

View File

@@ -195,7 +195,9 @@ class Settings::MenusController < ApplicationController
# end
end
file_path = "public/menus/" + menu.name + ".xlsx"
directory_name = "public/menus"
Dir.mkdir(directory_name) unless File.exists?(directory_name)
file_path = directory_name +"/" + menu.name + ".xlsx"
p.serialize(file_path)
render :json => { status: true, path: file_path }
end

View File

@@ -18,10 +18,12 @@ class Settings::OrderQueueStationsController < ApplicationController
# GET /settings/order_queue_stations/new
def new
@settings_order_queue_station = OrderQueueStation.new
@server_mode = ENV["SERVER_MODE"]
end
# GET /settings/order_queue_stations/1/edit
def edit
@server_mode = ENV["SERVER_MODE"]
end
# POST /settings/order_queue_stations

View File

@@ -248,6 +248,7 @@ class Ability
can :reprint, :payment
can :rounding_adj, :payment
can :print, :payment
can :foc, :payment
can :manage, Commission
can :manage, Commissioner

View File

@@ -81,7 +81,7 @@ class MenuCategory < ApplicationRecord
def get_sub_category
menu_category = MenuCategory.find_by_menu_category_id(self.id)
if menu_category
if !menu_category.nil?
return true
end
return false

View File

@@ -30,7 +30,7 @@ class OrderReservation < ApplicationRecord
order_reservation.payment_type = order_reserve[:payment_info][:payment_type]
order_reservation.payment_status = order_reserve[:payment_info][:payment_status]
order_reservation.payment_ref = order_reserve[:payment_info][:payment_ref]
order_reservation.taxes = order_reserve[:payment_info][:taxes]
order_reservation.taxes = order_reserve[:payment_info][:taxes].to_json
order_reservation.total_amount = order_reserve[:payment_info][:sub_total]
order_reservation.total_tax = order_reserve[:payment_info][:total_tax]
order_reservation.discount_amount = order_reserve[:payment_info][:discount_amount]
@@ -40,7 +40,7 @@ class OrderReservation < ApplicationRecord
end
if order_reserve[:reservation_info]
order_reservation.total_customer = order_reserve[:reservation_info][:total_user]
order_reservation.reservation_remark = order_reserve[:reservation_info][:reservation_note]
order_reservation.order_remark = order_reserve[:reservation_info][:reservation_note]
end
order_reservation.save!
if order_reserve[:order_info][:items]
@@ -102,7 +102,7 @@ class OrderReservation < ApplicationRecord
#order reservation status updated
update_order_reservation(order.id, @sale.sale_id, SEND_TO_KITCHEN)
result = {:status=> @status, :data => @sale, :message => "created" }
result = {:status=> @status, :data => @sale, :message => "send to kitchen" }
return result
end
end
@@ -138,7 +138,7 @@ class OrderReservation < ApplicationRecord
end
end
def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil)
def self.send_status_to_ordering(url,ref_no,status,waiting_time=nil,min_type=nil,reason=nil)
base_url = 'https://api.doemal.com'
token = '3T-tnlYtFJ-5Z1vY6XQqxQ'
order_reservation = Lookup.collection_of("order_reservation")
@@ -158,7 +158,9 @@ class OrderReservation < ApplicationRecord
post_url = base_url + url
if !waiting_time.nil?
send_params = {id: ref_no, waiting_time: waiting_time, status: status}
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
elsif !reason.nil?
send_params = {id: ref_no, status: status, reason: reason}
else
send_params = {id: ref_no, status: status}
end
@@ -185,20 +187,77 @@ class OrderReservation < ApplicationRecord
return response
end
def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil)
def self.update_order_reservation(id, sale_id, status, expected_waiting_time=nil, remark=nil, access_code=nil, current_user=nil)
order_reservation = OrderReservation.find(id)
if sale_id.present?
order_reservation.sale_id = sale_id
end
if !expected_waiting_time.nil?
order_reservation.expected_waiting_time = DateTime.parse(expected_waiting_time).utc
order_reservation.expected_waiting_time = expected_waiting_time
end
if !status.nil?
order_reservation.status = status
end
if !remark.nil?
order_reservation.order_remark = remark
end
if status == "delivered"
order_reservation.payment_status = "paid"
end
order_reservation.status = status
order_reservation.save
# if !order_reservation.sale_id.nil? && status == "rejected"
# void_doemal_payment(order_reservation.sale_id, remark, access_code, current_user)
# end
end
def self.void_doemal_payment(sale_id, remark, access_code, current_user)
if Sale.exists?(sale_id)
sale = Sale.find_by_sale_id(sale_id)
# update count for shift sale
if(sale.sale_status == "completed")
if sale.shift_sale_id != nil
shift = ShiftSale.find(sale.shift_sale_id)
shift.calculate(sale_id, "void")
end
else
# void before sale payment complete
if sale.shift_sale_id != nil
shift = ShiftSale.find(sale.shift_sale_id)
shift.total_void = shift.total_void + sale.grand_total
shift.save
end
end
sale.payment_status = 'void'
sale.sale_status = 'void'
sale.save
# FOr Sale Audit
action_by = current_user.name
approved_by = Employee.find_by_emp_id(access_code)
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, approved_by.name,remark,"SALEVOID" )
# update complete order items in oqs
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
aoi.delivery_status = 1
aoi.save
end
end
end
end
def self.get_count_on_order
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status").group("status")
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count, status")
.where("status != 'delivered'")
.group("status")
end
def self.get_count_on_completed
order_reservation = OrderReservation.select("COUNT(order_reservation_id) as count")
.where("created_at BETWEEN '#{DateTime.now.beginning_of_day}' AND '#{DateTime.now.end_of_day}' AND status = 'delivered'").first()
end
def self.get_pending_orders
@@ -218,8 +277,7 @@ class OrderReservation < ApplicationRecord
end
def self.check_order_send_to_kitchen
today = Time.now.utc
order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}' and expected_waiting_time < '#{today}'")
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
@@ -228,8 +286,7 @@ class OrderReservation < ApplicationRecord
end
def self.check_order_ready_to_delivery
today = Time.now.utc
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}' and expected_waiting_time < '#{today}'")
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation
@@ -237,6 +294,36 @@ class OrderReservation < ApplicationRecord
end
end
def self.get_order_reservation_by_shift(shift_sale_range,shift,from,to,provider)
## => left join -> show all sales although no orders
if provider.blank?
provider = ''
else
if provider.present?
provider = " and deliveries.provider = '#{provider}'"
end
end
query = OrderReservation.select("order_reservations.*, deliveries.provider, deliveries.delivery_fee, customers.name, customers.email")
.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
.joins(" JOIN customers on customers.customer_id = order_reservations.customer_id")
.joins(" JOIN sales on sales.sale_id = order_reservations.sale_id")
if shift.present?
query = query.where("sales.shift_sale_id in (?) #{provider} and sales.sale_status= 'completed' and sale_payments.payment_amount != 0", shift.to_a)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
elsif shift_sale_range.present?
query = query.where("sales.sale_status='completed' #{provider} and sale_payments.payment_amount != 0 and sales.shift_sale_id in (?)",shift_sale_range.to_a)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
else
query = query.where("sales.sale_status='completed' and sales.receipt_date between ? and ? #{provider} and sale_payments.payment_amount != 0",from,to)
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.group("sales.sale_id")
end
return query
end
private
def generate_custom_id
self.order_reservation_id = SeedGenerator.generate_id(self.class.name, "ODRS")

View File

@@ -430,28 +430,55 @@ class Sale < ApplicationRecord
# customer.tax_profiles.each do |cus_tax|
# if cus_tax.to_i == tax.id
if tax.group_type.to_s == order_source.to_s
sale_tax = SaleTax.new(:sale => sale)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
if customer.customer_type.downcase == 'takeaway'
if tax.name.downcase == 'commercial tax'
sale_tax = SaleTax.new(:sale => sale)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
# substract , to give after discount
total_tax = total_taxable - total_discount
#include or execulive
if tax.inclusive
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
end
#new taxable amount is standard rule for step by step
if shop.calc_tax_order
total_taxable = total_taxable + sale_tax.tax_payable_amount
end
# substract , to give after discount
total_tax = total_taxable - total_discount
#include or execulive
if tax.inclusive
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
end
#new taxable amount is standard rule for step by step
if shop.calc_tax_order
total_taxable = total_taxable + sale_tax.tax_payable_amount
end
sale_tax.inclusive = tax.inclusive
sale_tax.save
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
else
sale_tax = SaleTax.new(:sale => sale)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
# substract , to give after discount
total_tax = total_taxable - total_discount
#include or execulive
if tax.inclusive
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
end
#new taxable amount is standard rule for step by step
if shop.calc_tax_order
total_taxable = total_taxable + sale_tax.tax_payable_amount
end
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
end
# end
# end
@@ -484,6 +511,33 @@ class Sale < ApplicationRecord
# customer.tax_profiles.each do |cus_tax|
# if cus_tax.to_i == tax.id
if tax.group_type.to_s == order_source.to_s
if customer.customer_type.downcase == 'takeaway'
if tax.name.downcase == 'commercial tax'
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
# substract , to give after discount
total_tax = total_taxable - self.total_discount
#include or execulive
if tax.inclusive
rate = tax.rate
divided_value = (100 + rate)/rate
sale_tax.tax_payable_amount = total_tax / divided_value
else
sale_tax.tax_payable_amount = total_tax * tax.rate / 100
total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
end
#new taxable amount is standard rule for step by step
if shop.calc_tax_order
total_taxable = total_taxable + sale_tax.tax_payable_amount
end
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
else
sale_tax = SaleTax.new(:sale => self)
sale_tax.tax_name = tax.name
sale_tax.tax_rate = tax.rate
@@ -507,6 +561,7 @@ class Sale < ApplicationRecord
sale_tax.inclusive = tax.inclusive
sale_tax.save
end
end
# end
# end

View File

@@ -98,9 +98,8 @@ class SaleItem < ApplicationRecord
discount_accounts = []
Account.all.each do |a|
discount_account = {:name => a.title, :price => 0}
# Check for actual sale items
sale_items.where("status = 'Discount'").find_each do |si|
sale_items.where("status = 'Discount'").each do |si|
if si.account_id == a.id
discount_account[:price] = (discount_account[:price].abs + si.price.abs) * (1)
end

View File

@@ -132,6 +132,9 @@
<li>
<a href="<%= reports_product_sale_index_path %>">Product Sale</a>
</li>
<li>
<a href="<%= reports_order_reservation_index_path %>">Order Reservation</a>
</li>
<li>
<a href="<%= reports_receipt_no_index_path %>">Receipt</a>
</li>

View File

@@ -123,25 +123,29 @@ $(document).ready(function(){
data: params,
success: function(result){
// alert("Updated!");
<% if !@link_type.nil? %>
<% if @link_type == 'oqs' %>
window.location.href = '/oqs';
<% elsif @link_type == 'pending' %>
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
<% else %>
<% if !@dining_type.nil? %>
<% if @dining_type == 'Table' %>
if(result.status){
<% if !@link_type.nil? %>
<% if @link_type == 'oqs' %>
window.location.href = '/oqs';
<% elsif @link_type == 'pending' %>
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
<% else %>
<% if !@dining_type.nil? %>
<% if @dining_type == 'Table' %>
window.location.href = '/origami/table/'+<%=@link_type%>;
<% else %>
window.location.href = '/origami/room/'+<%=@link_type%>;
<% end %>
<% else %>
window.location.href = '/origami/table/'+<%=@link_type%>;
<% else %>
window.location.href = '/origami/room/'+<%=@link_type%>;
<% end %>
<% else %>
window.location.href = '/origami/table/'+<%=@link_type%>;
<% end %>
<% end %>
<% end %>
<% else %>
window.location.href = '/oqs';
<% end %>
<% else %>
window.location.href = '/oqs';
<% end %>
}else{
swal("Alert!", result.message, "warning");
}
}
});
});

View File

@@ -5,29 +5,21 @@
<% type = request.path_info.include?('quick_service')%>
<% modify_order = request.path_info.include?('modify_order')%>
<div class="container-fluid " style="padding:">
<div class="container-fluid ">
<div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div>
</div>
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
<div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- <a href="javascript:void(0);" class="dropdown-toggle waves-block p-t-15 p-l-15 p-b-15" data-toggle="dropdown" aria-haspopup="" aria-expanded="true" style="background-color: #eeeeee;border-bottom: .214rem solid #fff;border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF;">
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
</a>
<ul class="dropdown-menu menu_list" style="width:90%">
<% @menus.each do |menu| %>
<li class="nav-item menu_click" data-name="<%=menu.name%>" data-id="<%=menu.id%>">
<a class="nav-link" data-toggle="tab" href="" role="tab"><%=menu.name%></a>
</li>
<%end%>
</ul> -->
<li class="list-menu">
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
<li class="list-menu">
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu" id="main_menu" ><%= @menus[0].name %></span>
<!-- <i class="material-icons material-icons m-l-50 p-r-30">arrow_drop_down</i> -->
<span class="main_menu" id="main_menu menu_name" >
<%if @menu.present? %>
<%=menu[0].name%>
<% end%>
</span>
</a>
<ul class="ml-menu menu_list aria-hidden " style="border-top: 1px solid #fff">
<% @menus.each do |menu| %>
@@ -35,109 +27,126 @@
<a class="nav-link" data-toggle="tab" href="" role="tab" style="text-transform: lowercase;"><%=menu.name%></a>
</li>
<%end%>
</ul>
</li>
<div id="menu-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
</ul>
</li>
<div id="menu-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%> " data-sub-id="<%=menu.get_sub_category%>">
<li class="nav-item">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</a>
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</li>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<%end %>
</ul>
</div>
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
<div class="card">
<div class="card-block" style="">
<div class="card-text" id="custom-slimscroll">
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 0.5rem;">
<!-- append data -->
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<% else %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item ">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</a>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</li>
<% end%>
<% else %>
<li class="nav-item ">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link menu_category sub_click first_<%=menu.id%>" data-toggle="tab" href="" role="tab" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>"> <%= menu.name%>
</a>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</li>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<%end %>
</ul>
</div>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_cache">
<li class="list-menu">
<a href="javascript:void(0);" class="menu-toggle dropdown-toggle toggled my-toggle " style="">
<span class="main_menu menu_cache_name" id="main_menu menu_cache_name"></span>
</a>
<ul class="ml-menu menu_list aria-hidden menu_cache_list" style="border-top: 1px solid #fff">
</ul>
</li>
<div id="menu-slimscroll" data-height="0">
<ul class="nav nav-tabs flex-column category_list category_cache_list" role="tablist" id="ul-navbar">
<li class="nav-item product" data-ref="<%= origami_get_all_product_path %>">
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
</ul>
</div>
</div>
<div class="col-md-7 col-lg-7 col-sm-7 m-t-10" >
<div class="card">
<div class="card-block" style="">
<div class="card-text" id="custom-slimscroll">
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 0.5rem;">
<!-- append data -->
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<% else %>
<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="<%=menu.id%>">
<div class='card-block custom-card-block'>
<p><%=menu.name%> <p>
<p><%=menu.code%> <p>
</div>
</div>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<% end%>
<% end %>
<%end %>
</div>
<%end %>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
<div class="col-md-3 col-lg-3 col-sm-3 m-t-10">
<% if type && modify_order%>
<button type="button" class="btn btn-lg btn-default waves-effect col-md-4" id='back'>
@@ -168,43 +177,45 @@
<br>
<div class="card-header" style="padding: 0.12rem 0.25rem">
<% if type %>
<div class="row clearfix">
<div class="col-md-6 col-lg-6 col-sm-12">
<strong id="order-title" class="font-13">ORDER DETAILS </strong>
</div>
<div class="row clearfix">
<div class="col-md-6 col-lg-6 col-sm-12">
<strong id="order-title" class="font-13">ORDER DETAILS </strong>
</div>
<% if modify_order %>
<% if @table.nil? %>
<div class="col-md-5 col-lg-5 col-sm-5">Table : </div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"></p>
<% else%>
<div class="col-md-5 col-lg-5 col-sm-5">Table : <%=@table.name%></div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<% end%>
<% if modify_order %>
<% if @table.nil? %>
<div class="col-md-3 col-lg-3 col-sm-3">Table : </div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"></p>
<p class="hidden" id="table_get_current"></p>
<% else%>
<div class="col-md-3 col-lg-3 col-sm-3">Table : <%=@table.name%></div>
<p class="hidden" id="table_id"><%=@table_id%></p>
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
<% end%>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p>
<p class="hidden" id="sale_id"><%=@sale_id%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : '---'%></p>
<p class="hidden" id="sale_id"><%=@sale_id%></p>
<div class="col-md-1 col-lg-1 col-sm-1">
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</button>
</div>
<% else%>
<p class="hidden" id="table_type"></p>
<div class="col-md-2 col-lg-2 col-sm-2">
<div class="col-md-1 col-lg-1 col-sm-1">
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</button>
</div>
<% else%>
<p class="hidden" id="table_type"></p>
<div class="col-md-2 col-lg-2 col-sm-2">
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</button>
</div>
<% end%>
</div>
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect float-left" id='clear_all'> Clear
</button>
</div>
<% end%>
</div>
<% else %>
<div class="row ">
<div class="col-md-9 col-lg-9 col-sm-9 ">
@@ -215,6 +226,7 @@
<p class="hidden" id="table_type"><%=@table.type%></p>
<p class="hidden" id="booking_id"><%=@booking_id%></p>
<p class="hidden" id="customer_id"><%=@customer ? @customer.customer_id : ''%></p>
<p class="hidden" id="table_get_current"><%=@table.get_current_checkout_booking%></p>
</div>
<div class="col-md-3 col-lg-3 col-sm-3">
<button type="button" class="btn btn-xs btn-danger waves-effect" id='clear_all'>Clear
@@ -530,12 +542,84 @@
-webkit-animation-duration: 350ms !important;
}
</style>
<script>
jQuery(function(){
id = "<%=@menu[0].id%>";
var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
var id = menus[0]["categories"][0]["id"];
console.log(id);
}else{
var id = 1;
}
jQuery('.first_'+id).click();
});
$(document).ready(function () {
var menus = JSON.parse(localStorage.getItem("menus"));
if (menus != null) {
console.log("menu");
menu_cache_append(menus);
}else{
$("#menu_data").removeClass("hidden");
}
function category_list_template(menu) {
row = '<li class="nav-item">'
+'<p class="hidden menu-id">'+menu.id+'</p> '
+'<a class="nav-link menu_category sub_click first_'+menu.id+'" '
+'data-toggle="tab" href="" role="tab" data-id="'+menu.id+'" '
+'data-sub-id="'+menu.sub_category+'">'+menu.name+''
+'</a>'
+'<ul class="sub_category_list hidden fadeInTop animated" '
+'id="sub_category_list">'
+'</ul>'
+' </li>';
$(".category_cache_list").append(row);
}
function menu_list_template(menu) {
row = '<li class="nav-item menu_click" data-name="'+menu.name+'" '
+' data-id="'+menu.id+'" style="">'
+' <a class="nav-link" data-toggle="tab" href="" role="tab"'
+' style="text-transform: lowercase;">'+menu.name+'</a>'
+'</li>';
$(".menu_cache_list").append(row);
}
function menu_cache_append(menus){
$("#menu_cache").removeClass("hidden");
$(".menu_cache_name").text(menus[0]["name"])
for(var i in menus) {
menu_list_template(menus[i]);
}
var category = menus[0]["categories"];
for(var ii in category) {
if (category[ii]["is_available"]== true){
if (category[ii]["valid_time"]== true){
if (category[ii]["parent_id"] == null ){
if(type){
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}
}else{
if ($("#table_get_current").text()) {
if (category[ii]["code"].includes("SPL") != true) {
category_list_template(category[ii]);
}else {
category_list_template(category[ii]);
}
}
}
}
}
}
}
}
$(".tables").on('click', function () {
$('.tables').css('background-color','');
$('.tables').removeClass('purple')
@@ -548,6 +632,7 @@
$('.confirm_table').attr("data-name",name)
$('.confirm_table').attr("data-type",type)
});
$(".confirm_table").on('click', function () {
var dining_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
@@ -563,10 +648,10 @@
});
$(document).on('click', '.menu_click', function(event){
var menu_id = $(this).attr("data-id");
var menu_id = $(this).attr("data-id");
var name = $(this).attr("data-name");
var url = "get_menu/"+menu_id;
show_menu_cat_list(name, url);
show_menu_cat_list(name, url);
});
//End menu category Click
@@ -616,7 +701,6 @@
+'</li>';
$('.category_list').append(list);
}
}
}
});
@@ -626,6 +710,8 @@
$(document).on('click', '#clear_all', function(event){
$(".summary-items tbody").empty();
$('#sub_total').text("0.00");
$(".create").attr("disabled","disabled");
});
$(document).on('click', '.cashier_number', function(event){
@@ -639,12 +725,10 @@
case 'num':
var input_value = $(this).attr("data-value");
if (original_value == "0"){
console.log("hi")
$('#modal-qty').val(input_value);
$('#modal-qty').attr('data-value',input_value);
// update_total_amount();
}else{
console.log("aaaaaaaaaa")
$('#modal-qty').val(original_qty + input_value);
$('#modal-qty').attr('data-value',original_qty + input_value);
// update_total_amount();

View File

@@ -1,5 +1,5 @@
if(@id)
menu_item = MenuItem.find(@id.menu_item_id)
if(@instance)
menu_item = MenuItem.find(@instance.menu_item_id)
# Format for option json
opt_format = []
# Format for attributes json
@@ -24,14 +24,14 @@ if(@id)
end
json.success true
json.id @id.id
json.name @id.item_instance_name
json.code @id.item_instance_code
json.id @instance.id
json.name @instance.item_instance_name
json.code @instance.item_instance_code
json.item_id @id.menu_item_id
json.attributes @id.item_attributes
json.price @id.price
json.is_default @id.is_default
json.item_id @instance.menu_item_id
json.attributes @instance.item_attributes
json.price @instance.price
json.is_default @instance.is_default
json.options opt_format
else

View File

@@ -0,0 +1,36 @@
json.id menu.id
json.name menu.name
json.is_active menu.is_active
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories)
json.categories menu.menu_categories do |category|
menu_category = MenuCategory.find_by_menu_category_id(category.id)
if !menu_category.nil?
json.sub_category "true"
else
json.sub_category "false"
end
valid_time = category.valid_time
json.valid_time valid_time
json.id category.id
json.code category.code
json.order_by category.order_by
json.name category.name
json.alt_name category.alt_name
json.order_by category.order_by
json.parent_id category.menu_category_id
json.is_available category.is_available
if category.menu_items
json.items category.menu_items do |item|
json.partial! 'origami/addorders/menu_item', item: item
end
end
end
end

View File

@@ -0,0 +1,15 @@
menu_json = json.array! @menus do |menu|
json.id menu.id
json.name menu.name
json.valid_days menu.valid_days
json.valid_time_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.strftime("%H:%M")
json.partial! 'origami/dashboard/menu', menu: menu
# if (@current_menu)
# json.current_menu do
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu
# end
# end
end

View File

@@ -207,6 +207,15 @@
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<script>
$(function() {
$.ajax({
type: "GET",
url: 'get_all_menu',
data: {},
success:function(result){
localStorage.setItem("menus", JSON.stringify(result));
}
});
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
@@ -223,9 +232,9 @@
window.location.href = '/origami/order_reservation';
});
$("#second_view").on('click', function () {
$("#second_view").on('click', function () {
var url = $(this).attr("data-href");
window.open(url,'_blank');
});
});
</script>

View File

@@ -142,7 +142,6 @@ $(document).ready(function(){
var webview = <%= @webview %>;
showHideNavbar(webview,"index");
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;

View File

@@ -1010,6 +1010,7 @@
$('#add_order').on('click', function () {
var dining_id = "<%= @dining.id %>";
window.location.href = '/origami/addorders/' + dining_id;
});
@@ -1116,7 +1117,7 @@
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
var dining_id = "<%= @dining.id %>";
var dining_id = "<%= @dining.id rescue "" %> ";
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type +"/edit";
}else if(type == "void"){

View File

@@ -1,215 +1,376 @@
<div class="container-fluid">
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="row">
<!-- Column One -->
<div class="col-lg-6 col-md-6 col-sm-6">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
<!-- Nav tabs -->
<ul class="nav nav-tabs tab-col-teal" role="tablist" id="mytab">
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#tables" role="tab">Tables</a>
</li>
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#rooms" role="tab">Rooms</a>
</li>
</ul>
<!-- Nav tabs - End -->
<div id="order-detail-slimscroll" data-height="130">
<div class="tab-content" style="">
<!--- Panel 0 - Completed Orders -->
<!--- Panel 1 - Table Orders -->
<div class="tab-pane " id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
</ul>
<!-- Nav tabs - End -->
<div id="custom-slimscroll">
<div class="tab-content" style="">
<!--- Panel 0 - Completed Orders -->
<!--- Panel 1 - Table Orders -->
<div class="tab-pane" id="tables" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 2 - Room Orders -->
<div class="tab-pane active" id="rooms" role="tabpanel">
<!--- Panel 2 - Room Orders -->
<div class="tab-pane active" id="rooms" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 3 - s -->
</div>
</div>
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'>' <%= @dining.name %>' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
</div>
<div class="card-block">
<div class="card-title row">
<div class="col-lg-6 col-md-6 col-sm-6">
<p class="m-l-10"> Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @obj_sale.receipt_no rescue '' %>
<% end %>
</span></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p class="m-r-10">Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" 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>
<%
sub_total = 0
if @status_sale == "sale"
@obj_sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @obj_sale.sale_id %>">
<% unless sale_item.price <= 0 %>
<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
end
end
if @status_order == 'order'
unless @order_items.nil?
@order_items.each do |order_item |
sub_total = sub_total + order_item.price
unless order_item.price <= 0 %>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
end
end
end
%>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="move_table purple" id="move_table">MOVE TABLE</div>
</div>
</div>
</div>
</div>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
<!--- Panel 3 - s -->
</div>
</div>
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn bg-default btn-block" id='back'> <i class="material-icons">reply</i>Back</button>
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
<br>
</div>
<% end %>
</div>
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" id="order-items-table">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<% unless sale_item.price <= 0 %>
<tr>
<td><%= count %></td>
<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
end
end
if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil? || @order_items.empty?
count = 0
@order_items.each do |order_item |
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
#unless order_item.price <= 0 %>
<tr>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
#end
end
end
end
%>
</tbody>
</table>
</div>
</div>
<%
if @status_sale == 'sale'
unless @order_items.nil?
%>
Pending New Order
<table class="table table-striped">
<%
@order_items.each do |order_item |
%>
<tr>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
%>
</table>
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice </button>
<%
else
@sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
Pending Payment
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td><button class='btn btn-lg btn-blue '>Show Detail </button></td>
</tr>
</table>
<%
end
end
end
end
end
%>
<div class="row">
<div class="col-md-12">
<div class="move_table purple" id="move_table">MOVE ROOM</div>
</div>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- Waiter Buttons -->
<button type="button" class="btn bg-default btn-block" id='back'> <i class="material-icons">reply</i>Back</button>
</div>
</div>
</div>
<script>
$(document).ready(function(){
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
$(".tables").on('click', function(){
$(document).ready(function(){
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if ((dining_id == change_from) || (dining_name==undefined)) {
swal({
title: "Alert!!",
text: 'Please select another table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
})
$(".rooms").on('click', function(){
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
})
var change_from = "<%= @dining.id %>";
if (dining_id == change_from) {
swal({
title: "Alert!!",
text: 'Please select another room !',
type: 'warning',
});
}else{
$('#moved').text(dining_name)
$('#change_table_value').val(dining_id);
}
})
$(".rooms").on('click', function(){
$('.rooms').removeClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
$('#moved').text(dining_name)
$('#change_table_value').val(dining_id);
})
$('#move_table').on('click',function(){
change_to = $('#change_table_value').val();
change_from = "<%= @dining.id %>";
if (change_to == ""){
alert("Please Select Room")
}else{
$.ajax({type: "POST",
url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to,
success:function(result){
alert("Moving Success")
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to;
}else{
window.location.href = '/origami/room/' + change_to;
}
$('#move_table').on('click',function(){
change_to = $('#change_table_value').val();
change_from = "<%= @dining.id %>";
if (change_to == ""){
alert("Please Select Room")
}else{
$.ajax({type: "POST",
url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to,
success:function(result){
alert("Moving Success")
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to;
}else{
window.location.href = '/origami/room/' + change_to;
}
}
});
}
});
}
$('#add_invoice').on('click', function () {
var dining_id = "<%= @dining.id %>";
var sale_id = $("#sale_id").val();
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
}
});
});
});
$('#back').on('click',function(){
window.location.href = '/origami/room/'+ "<%= @dining.id %>";
})
});
$('#back').on('click',function(){
window.location.href = '/origami/room/'+ "<%= @dining.id %>";
})
</script>

View File

@@ -22,27 +22,27 @@
<div class="card-columns" style="padding-top:10px;" >
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
</div>
<% end %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>" data-name="<%= table.name %>">
<div class="card-block">
@@ -54,119 +54,120 @@
</div>
</div>
<!--- Panel 2 - Room Orders -->
<div class="tab-pane" id="rooms" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;" >
<% @rooms.each do |room| %>
<% if room.status == 'occupied' %>
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% if room.get_booking.nil? %>
<div class="card rooms red text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% else %>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
<div class="card rooms blue text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<% end %>
<div class="card-block">
<%= room.name %>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>" data-name="<%= room.name %>">
<div class="card-block">
<%= room.name %>
</div>
</div>
<% end %>
<% end %>
</div>
<% end %>
<% end %>
</div>
<!--- Panel 3 - s -->
</div>
</div>
<!--- Panel 3 - s -->
<!-- tabs - End -->
</div>
</div>
<!-- tabs - End -->
</div>
<!-- Column One -->
<!-- Column One -->
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5">
<div class="card" >
<div class="card-header">
<div><strong id="order-title"> MOVE --> <span style='color:red'> ' <%= @dining.name %> ' </span> to <span style='color:blue' id="moved"> </span></strong></div>
<input type='hidden' id="change_table_value" value="" />
<% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>">
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
<div><strong id="order-title">INVOICE DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if !@booking.reserved_by.nil? && %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
</div>
<% else %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% end %>
</div>
<div class="card-block">
<div class="card-title">
<div class="row p-l-5 p-r-5">
<% if (!@sale_array.empty?) && (!@date.nil?) %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
<% if @status_sale == 'sale' %>
<%= @sale_array[0].receipt_no rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %></span>
<br>
</div>
<% elsif !@date.nil? %>
<div class="col-lg-7 col-md-7 col-sm-7">
&nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %>
<% end %>
</span>
<br>
<% end %>
</span>
<br>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 text-right">
Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %></span>
<br>
</div>
<% end %>
<% end %>
</div>
</div>
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>
<% end %>
</div>
</div>
</div>
<div id="order-detail-slimscroll" data-height="130">
<div id="order-detail-slimscroll" data-height="130">
<div class="card-text" style="" >
<table class="table table-striped" id="order-items-table">
<thead>
@@ -243,7 +244,7 @@ if @status_sale == 'sale'
end
%>
</table>
<button class='btn btn-blue'> Add to existing invoice </button>
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice </button>
<%
else
@sale_array.each do |sale|
@@ -289,30 +290,22 @@ end
showHideNavbar(webview);
$(".tables").on('click', function(){
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if (dining_id == change_from) {
/*$.alert({
title: 'Alert!',
content: 'Please Select Another Table',
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});*/
swal({
title: "Alert!!",
text: 'Please Select Another Table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
})
$('.tables').removeClass('selected-item');
$(this).addClass('selected-item');
var dining_name = $(this).attr("data-name");
var dining_id = $(this).attr("data-id");
var change_from = "<%= @dining.id %>";
if ((dining_id == change_from) || (dining_name==undefined)) {
swal({
title: "Alert!!",
text: 'Please select another table !',
type: 'warning',
});
}else{
$('#moved').text(" ' " + dining_name + " ' ")
$('#change_table_value').val(dining_id);
}
});
$(".rooms").on('click', function(){
$('.rooms').removeClass('selected-item');
@@ -323,14 +316,14 @@ end
if (dining_id == change_from) {
swal({
title: "Alert!!",
text: 'Please Select Another Table !',
text: 'Please select another room !',
type: 'warning',
});
}else{
$('#moved').text(dining_name)
$('#change_table_value').val(dining_id);
}
})
});
$('#move_table').on('click',function(){
change_to = $('#change_table_value').val();
@@ -362,7 +355,32 @@ end
}
});
}
})
});
$('#add_invoice').on('click', function () {
var dining_id = "<%= @dining.id %>";
var sale_id = $("#sale_id").val();
var ajax_url = "/origami/sale/append_order";
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
}
});
});
});
$('#back').on('click',function(){
window.location.href = '/origami/table/'+ "<%= @dining.id %>";

View File

@@ -4,7 +4,7 @@ if @order
:requested_time,:expected_waiting_time,:callback_url,:transaction_ref,:item_count,:total_customer,:payment_type,
:payment_status,:payment_ref,:taxes,:total_amount,:total_tax,
:discount_amount,:convenience_charge,:grand_total,:status,:order_remark,
:reservation_remark,:sale_id)
:remark,:sale_id)
@delivery = Delivery.find_by_order_reservation_id(@order.order_reservation_id)
if @delivery
json.delivery do |json|

View File

@@ -1,48 +1,65 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid">
<!-- start count function -->
<%
pending_count = 0
accepted_count = 0
delivered_count = 0
completed_count = 0
processed_count = 0
%>
<% if !@count_on_order.nil?
@count_on_order.each do |count_order|
if count_order.status == "new"
pending_count = count_order.count
elsif count_order.status == "accepted"
accepted_count = count_order.count
elsif count_order.status == "send_to_kitchen"
delivered_count = count_order.count
elsif count_order.status == "ready_to_delivery"
completed_count = count_order.count
end
end
end
if !@count_on_completed.nil?
processed_count = @count_on_completed.count
end
%>
<!-- end count function -->
<div class="row m-t--10">
<div class="col-lg-4 col-md-4 col-sm-4 div_order_margin">
<div class="col-lg-5 col-md-5 col-sm-5 div_order_margin">
<ul class="nav nav-tabs tab-col-teal" role="tablist">
<li class="nav-item red m-b-10" data-color="#F44336" data-type="pending">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "new" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :pending %></a>
<li class="nav-item red m-b-5" data-color="#F44336" data-type="pending">
<a class="nav-link" data-toggle="tab" href="#pending" role="tab">
<p class="num p-t-5">
<%= pending_count %>
</p> <%= t :pending %></a>
</li>
<li class="nav-item purple m-b-10" data-color="#673AB7" data-type="processing">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "accepted" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :processing %></a>
<li class="nav-item purple m-b-5" data-color="#673AB7" data-type="processing">
<a class="nav-link" data-toggle="tab" href="#processing" role="tab">
<p class="num p-t-5">
<%= accepted_count %>
</p> <%= t :processing %></a>
</li>
<li class="nav-item m-b-10" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "send_to_kitchen" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :delivering %></a>
<li class="nav-item m-b-5" data-color="#009688" data-type="delivery" style="background-color: #009688;">
<a class="nav-link" data-toggle="tab" href="#delivery" role="tab">
<p class="num p-t-5">
<%= delivered_count %>
</p> <%= t :delivering %></a>
</li>
<li class="nav-item m-b-10" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab"><p class="num p-t-15 p-b-5">
<% if !@count_on_order.nil? %>
<% @count_on_order.each do |count_order|
if count_order.status == "ready_to_delivery" %>
<%= count_order.count %>
<% end
end %>
<% end %></p> <%= t :completed %></a>
<li class="nav-item m-b-5" data-color="#03A9F4" data-type="completed" style="background-color: #03A9F4;">
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">
<p class="num p-t-5">
<%= completed_count %>
</p> <%= t :completed %></a>
</li>
<li class="nav-item m-b-5" data-color="#5bc0de" data-type="processed" style="background-color: #5bc0de;">
<a class="nav-link" data-toggle="tab" href="#processed" role="tab">
<p class="num p-t-5">
<%= processed_count %>
</p> <%= t :processed %></a>
</li>
</ul>
@@ -215,12 +232,54 @@
</div>
</div>
</div>
<!--- Panel 5 - processed -->
<div class="tab-pane dining" id="processed" role="tabpanel">
<div class="card-block font-13">
<div id="menu-slimscroll" data-height="50">
<table class="table table-stripe custom-table">
<tbody>
<% i=1
@order.each do |order| %>
<% if order.status == 'delivered' && (order.created_at.utc.getlocal.strftime("%Y-%m-%d") == DateTime.now.strftime("%Y-%m-%d")) %>
<tr class="custom-tr fifth-<%=i%>" style="" data-id="<%=order.order_reservation_id%>" data-sr-no="<%= i %>">
<td width ="5%" class="align-left">
<%=i%>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
<% elsif order.delivery.delivery_type == 'pick_up' %>
PICK-UP
<% else %>
DIRECT DELIVERY
<% end %>
</span>
</td>
</tr>
<%i+=1%>
<%end%>
<%end%>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 div_card_order">
<div class="card">
<div class="card m-b-5 p-t-5">
<div class="card-header custom-card-header" style="color:">
<table class="table">
<tr>
@@ -230,7 +289,11 @@
<td width="40%" class="header-td align-left">
<b><span class="font-15" id="requested_date_time"></span></b>
</td>
<td width ="50%" class="header-td font- align-right"><b><span id="contact_info"></span></b></td>
<td width ="50%" class="header-td align-right">
<b><span id="invoice_no"></span></b>
<span id="order_status" class="hidden"></span>
<span id="approved_code" class="hidden"></span>
</td>
</tr>
</table>
</div>
@@ -296,8 +359,8 @@
</tr>
<tr>
<td width ="50%" class="footer-td align-left col-blue">
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="cancel">
<strong>DECLINE</strong>
<button type="button" class="btn btn-lg bg-red waves-effect" id="cancel" data-value="rejected">
<strong>REJECT</strong>
</button>
</td>
<td width ="50%" class="footer-td align-right col-blue">
@@ -321,8 +384,8 @@
</div>
</div>
<div class="'col-lg-4 col-md-4 col-sm-4'" style="margin:0px -5px 0px -2px !important ">
<div class="card" style="background-color: #E8EAF6">
<div class="col-lg-3 col-md-3 col-sm-3">
<div class="card m-b-5 p-t-5" style="background-color: #E8EAF6">
<div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table">
<tr>
@@ -331,13 +394,13 @@
</tr>
</table>
</div>
<div class="card-block">
<table class="table">
<div class="card-block" style="height: 520px">
<table class="table tbl_customer">
<tbody>
<tr>
<td class="body-td align-left">
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
<span class="font-13">REF.</span><br>
<b id="trans_ref"></b>
</td>
<td class="body-td align-right">
<span class="font-13">REQUESTED TIME</span><br>
@@ -346,12 +409,18 @@
</tr>
<tr>
<td class="body-td align-left">
<span class="font-13">PHONE</span><br>
<b id="phone"></b>
<span class="font-13">NAME</span><br>
<b id="customer_name"></b>
</td>
<td class="body-td align-right expected_time">
<span class="font-13">EXPECTED TIME</span><br>
<b id="expected_time"></b>
<span class="font-13">COOKING TIME</span><br>
<b><span id="expected_time"></span> MINS</b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<span class="font-13">PHONE</span><br>
<b id="phone"></b>
</td>
</tr>
<tr>
@@ -372,11 +441,20 @@
<b id="order_remark"></b>
</td>
</tr>
<tr>
<td colspan="2" class="body-td align-left">
<b><i><span id="remark"></span></i></b>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- <div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div> -->
</div>
<p id="ref_no" class="hidden"></p>
@@ -391,26 +469,171 @@
<h4 class="modal-title" id="waiting_timeModalLabel">Expected Waiting Time for <span id="requested_order_time"></span></h4>
</div>
<div class="modal-body">
<input type="text" id="waiting_time" name="waiting_time" value="" class="timepicker form-control" placeholder="Expected Waiting Time">
<span id="waiting_timeErr" style="color:red;"></span>
<div class="row text-center m-t-20">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3"></div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info timer_type" data-value="after">After</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="15">15 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="30">30 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="45">45 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="60">60 Mins.</button>
</div>
</div>
<div class="row text-center m-t-20">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="75">75 Mins.</button>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg btn-link bg-info time_interval" data-value="90">90 Mins.</button>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="save" active="true">SAVE</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div>
<div class="modal fade" id="rejected_reasonModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="rejected_reasonLabel">Reason</h4>
</div>
<div class="modal-body">
<div class="form-group">
<textarea id="reject_reason" name="reject_reason" class="form-control" rows="3" cols="30"></textarea>
<span id="reject_reasonErr" style="color:red"></span>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect send_status">SEND</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="void">OK</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_new_order" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_new_orderLabel">You have new orders</h4><hr>
</div>
<div class="modal-body notify_new_orderBody">
<div class="form-group text-center">
Are you accept or reject for these orders <b><span id="notify_new_order_lists"></span></b>?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_order_send_to_kitchen" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_order_send_to_kitchenLabel">You have to send order to kitchen</h4><hr>
</div>
<div class="modal-body notify_order_send_to_kitchenBody">
<div class="form-group text-center">
Could you send these orders <b><span id="notify_order_send_to_kitchen_lists"></span></b> to kitchen?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade text-center" id="notify_order_ready_to_delivery" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-center" id="notify_order_ready_to_deliveryLabel">You have orders that are ready to deliver</h4><hr>
</div>
<div class="modal-body notify_order_ready_to_deliveryBody">
<div class="form-group text-center">
Could you ready these orders <b><span id="notify_order_ready_to_delivery_lists"></span></b> to deliver?
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -429,16 +429,16 @@
</div>
<!-- pdf light box -->
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog" >
<div class="modal-dialog modal-md " role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
<h6 class="modal-title">
<span id="pdfModalLabel"></span>
<span id="changed_amount" class="p-l-120"></span>
</h4>
</h6>
</div>
<div class="modal-body">
<div class="modal-body" style="height: 400px;">
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name">
@@ -681,8 +681,8 @@ var customer_name = "<%= @customer.name %>";
calculate_member_discount(sale_id);
}
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModal").on('shown.bs.modal', function () {
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
$.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
@@ -1341,4 +1341,4 @@ var customer_name = "<%= @customer.name %>";
}
});
}
</script>
</script>

View File

@@ -30,7 +30,7 @@
<% @complete.each do |sale| %>
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
<div class="card-block">
<%= sale.receipt_no %><span class="pull-right font-12"><%= sale.sale_status %></span>
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
@@ -135,7 +135,7 @@
<div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns">
<% @orders.each do |order| %>
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block">
<%
order_status = ""
@@ -452,8 +452,13 @@
<% if current_login_employee.role != "waiter" %>
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button> -->
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
@@ -539,6 +544,39 @@
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<script>
var cashier_type = "cashier";
$(document).ready(function(){
@@ -938,7 +976,7 @@ $('#add_invoice').on('click',function(){
$('#edit').on('click',function(){
var dining_id = "<%= @room.id %>"
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/cashier/edit";
});
$('#void').on('click',function () {
@@ -1042,4 +1080,34 @@ $('#add_invoice').on('click',function(){
}
});
}
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result);
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
var dining_id = "<%= @room.id rescue ""%>";
var sale_id = "<%= @obj_sale.sale_id rescue "" %>";
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/cashier/edit";
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste_and_spoilage"){
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script>

View File

@@ -281,6 +281,7 @@ var access_code = localStorage.getItem("access_code");
})*/
$('#action').on('click', function () {
var access_code = localStorage.getItem("access_code");
var sale_item_id = $(this).attr('data-id');
var type = $(this).attr('data-type');
var remark = $("#remark").val();

View File

@@ -90,9 +90,24 @@
<div class="tab-pane" id="orders" role="tabpanel" style="">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @orders.each do |order| %>
<div class="card orders bg-red text-white" data-id = "<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block">
<%= order.order_id %>
<%
order_status = ""
sale_order = SaleOrder.find_by_order_id(order)
if sale_order
unless sale_order.sale_id.nil?
sale = Sale.find(sale_order.sale_id)
order_status = sale.sale_status
if order_status == 'new'
order_status = order.status
end
end
else
order_status = order.status
end
%>
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
</div>
</div>
<% end %>
@@ -198,7 +213,8 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if @sale.sale_status != 'void' %>
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>

View File

@@ -166,8 +166,14 @@
<%end%>
<% end %>
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<button type="button" data-toggle="modal" data-target="#voidModal" class="btn bg-danger btn-block" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<% end %>
</div>
</div>
</div>
@@ -251,6 +257,39 @@
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
/* start check first bill or not*/
@@ -369,6 +408,7 @@ $('#back').on('click',function(){
});
$('#void').on('click',function () {
var access_code = localStorage.getItem("access_code");
if ($(this).attr('active')=== "true") {
swal({
title: "Alert",
@@ -386,7 +426,7 @@ $('#void').on('click',function () {
$.ajax({
type: 'POST',
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id,
data: "remark="+ remark + "&sale_id=" + sale_id + "&access_code=" + access_code ,
success: function () {
window.location.href = '/origami';
}
@@ -399,6 +439,7 @@ $('#void').on('click',function () {
});
$('#foc').click(function() {
var access_code = localStorage.getItem("access_code");
var remark = $("#foc_remark").val();
var cash = $('#grand_total').text();
var sub_total = $('#sub_total').text();
@@ -406,7 +447,7 @@ $('#foc').click(function() {
if($('.receipt_block > div').hasClass('selected-item')){
sale_id = $('.receipt_block > div.selected-item').parent().attr('data-id');
}
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':'cashier' };
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':'cashier','access_code':access_code };
// console.log(sale_id);
if(sale_id != ''){
if ($(this).attr('active')=== "true") {
@@ -430,4 +471,45 @@ $('#foc').click(function() {
}
}
});
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
</script>

View File

@@ -16,7 +16,7 @@
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %>
<%= f.input :printer_name %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<%= f.input :brand_name %>
<%= f.input :printer_type %>

View File

@@ -18,10 +18,10 @@
<option value="9">Last year</option>
</select>
</div>
<% if defined? payments %>
<% if defined? providers %>
<div class="col-lg-2 col-md-2 col-sm-2">
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
<label class="font-14"><%= t("views.right_panel.detail.select_providers") %></label>
<%= select_tag "provider", options_for_select(@providers, :selected => params[:provider]), :class => "form-control" %>
</div>
<% end %>
<div class="col-lg-2 col-md-2 col-sm-2">
@@ -49,37 +49,6 @@
</div>
<script type="text/javascript">
$(function(){
$('#custom_excel').hide();
$('#custom_excel').click(function(){
var url = $('#custom_excel').attr('data-url');
$('#frm_report').attr('action',url)
$('#frm_report').submit();
// window.location = url;
});
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'order'){
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
else if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
}
else{
$('#waiter').hide();
$('#cashier').show();
$("#item").val('sale');
}
});
<% if params[:shift_name].to_i > 0%>
shift_id = '<%= params[:shift_name] %>'
local_date = '<%= @shift_from %> - <%= @shift_to %> '
@@ -91,38 +60,4 @@
$("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>");
$("#sel_period").val(<%=params[:period] rescue '-'%>);
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
// shift = $(".shift-id").text()
// if (shift.length>0) {
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
// }
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
$("#rd_period_type_1").attr("checked","checked");
<% else %>
$("#rd_period_type_0").attr("checked","checked");
<% end %>
$(".btn-group button").removeClass("active");
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
$("#btn_report_type_<%= report_type %>").addClass("active");
$('#item').change(function(){
var item = $('#item').val();
var payment_type = $('#payment_type');
if(item == 'sale'){
$('#waiter').hide();
$('#cashier').show();
if(payment_type){
$('#payment_type').show();
}
}
else{
$('#cashier').hide();
$('#waiter').show();
if(payment_type){
$('#payment_type').hide();
}
}
});
</script>

View File

@@ -1,7 +1,7 @@
<div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.receipt_no_report") %></li>
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.order_reservation_report") %></li>
<span class="float-right">
<%= link_to 'Back', dashboard_path %>
</span>
@@ -12,14 +12,14 @@
<!-- <div class="container"> -->
<%= render :partial=>'shift_sale_report_filter',
:locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_receipt_no_index_path} %>
:locals=>{ :period_type => true, :shift_name => true,:providers => true, :report_path =>reports_order_reservation_index_path} %>
<hr />
<!-- </div> -->
<!-- <div class="container"> -->
<!-- <div class="row"> -->
<div class="text-right">
<a href="javascript:export_to('<%=reports_receipt_no_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
<a href="javascript:export_to('<%=reports_order_reservation_index_path%>.xls')" class = "btn btn-info wave-effects"><%= t("views.btn.exp_to_excel") %></a>
</div>
<!-- </div> -->
<!-- </div> -->
@@ -28,116 +28,133 @@
<div class="card">
<table class="table table-striped" border="0">
<thead>
<tr>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
<th colspan="15"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
<th><%= tax.name %></th>
<% end %>
<!-- <th>Other Amount</th> -->
<th><%= t :customer %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.provider") %></th>
<th><%= t :payment_method %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</th>
</tr>
</thead>
<tbody>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
puts precision
puts "predelidm"
puts delimiter %>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end %>
<%
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
delivery_tax = 0.0
convenience_tax = 0.0
commercial_tax = 0.0
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<%if @sale_data %>
<% @sale_data.each do |result| %>
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
<% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
total_discount_amount = 0
total_delivery_fee = 0
total_convenience_charge = 0
total_delivery_tax = 0
total_convenience_tax = 0
total_commercial_tax = 0
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
<%
provider = ""
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
elsif order_reservation.provider == 'direct_delivery'
provider = "Direct Delivery"
else
provider = order_reservation.provider
end
%>
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>
<td><%= number_with_precision(order_reservation.total_amount, precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(order_reservation.total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></td>
<td><%= number_with_precision(order_reservation.grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0' %></td>
</tr>
<% end
end %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %></td>
<%if result.customer.customer_type == "Takeaway"%>
<td><%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %></td>
<%end%>
<% result.sale_taxes.each do |tax| %>
<td><%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<%end%>
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
<td colspan="6"></td>
<td><b><%= number_with_precision(total_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_discount_amount , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_delivery_fee , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_convenience_charge , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_delivery_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_convenience_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_commercial_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(total_tax , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
<td><b><%= number_with_precision(grand_total , precision:precision.to_i, delimiter:delimiter) rescue '0.0'%></b></td>
</tr>
<% end %>
<tr style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td>
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% end %>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<% @tax_profiles.each do |tax| %>
<td><%= tax.name %></td>
<% end %>
<td><%= t("views.right_panel.detail.grand_total") %></td>
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</td>
</tr>
<%end%>
</tbody>
</table>
</div>
@@ -151,9 +168,7 @@
var check_arr = [];
search_by_period();
$('#sel_period').change(function(){
search_by_period();
});
function search_by_period(){
@@ -216,7 +231,7 @@
from = $("#from").val();
to = $("#to").val();
}
url = '<%= reports_get_shift_by_date_path %>';
url = '<%= reports_get_shift_by_order_reservation_path %>';
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){

View File

@@ -6,98 +6,124 @@
<table class="table table-striped" border="0">
<thead>
<tr>
<th colspan="9"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
<th colspan="15"> <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%></th>
</tr>
<% if @shift_from %>
<tr>
<% if @shift_data.employee %>
<% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %>
<% end %>
<th colspan="9"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
<th colspan="15"><%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )</th>
</tr>
<% end %>
<tr>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th><%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></th>
<th><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> </th>
<% @tax_profiles.each do |tax| %>
<th><%= tax.name %></th>
<% end %>
<!-- <th>Other Amount</th> -->
<th><%= t :customer %></th>
<th><%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.provider") %></th>
<th><%= t :payment_method %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.status")%></th>
<th><%= t("views.right_panel.detail.sub_total") %></th>
<th><%= t("views.right_panel.detail.discount_amount") %></th>
<th><%= t("views.right_panel.detail.delivery_fee") %></th>
<th><%= t("views.right_panel.detail.convenience_charge") %></th>
<th><%= t("views.right_panel.detail.delivery_tax") %></th>
<th><%= t("views.right_panel.detail.convenience_tax") %></th>
<th><%= t("views.right_panel.detail.commercial_tax") %></th>
<th><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></th>
<th><%= t("views.right_panel.detail.grand_total") %></th>
<th><%= t("views.right_panel.detail.rnd_adj_sh") %></th>
<th><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</th>
</tr>
</thead>
<tbody>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
<% total_tax = 0 %>
<% guest_count = 0 %>
<% total_sum = 0 %>
<% discount_amt = 0 %>
<% other_amt = 0 %>
<% total_nett = 0 %>
<% rounding_adj = 0%> <% gov_tax = 0 %> <% service_charge = 0 %>
<%if @sale_data %>
<% @sale_data.each do |result| %>
<%
discount_amount = 0.0
delivery_fee = 0.0
convenience_charge = 0.0
delivery_tax = 0.0
convenience_tax = 0.0
commercial_tax = 0.0
<% grand_total = grand_total.to_f + result.grand_total.to_f %>
<% old_grand_total = old_grand_total.to_f + result.old_grand_total.to_f %>
<% total_tax += result.total_tax.to_f %>
<% total_sum += result.total_amount.to_f %>
<% discount_amt += result.total_discount.to_f %>
<% rounding_adj += result.rounding_adjustment.to_f %>
total_discount_amount = 0
total_delivery_fee = 0
total_convenience_charge = 0
total_delivery_tax = 0
total_convenience_tax = 0
total_commercial_tax = 0
total_tax = 0.0
total_amount = 0.0
grand_total = 0.0
%>
<% unless @order_reservation_data.blank? %>
<% @order_reservation_data.each do |order_reservation| %>
<%
provider = ""
discount_amount = order_reservation.discount_amount
delivery_fee = order_reservation.delivery_fee ? order_reservation.delivery_fee : 0.0
convenience_charge = order_reservation.convenience_charge
JSON.parse(order_reservation.taxes).each do |tax_data|
if tax_data[0] == "delivery_tax"
delivery_tax = tax_data[1]
elsif tax_data[0] == "convenience_tax"
convenience_tax = tax_data[1]
elsif tax_data[0] == "commercial_tax"
commercial_tax = tax_data[1]
end
end
total_discount_amount += discount_amount.to_f
total_delivery_fee += delivery_fee.to_f
total_convenience_charge += convenience_charge.to_f
total_delivery_tax += delivery_tax.to_f
total_convenience_tax += convenience_tax.to_f
total_commercial_tax += commercial_tax.to_f
total_tax += order_reservation.total_tax.to_f
total_amount += order_reservation.total_amount.to_f
grand_total += order_reservation.grand_total.to_f
%>
<%
if order_reservation.provider == 'pick_up'
provider = "Pick-Up"
elsif order_reservation.provider == 'direct_delivery'
provider = "Direct Delivery"
else
provider = order_reservation.provider
end
%>
<tr>
<td><%= order_reservation.email %></td>
<td><%= order_reservation.order_reservation_type %></td>
<td><%= order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= provider%></td>
<td><%= order_reservation.payment_type%></td>
<td><%= order_reservation.payment_status%></td>
<td><%= order_reservation.total_amount rescue '0.0'%></td>
<td><%= discount_amount rescue '0.0'%></td>
<td><%= delivery_fee rescue '0.0'%></td>
<td><%= convenience_charge rescue '0.0'%></td>
<td><%= delivery_tax rescue '0.0'%></td>
<td><%= convenience_tax rescue '0.0'%></td>
<td><%= commercial_tax rescue '0.0'%></td>
<td><%= order_reservation.total_tax rescue '0.0'%></td>
<td><%= order_reservation.grand_total rescue '0.0' %></td>
</tr>
<% end
end %>
<tr>
<td><%= result.receipt_no rescue '-' %> </td>
<td><%= result.cashier_name rescue '-' %></td>
<td><%= result.total_amount rescue '-' %></td>
<td><%= result.total_discount rescue '-' %></td>
<%if result.customer.customer_type == "Takeaway"%>
<td>0.0</td>
<%end%>
<% result.sale_taxes.each do |tax| %>
<td><%= tax.tax_payable_amount rescue '-' %></td>
<%end%>
<td><%= result.grand_total %></td>
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
<td><%= result.grand_total_after_rounding() rescue '-'%></td>
<td colspan="6"></td>
<td><b><%= total_amount rescue '0.0'%></b></td>
<td><b><%= total_discount_amount rescue '0.0'%></b></td>
<td><b><%= total_delivery_fee rescue '0.0'%></b></td>
<td><b><%= total_convenience_charge rescue '0.0'%></b></td>
<td><b><%= total_delivery_tax rescue '0.0'%></b></td>
<td><b><%= total_convenience_tax rescue '0.0'%></b></td>
<td><b><%= total_commercial_tax rescue '0.0'%></b></td>
<td><b><%= total_tax rescue '0.0'%></b></td>
<td><b><%= grand_total rescue '0.0'%></b></td>
</tr>
<% end %>
<tr style="border-top:4px double #666;">
<td colspan="2">&nbsp;</td>
<td><b><%= total_sum rescue '-'%></b></td>
<td><b><%= discount_amt rescue '-'%></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= tax.st_amount.round(2) %></b></td>
<% end %>
<td><b><%= grand_total.to_f.round(2) rescue '-'%></b></td>
<td><b><%= rounding_adj rescue '-'%></b></td>
<td><b><%= grand_total.to_f.round + rounding_adj %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %></td>
<td><%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %></td>
<% @tax_profiles.each do |tax| %>
<td><%= tax.name %></td>
<% end %>
<td><%= t("views.right_panel.detail.grand_total") %></td>
<td><%= t("views.right_panel.detail.rnd_adj_sh") %></td>
<td><%= t("views.right_panel.detail.grand_total") %> +<br/>
<%= t("views.right_panel.detail.rnd_adj_sh") %>
</td>
</tr>
<%end%>
</tbody>
</table>
</div>

View File

@@ -59,20 +59,16 @@
</thead>
<tbody>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end
puts precision
puts "predelidm"
puts delimiter %>
precision = @print_settings.precision
else
precision = 0
end
#check delimiter
if @print_settings.delimiter
delimiter = ","
else
delimiter = ""
end %>
<% grand_total = 0 %>
<% old_grand_total = 0 %>
@@ -116,12 +112,18 @@
<td colspan="2">&nbsp;</td>
<td><b><%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% @sale_taxes.each do |tax| %>
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% if !@sale_taxes.empty?
@sale_taxes.each do |tax| %>
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<% end %>
<% else %>
<% @tax_profiles.each do |tax| %>
<td><b>0</b></td>
<% end %>
<% end %>
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '0' %></b></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>

View File

@@ -12,7 +12,11 @@
<%= f.input :auto_print_receipt %>
<%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<%= f.input :font %>
<%= f.input :font_size %>
<%= f.input :show_tax %>
@@ -58,4 +62,20 @@
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#cashier_terminal_printer_name");
$.each(printerInfo, function(key, value) {
$('#cashier_terminal_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
}
});
</script>

View File

@@ -15,8 +15,11 @@ div.form-inputs span{
<div class="form-inputs p-l-15">
<%= f.input :station_name %>
<%= f.input :is_active %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<!-- <%= f.input :font_size %> -->
<%= f.input :print_copy %>
<%= f.hidden_field :processing_items %>
@@ -63,4 +66,20 @@ div.form-inputs span{
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#order_queue_station_printer_name");
$.each(printerInfo, function(key, value) {
$('#order_queue_station_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
}
});
</script>

View File

@@ -20,11 +20,11 @@ class ActionController::Base
end
else
#check for license file
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
end
end

View File

@@ -79,6 +79,7 @@ en:
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
processed: "Processed"
views:
btn:
@@ -435,7 +436,7 @@ en:
item: "Item"
revenue: "Revenue"
total_price_by: "Total Price By"
sub_total: "Sub Total"
sub_totalိိ: "Sub Total"
cash_received: "Cash Received"
card_sales: "Card Sales"
select_payments: "Select Payments"
@@ -470,6 +471,15 @@ en:
adult: "Adult"
foreigner: "Foreigner"
local: "Local"
order_reservation_report: "Order Reservation"
requested_time: "Requested Time"
provider: "Provider"
delivery_fee: "Delivery Fee"
delivery_tax: "Delivery Tax"
convenience_charge: "Convenience Charge"
convenience_tax: "Convenience Tax"
commercial_tax: "Commercial Tax"
select_providers: "Select Providers"
code_txt: "code "
charge_txt: "charge"

View File

@@ -74,6 +74,7 @@ mm:
processing: "Processing"
delivering: "Delivering"
completed: "Completed"
processed: "Processed"
views:
btn:
@@ -464,6 +465,15 @@ mm:
adult: "လူကြီး"
foreigner: "နိုင်ငံခြားသား"
local: "နိုင်ငံသား"
order_reservation_report: "ၾကိဳတင္ order မွာယူျခင္း"
requested_time: "Requested Time"
provider: "Provider"
delivery_fee: "Delivery Fee"
delivery_tax: "Delivery Tax"
convenience_charge: "Convenience Charge"
convenience_tax: "Convenience Tax"
commercial_tax: "Commercial Tax"
select_providers: "Select Providers"
code_txt: "ကုတ်ဒ် "
charge_txt: "ကောက်ခံသည်"

View File

@@ -88,6 +88,7 @@ scope "(:locale)", locale: /en|mm/ do
namespace :order_reserve do
post "customer" => "order_reservation#check_customer"
post "order" => "order_reservation#create"
post "callback/:id" => "order_reservation#update_status"
end
end
@@ -97,6 +98,7 @@ scope "(:locale)", locale: /en|mm/ do
post '/check_emp_access_code/:code' => 'home#check_emp_access_code', :defaults => { :format => 'json' }
get "dashboard" => "dashboard#index"
get "get_all_menu" => "dashboard#get_all_menu"
get "quick_service" => "quick_service#index"
@@ -445,6 +447,7 @@ scope "(:locale)", locale: /en|mm/ do
resources :order_reservation, :only => [:index, :show]
get "saleitem/get_shift_by_date", to: "saleitem#show", as: "get_shift_by_sale_item"
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
get "order_reservation/get_shift_by_date", to: "order_reservation#show", as: "get_shift_by_order_reservation"
end

View File

@@ -825,6 +825,55 @@ delete from sym_node;
values('order_queue_stations','sx_2_cloud', 200, current_timestamp, current_timestamp);
# End Oqs Channel
### Batch Monitoring ######
#Monitor#
insert into sym_monitor (monitor_id, node_group_id, external_id, type, threshold, run_period, run_count, severity_level, enabled, create_time, last_update_by, last_update_time)
value ('SystemBatchErrorMonitor', 'All', 'All', 'batchError', 1, 1, 1, 300, 1, now(), 'admin', now());
insert into sym_monitor (monitor_id, node_group_id, external_id, type, threshold, run_period, run_count, severity_level, enabled, create_time, last_update_by, last_update_time)
value ('SystemBatchUnsendMonitor', 'All', 'All', 'batchUnsent', 10, 1, 1, 100, 1, now(), 'admin', now());
insert into sym_monitor (monitor_id, node_group_id, external_id, type, threshold, run_period, run_count, severity_level, enabled, create_time, last_update_by, last_update_time)
value ('SystemLogMonitor', 'All', 'All', 'log', 1, 1, 1, 300, 1, now(), 'admin', now());
#Parameter#
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.allow.untrusted.cert', 'true', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.auth', 'true', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.from', 'sym_alert@smartsales.asia', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.host', 'smtp.mailgun.org', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.password', '1cc051ec3edf699d17b78e5cd14ceb6b', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.port', '465', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.starttls', 'false', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.transport', 'smtps', now(), 'admin', now());
insert into sym_parameter (external_id, node_group_id, param_key, param_value, create_time, last_update_by, last_update_time)
value ('All', 'All', 'smtp.user', 'postmaster@smartsales.asia', now(), 'admin', now());
insert into sym_notification (notification_id, node_group_id, external_id, severity_level, type, expression, enabled, create_time, last_update_by, last_update_time)
value ('notify_info', 'ALL', 'ALL', 100, 'email', 'info@connect.smartsales.asia', 1, now(), 'admin', now());
insert into sym_notification (notification_id, node_group_id, external_id, severity_level, type, expression, enabled, create_time, last_update_by, last_update_time)
value ('notify_severe', 'ALL', 'ALL', 300, 'email', 'info@connect.smartsales.asia', 1, now(), 'admin', now());
### End of Batch Monitoring ####
insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,heartbeat_time,timezone_offset,batch_to_send_count,batch_in_error_count,created_at_node_id)
values ('000','sx','000',1,null,null,null,null,null,current_timestamp,null,0,0,'000');

BIN
public/beep.wav Normal file

Binary file not shown.