Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -8,5 +8,7 @@ COPY Gemfile /sxrestaurant/Gemfile
|
||||
COPY Gemfile.lock /sxrestaurant/Gemfile.lock
|
||||
RUN bundle install --without development test
|
||||
RUN bundle exec rails assets:precompile
|
||||
RUN echo "Asia/Rangoon" > /etc/timezone
|
||||
RUN dpkg-reconfigure -f noninteractive tzdata
|
||||
COPY . /sxrestaurant
|
||||
|
||||
|
||||
@@ -188,6 +188,10 @@ Add Base URL for DOEMAL
|
||||
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
|
||||
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
|
||||
|
||||
Add Feature for Dine-in Cashier
|
||||
** '0' means can not use dine-in cashier and '1' means can use dine-in cashier **
|
||||
=> settings/lookups => { type:dinein_cashier, name: DineInCashier, value:'{0 or 1}' }
|
||||
|
||||
Add Feature for Quick Service
|
||||
** '0' means can not use quick service and '1' means can use quick service **
|
||||
=> settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' }
|
||||
|
||||
@@ -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 !",
|
||||
@@ -1042,8 +1001,13 @@ $(function() {
|
||||
});
|
||||
//click save buttom after change qty
|
||||
$('#sx_itemModal').on('click','#save', function(){
|
||||
summary_items_filter();
|
||||
calculate_sub_total();
|
||||
if ($('#modal-qty').val()>0) {
|
||||
summary_items_filter();
|
||||
calculate_sub_total();
|
||||
}else{
|
||||
swal("Opps", "Please enter number for qty ","warning");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//calculate subtotal
|
||||
@@ -1205,7 +1169,6 @@ $(function() {
|
||||
|
||||
$(".keypress_qty").on('keyup change', function (){
|
||||
// $('.keypress_qty').keyup(function(e){
|
||||
|
||||
id = $(this).attr('id');
|
||||
value = $(this).val();
|
||||
|
||||
@@ -1243,54 +1206,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 +1355,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
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -5,6 +5,7 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', {
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
var shop_code = data.shop_code;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
@@ -19,21 +20,32 @@ 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/>"+
|
||||
target: document.getElementById(shop_code+"_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,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// $("#notify_new_order_lists").text(order_lists);
|
||||
// if($("#notify_new_order").hasClass("hidden")){
|
||||
// $("#notify_new_order").removeClass("hidden");
|
||||
// }
|
||||
// $("#notify_new_order").on('show.bs.modal', function(e){
|
||||
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||
// }).on('shown.bs.modal', function(e){
|
||||
// $("#notify_new_order").focus();
|
||||
// }).on('hide.bs.modal', function (e) {
|
||||
// $("#notify_new_order").addClass("hidden");
|
||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
var shop_code = data.shop_code;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
@@ -19,21 +20,32 @@ 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/>"+
|
||||
target: document.getElementById(shop_code+"_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,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// $("#notify_order_ready_to_delivery_lists").text(order_lists);
|
||||
// if($("#notify_order_ready_to_delivery").hasClass("hidden")){
|
||||
// $("#notify_order_ready_to_delivery").removeClass("hidden");
|
||||
// }
|
||||
// $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){
|
||||
// $("#notify_new_order").addClass("hidden");
|
||||
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||
// }).on('shown.bs.modal', function(e){
|
||||
// $("#notify_order_ready_to_delivery").focus();
|
||||
// }).on('hide.bs.modal', function (e) {
|
||||
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend
|
||||
|
||||
received: function(data) {
|
||||
var order = data.data;
|
||||
var shop_code = data.shop_code;
|
||||
if(order.length > 0){
|
||||
var order_lists = "";
|
||||
$.each(order, function(key, value){
|
||||
@@ -19,21 +20,32 @@ 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/>"+
|
||||
target: document.getElementById(shop_code+"_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,
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
},function(isConfirm){
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
// $("#notify_order_send_to_kitchen_lists").text(order_lists);
|
||||
// if($("#notify_order_send_to_kitchen").hasClass("hidden")){
|
||||
// $("#notify_order_send_to_kitchen").removeClass("hidden");
|
||||
// }
|
||||
// $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){
|
||||
// $("#notify_new_order").addClass("hidden");
|
||||
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||
// }).on('shown.bs.modal', function(e){
|
||||
// $("#notify_order_send_to_kitchen").focus();
|
||||
// }).on('hide.bs.modal', function (e) {
|
||||
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -29,18 +29,21 @@ App.order_queue_station = App.cable.subscriptions.create('OrderQueueStationChann
|
||||
//end count
|
||||
|
||||
var date = new Date(items[field]["created_at"]);
|
||||
var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||
// var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||
var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM');
|
||||
|
||||
if (oqs_id == items[field]["order_queue_station_id"]) {
|
||||
|
||||
var table_type = (items[field]["table_type"] != null) ? items[field]["table_type"]:"";
|
||||
var zone = (items[field]["zone"] != null) ? "-"+items[field]["zone"]:"No Table";
|
||||
(name === 'true') ? 'Y' :'N';
|
||||
row ='<div class="card queue_station animated shake queue_station_box" data-order-no="'+items[field]["order_id"]+'">'
|
||||
+'<strong class="hidden">'+items[field]["order_id"]+'</strong>'
|
||||
+'<div class="card-block">'
|
||||
|
||||
|
||||
+'<div class="row">'
|
||||
+'<span class="col-md-4 order-zone-type font-13">'+items[field]["table_type"]+'-'+ items[field]["zone"] +'</span>'
|
||||
+'<span class="order-zone hidden font-14">'+ items[field]["zone"] +'</span>'
|
||||
+'<span class="col-md-4 order-zone-type font-13">'+table_type+''+ zone+'</span>'
|
||||
+'<span class="order-zone hidden font-14">'+ zone +'</span>'
|
||||
+'<span class="col-md-8"><small class="float-right font-13">'+items[field]["order_id"]+'</small></span>'
|
||||
+'</div>'
|
||||
+'<p class="m-b--10">'
|
||||
|
||||
@@ -3,26 +3,27 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
|
||||
|
||||
disconnected: function() {},
|
||||
|
||||
received: function(data) {
|
||||
received: function(data) {
|
||||
var shop_code = data.shop_code;
|
||||
var order = data.data;
|
||||
if(order.length > 0){
|
||||
$('.order_reserve_cable tbody').html("");
|
||||
$(".nav-item.red > a > p.num").text(order.length);
|
||||
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').html("");
|
||||
$("."+shop_code+" > .nav-item.red > a > p.num").text(order.length);
|
||||
$.each(order, function(key,value){
|
||||
var active_class = "";
|
||||
if(key==0){
|
||||
active_class = "tr-active";
|
||||
showNewOrder(order[key]);
|
||||
showNewOrder(order[key],shop_code);
|
||||
}
|
||||
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"){
|
||||
if(value.provider == "food2u" || value.provider == "yangondoor2door"){
|
||||
delivery_type = "DELIVERY";
|
||||
}else if(value.delivery_type == "pick_up"){
|
||||
}else if(value.provider == "pick_up"){
|
||||
delivery_type = "PICK-UP";
|
||||
}else{
|
||||
delivery_type = "DIRECT DELIVERY";
|
||||
@@ -42,7 +43,7 @@ App.order_reservation = App.cable.subscriptions.create('OrderReservationChannel'
|
||||
+'</td>'
|
||||
+' </tr>';
|
||||
|
||||
$('.custom-table.order_reserve_cable tbody').append(row);
|
||||
$('.custom-table.'+shop_code+'_order_reserve_cable tbody').append(row);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$('#modal-set-slimscroll').slimScroll({
|
||||
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||
height: height-$('#modal-set-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
@@ -62,6 +62,17 @@ $(document).ready(function() {
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 45
|
||||
});
|
||||
|
||||
$('#customer-info-slimscroll').slimScroll({
|
||||
height: height-$('#customer-info-slimscroll').attr('data-height'),
|
||||
size: '5px',
|
||||
color: 'rgba(0,0,0,0.5)',
|
||||
alwaysVisible: false,
|
||||
borderRadius: '0',
|
||||
railBorderRadius: '0',
|
||||
touchScrollStep : 45
|
||||
});
|
||||
|
||||
|
||||
// $('.delete').click(function(){
|
||||
// var method = $(this).attr('data-method');
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
$(function() {
|
||||
$("#discount").hide();
|
||||
$(".expected_time").hide();
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
$(".tbl_customer").hide();
|
||||
$(".order_close_cashier").hide();
|
||||
$(function() {
|
||||
$('.first-1').click();
|
||||
});
|
||||
@@ -11,6 +15,10 @@ $(function() {
|
||||
$(".nav-item").on("click", function(){
|
||||
type = $(this).attr("data-type");
|
||||
refreshDetailData();
|
||||
$('#accepted').hide();
|
||||
$('#cancel').hide();
|
||||
$(".tbl_customer").hide();
|
||||
$(".order_close_cashier").hide();
|
||||
if (type == "pending") {
|
||||
$(".first-1").click();
|
||||
$('#accepted').text("ACCEPT");
|
||||
@@ -24,18 +32,24 @@ $(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();
|
||||
$(".order_close_cashier").show();
|
||||
// $('#accepted').hide();
|
||||
// $('#cancel').hide();
|
||||
}
|
||||
// console.log(type);
|
||||
});
|
||||
|
||||
$("#accepted").on("click", function(){
|
||||
if($(this).text().trim() == "ACCEPT"){
|
||||
var requested_time = $("#requested_date_time").text();
|
||||
$("#status").text($(this).attr("data-value"));
|
||||
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");
|
||||
@@ -47,35 +61,155 @@ $(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);
|
||||
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;
|
||||
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
|
||||
}else{
|
||||
$("#waiting_time").val("");
|
||||
$("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
|
||||
callback_url(callback,ref_no,order_id,status,type,minutes);
|
||||
});
|
||||
|
||||
$('#order_close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/ordering/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
|
||||
$(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;
|
||||
}
|
||||
});
|
||||
|
||||
// $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); });
|
||||
|
||||
// $(".new_order_close").on("click",function(){
|
||||
// var code = $(this).attr("data-value");
|
||||
// $("#"+code+"_doemal_new_order").modal("hide");
|
||||
// });
|
||||
|
||||
// $("[data-dismiss='modal']").on('click', function() {
|
||||
// $('body').addClass('modal-open-fix');
|
||||
// if($('body').css("padding-right") == '15px') {
|
||||
// $('body').addClass('modal-open-fix-pad');
|
||||
// }
|
||||
// setTimeout(function() {
|
||||
// if($('body').hasClass('modal-open-fix-pad')) {
|
||||
// $('body').css('padding-right', '15px');
|
||||
// }
|
||||
// $('body').addClass('modal-open').removeClass('modal-open-fix, modal-open-fix-pad');
|
||||
// }, 1000);
|
||||
// });
|
||||
});
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: "Are you sure you want to close cashier?",
|
||||
type: "warning",
|
||||
showCancelButton: true
|
||||
}, function() {
|
||||
// Redirect the user
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
}
|
||||
|
||||
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");
|
||||
@@ -92,6 +226,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");
|
||||
@@ -99,6 +234,8 @@ function refreshDetailData(){
|
||||
$('#discount_amount').text("0.00");
|
||||
$('#total_tax').text("0.00");
|
||||
$('#grand_total').text("0.00");
|
||||
$(".tbl_customer").hide();
|
||||
$(".order_close_cashier").hide();
|
||||
}
|
||||
|
||||
//show order list
|
||||
@@ -112,20 +249,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('');
|
||||
@@ -156,7 +304,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');
|
||||
@@ -174,18 +323,21 @@ function show_order_detail(url,sr_no){
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
if(delivery.delivery_type == "service"){
|
||||
$("#trans_ref").text(data.transaction_ref);
|
||||
if(delivery.provider == "food2u" || delivery.provider == "yangondoor2door"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}else if(delivery.delivery_type == "pick_up"){
|
||||
$("#delivery_to").text("DELIVERY");
|
||||
}else if(delivery.provider == "pick_up"){
|
||||
$("#delivery_info").text("(PICK-UP)");
|
||||
$("#delivery_to").text("PICK-UP");
|
||||
}else{
|
||||
$("#delivery_info").text("(DIRECT DELIVERY)");
|
||||
$("#delivery_to").text("DIRECT DELIVERY");
|
||||
}
|
||||
|
||||
if(data.order_remark!=null && data.order_remark!=""){
|
||||
@@ -193,11 +345,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"]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -207,40 +370,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) {
|
||||
@@ -255,6 +420,18 @@ function callback_url(callback,ref_no,order_id,status,time,exptime){
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -278,26 +455,63 @@ function callback_url(callback,ref_no,order_id,status,time,exptime){
|
||||
function timeFormat(date){
|
||||
var isPM = date.getHours() >= 12;
|
||||
var isMidday = date.getHours() == 12;
|
||||
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
|
||||
date.getMinutes() || '00'].join(':') +
|
||||
(isPM ? ' PM' : 'AM');
|
||||
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
|
||||
(date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') +
|
||||
(isPM ? ' PM' : ' AM');
|
||||
return time;
|
||||
}
|
||||
|
||||
function showNewOrder(order_reservation){
|
||||
// console.log(order_reservation);
|
||||
function showNewOrder(order_reservation,shop_code){
|
||||
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('/'+shop_code+'-beep.mp3'); // define your audio
|
||||
// setTimeout(function(){
|
||||
// audio.loop = true;
|
||||
audio.play();
|
||||
// },10000);
|
||||
|
||||
// $("#new_order").text(order_reservation.order_reservation_id);
|
||||
// $("#new_order_date").text(requested_date);
|
||||
// if($("#"+shop_code+"_doemal_new_order").hasClass("hidden")){
|
||||
// $("#"+shop_code+"_doemal_new_order").removeClass("hidden");
|
||||
// }
|
||||
// $("#"+shop_code+"_doemal_new_order").on('show.bs.modal', function(e){
|
||||
// $("#notify_new_order").addClass("hidden");
|
||||
// $("#notify_order_send_to_kitchen").addClass("hidden");
|
||||
// $("#notify_order_ready_to_delivery").addClass("hidden");
|
||||
// }).on('shown.bs.modal', function(e){
|
||||
// $("#"+shop_code+"_doemal_new_order").focus();
|
||||
// }).on('hide.bs.modal', function (e) {
|
||||
// $("#"+shop_code+"_doemal_new_order").addClass("hidden");
|
||||
// }).modal({show: true, keyboard: false, backdrop: false});
|
||||
swal({
|
||||
html: true,
|
||||
title: 'Information',
|
||||
text: "You have new order <b>" + order_reservation.order_reservation_id + "</b> at <b>"+requested_date+"</b>",
|
||||
target: document.getElementById(shop_code+"_notify_new_order"),
|
||||
text: "You have new order "+
|
||||
"<b>"+order_reservation.order_reservation_id+"</b> requested for "+requested_date+"?",
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function (isConfirm) {
|
||||
if(isConfirm){
|
||||
audio.pause();
|
||||
swal.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
@@ -247,4 +247,27 @@ i.logout_icon{
|
||||
}
|
||||
.list-menu > a:hover{
|
||||
text-decoration: none;
|
||||
}
|
||||
.cashier_number{
|
||||
width: 33%;
|
||||
height:58px;
|
||||
line-height:58px;
|
||||
text-align:center;
|
||||
background:#54A5AF;
|
||||
// float:left;
|
||||
// margin:2px;
|
||||
font-size:20px;
|
||||
color:white;
|
||||
// cursor:pointer;
|
||||
}
|
||||
.border-top{
|
||||
border-top:1px solid #fff;
|
||||
}
|
||||
|
||||
.border-right{
|
||||
border-right:1px solid #fff;
|
||||
}
|
||||
|
||||
.border-left{
|
||||
border-left:1px solid #fff;
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
@import "BSBMaterial/style";
|
||||
@import "BSBMaterial/themes/all-themes";
|
||||
@import "reset";
|
||||
@import "fileinput.min";
|
||||
|
||||
|
||||
/* Reset */
|
||||
@@ -452,6 +453,10 @@ iframe {
|
||||
width: 150%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#receipt_pdf {
|
||||
height: 400px;
|
||||
}
|
||||
/* End iframe */
|
||||
|
||||
/* section class for webview */
|
||||
|
||||
@@ -6,53 +6,57 @@ 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 = OrderReservation.addCustomer(params)
|
||||
customer_id = customer.id
|
||||
end
|
||||
render :json => { :status => true, :data => { :customer_id => customer_id} }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
status = false
|
||||
if !params[:cus_info]
|
||||
render :json => { :status => false, :message => "cus_info is required!" }
|
||||
result = { :status => false, :message => "cus_info is required!" }
|
||||
elsif !params[:requested_time]
|
||||
render :json => { :status => false, :message => "requested_time is required!" }
|
||||
result = { :status => false, :message => "requested_time is required!" }
|
||||
elsif !params[:callback_url]
|
||||
render :json => { :status => false, :message => "callback_url is required!" }
|
||||
result = { :status => false, :message => "callback_url is required!" }
|
||||
elsif !params[:reference]
|
||||
render :json => { :status => false, :message => "reference is required!" }
|
||||
result = { :status => false, :message => "reference is required!" }
|
||||
elsif !params[:order_type]
|
||||
render :json => { :status => false, :message => "order_type is required!" }
|
||||
result = { :status => false, :message => "order_type is required!" }
|
||||
elsif params[:order_type] == ORDER || params[:order_type] == ORDER_RESERVATION
|
||||
if !params[:order_info]
|
||||
render :json => { :status => false, :message => "order_info is required!" }
|
||||
result = { :status => false, :message => "order_info is required!" }
|
||||
else
|
||||
status = true
|
||||
end
|
||||
elsif params[:order_type] == RESERVATION || params[:order_type] == ORDER_RESERVATION
|
||||
if !params[:reservation_info]
|
||||
render :json => { :status => false, :message => "reservation_info is required!" }
|
||||
result = { :status => false, :message => "reservation_info is required!" }
|
||||
else
|
||||
status = true
|
||||
end
|
||||
elsif !params[:payment_info]
|
||||
render :json => { :status => false, :message => "payment_info is required!" }
|
||||
result = { :status => false, :message => "payment_info is required!" }
|
||||
elsif !params[:delivery_info]
|
||||
render :json => { :status => false, :message => "delivery_info is required!" }
|
||||
result = { :status => false, :message => "delivery_info is required!" }
|
||||
end
|
||||
|
||||
if status == true
|
||||
@@ -60,15 +64,64 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
||||
order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation)
|
||||
|
||||
if flag #&& ENV["SERVER_MODE"] != 'cloud'
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.shop_code.nil?
|
||||
shop_code = shop.shop_code
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
|
||||
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||
order_reservation = OrderReservation.get_pending_orders #find(order_reservation_id)
|
||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation
|
||||
end
|
||||
|
||||
if flag
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" }
|
||||
ActionCable.server.broadcast "order_reservation_channel",data: order_reservation,shop_code: shop_code
|
||||
else
|
||||
render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
|
||||
result = { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is already existed!" }
|
||||
end
|
||||
end
|
||||
|
||||
puts "!!! send doemal ::"
|
||||
puts result
|
||||
|
||||
Rails.logger.debug "send status to doemal"
|
||||
Rails.logger.debug result
|
||||
render :json => result
|
||||
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
|
||||
|
||||
@@ -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!")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -18,7 +18,7 @@ module TokenVerification
|
||||
# Rails.logger.debug "token - " + token.to_s
|
||||
if(options.length !=0 && options["from"] == "DOEMAL")
|
||||
if(ENV["SERVER_MODE"] === "cloud")
|
||||
from = "local" #request.subdomain.downcase + "." + request.domain.downcase
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase #"local"
|
||||
aes = MyAesCrypt.new
|
||||
return aes.checkKeyForAuth(from, token)
|
||||
end
|
||||
|
||||
@@ -96,7 +96,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
|
||||
# POST /crm/customers
|
||||
# POST /crm/customers.json
|
||||
def create
|
||||
def create
|
||||
# Remove "" default first
|
||||
params[:customer][:tax_profiles].delete_at(0)
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -18,11 +18,15 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
if check_mobile
|
||||
@webview = true
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@table_id = params[:id]
|
||||
@table = DiningFacility.find(@table_id)
|
||||
@booking = @table.get_booking
|
||||
@@ -59,10 +63,12 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def get_item_instance
|
||||
@id = MenuItemInstance.find(params[:id])
|
||||
@instance = MenuItemInstance.find(params[:id])
|
||||
end
|
||||
|
||||
def get_menu()
|
||||
puts "sssssssssssssss"
|
||||
puts params[:id]
|
||||
if (params[:id])
|
||||
#Pull this menu
|
||||
@menu = Menu.find_by_id(params[:id])
|
||||
@@ -115,8 +121,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
|
||||
|
||||
@@ -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()
|
||||
@@ -56,6 +58,13 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
@current_user = current_user
|
||||
#dine-in cashier
|
||||
dinein_cashier = Lookup.collection_of('dinein_cashier')
|
||||
@dinein_cashier = 0
|
||||
if !dinein_cashier[0].nil?
|
||||
@dinein_cashier = dinein_cashier[0][1]
|
||||
end
|
||||
|
||||
#quick service
|
||||
quick_service = Lookup.collection_of('quick_service')
|
||||
@quick_service = 0
|
||||
@@ -74,4 +83,8 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
def get_all_menu
|
||||
@menus = Menu.all
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -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'
|
||||
@@ -132,7 +132,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
def check_emp_access_code
|
||||
pin_code = params[:code]
|
||||
employee = Employee.find_by_emp_id(pin_code)
|
||||
if employee && employee.role == "manager"
|
||||
if employee && (employee.role == "manager" || employee.role == "supervisor")
|
||||
result = {:status=> true, :message=>"Success" }
|
||||
else
|
||||
result = {:status=> false, :message=>"Invalid Access Code" }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -1,41 +1,43 @@
|
||||
class Origami::OrderReservationController < BaseOrigamiController
|
||||
|
||||
def index
|
||||
@order = OrderReservation.latest_order
|
||||
@order = OrderReservation.latest_order #.active
|
||||
@count_on_order = OrderReservation.get_count_on_order
|
||||
@count_on_completed = OrderReservation.get_count_on_completed
|
||||
@shop = Shop.find_by_id(1)
|
||||
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 +48,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
|
||||
|
||||
@@ -279,6 +279,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
@rounding_adj = new_total-saleObj.grand_total
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
|
||||
@sale_data.grand_total = new_total
|
||||
@sale_data.old_grand_total = saleObj.grand_total
|
||||
@sale_data.rounding_adjustment = @rounding_adj
|
||||
else
|
||||
@rounding_adj = @sale_data.rounding_adjustment
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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|
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -352,28 +352,6 @@ class Customer < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
#new customer for doemal
|
||||
def self.addCustomer(params)
|
||||
if params[:gender] == "female"
|
||||
gender = "Female"
|
||||
else
|
||||
gender = "Male"
|
||||
end
|
||||
customer = Customer.new
|
||||
customer.name = params[:name]
|
||||
customer.email = params[:email]
|
||||
customer.contact_no = params[:contact_no]
|
||||
customer.gender = params[:gender]
|
||||
customer.address = params[:address]
|
||||
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
||||
customer.membership_id = params[:membership_id]
|
||||
customer.customer_type = "Takeaway"
|
||||
customer.tax_profiles = ["2"]
|
||||
customer.save
|
||||
|
||||
return customer
|
||||
end
|
||||
|
||||
WALKIN = "CUS-000000000001"
|
||||
TAKEAWAY = "CUS-000000000002"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -64,7 +64,7 @@ class MyAesCrypt
|
||||
shop_json["data"].each do |j|
|
||||
if j["lookup"] == from
|
||||
# add [0...44] for production cloud for remove \n
|
||||
if(j["value"]["key"] == token)
|
||||
if(j["value"]["key"].gsub(/\s+/, "") == token)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,7 +57,11 @@ class OrderQueueStation < ApplicationRecord
|
||||
|
||||
if oqs.auto_print && order_source != "quick_service"
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
if oqs.cut_per_item
|
||||
print_slip_item(oqs, order, oqs_order_items)
|
||||
else
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
end
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
@@ -91,8 +95,12 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
|
||||
if oqs.auto_print && order_source != "quick_service"
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
if oqs_order_items.length > 0
|
||||
if oqs.cut_per_item
|
||||
print_slip_item(oqs, order, oqs_order_items)
|
||||
else
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
end
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
@@ -137,8 +145,12 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
if oqs_order_items.length > 0
|
||||
if oqs.cut_per_item
|
||||
print_slip_item(oqs, order, oqs_order_items)
|
||||
else
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
end
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
@@ -165,8 +177,12 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
|
||||
if oqs.auto_print
|
||||
if oqs_order_items.length > 0
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
if oqs_order_items.length > 0
|
||||
if oqs.cut_per_item
|
||||
print_slip_item(oqs, order, oqs_order_items)
|
||||
else
|
||||
print_slip(oqs, order, oqs_order_items)
|
||||
end
|
||||
is_auto_printed = true
|
||||
end
|
||||
end
|
||||
@@ -211,7 +227,7 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
|
||||
#Print order_item in 1 slip per item
|
||||
def print_slip_item(oqs, assigned_item)
|
||||
def print_slip_item(oqs, order, assigned_items)
|
||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||
unique_code="OrderItemPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
@@ -232,14 +248,17 @@ class OrderQueueStation < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
|
||||
# print when complete click
|
||||
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,item.order_id, order_item.order_items_id, print_status="" )
|
||||
|
||||
if !assigned_items.nil?
|
||||
assigned_items.each do |order_item|
|
||||
order_queue_printer.print_order_item(print_settings, oqs,order_item.order_id, order_item.order_items_id, print_status="" )
|
||||
end
|
||||
end
|
||||
# update print status for completed same order items
|
||||
assigned_order_item.each do |ai|
|
||||
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
end
|
||||
|
||||
@@ -7,6 +7,7 @@ class OrderReservation < ApplicationRecord
|
||||
has_many :order_reservation_items
|
||||
has_one :delivery
|
||||
|
||||
scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }
|
||||
scope :latest_order, -> { order("order_reservation_id desc, created_at desc") }
|
||||
|
||||
SEND_TO_KITCHEN = "send_to_kitchen"
|
||||
@@ -14,6 +15,28 @@ class OrderReservation < ApplicationRecord
|
||||
DELIVERED = "delivered"
|
||||
COMPLETED = "completed"
|
||||
|
||||
#new customer for doemal
|
||||
def self.addCustomer(params)
|
||||
if params[:gender] == "female"
|
||||
gender = "Female"
|
||||
else
|
||||
gender = "Male"
|
||||
end
|
||||
customer = Customer.new
|
||||
customer.name = params[:name]
|
||||
customer.email = params[:email]
|
||||
customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
|
||||
customer.gender = gender
|
||||
customer.address = params[:address] ? params[:address] : ''
|
||||
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
||||
customer.membership_id = params[:membership_id]
|
||||
customer.customer_type = "Takeaway"
|
||||
customer.tax_profiles = ["2"]
|
||||
customer.save
|
||||
|
||||
return customer
|
||||
end
|
||||
|
||||
def self.addOrderReservationInfo(order_reserve)
|
||||
Rails.logger.debug order_reserve.to_s
|
||||
check_order_reservation = OrderReservation.where("transaction_ref = ?",order_reserve[:reference])
|
||||
@@ -29,7 +52,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]
|
||||
@@ -39,7 +62,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]
|
||||
@@ -70,9 +93,6 @@ class OrderReservation < ApplicationRecord
|
||||
count += 1
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
puts items_arr.to_json
|
||||
puts "sssssssssssssssssssssss"
|
||||
customer_id = order.customer_id
|
||||
|
||||
@order = Order.new
|
||||
@@ -101,9 +121,12 @@ 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" }
|
||||
return result
|
||||
result = {:status=> @status, :data => @sale, :message => "send to kitchen" }
|
||||
else
|
||||
result = {:status=> @status, :message => "No current shift open for this employee!" }
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
def self.update_doemal_payment(order,current_user)
|
||||
@@ -137,7 +160,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")
|
||||
@@ -155,9 +178,10 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
Rails.logger.debug "Doemal URL" + base_url
|
||||
post_url = base_url + url
|
||||
|
||||
if !waiting_time.nil?
|
||||
send_params = {id: ref_no, waiting_time: waiting_time, status: status}
|
||||
if waiting_time != ""
|
||||
send_params = {id: ref_no,type: min_type, waiting_time: waiting_time, status: status}
|
||||
elsif reason != ""
|
||||
send_params = {id: ref_no, status: status, reason: reason}
|
||||
else
|
||||
send_params = {id: ref_no, status: status}
|
||||
end
|
||||
@@ -184,20 +208,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
|
||||
@@ -208,34 +289,80 @@ class OrderReservation < ApplicationRecord
|
||||
end
|
||||
|
||||
def self.check_new_order
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.shop_code.nil?
|
||||
shop_code = shop.shop_code
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
order_reservation = OrderReservation.where("status='new'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation
|
||||
ActionCable.server.broadcast "check_new_order_channel",data: order_reservation, shop_code: shop_code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_order_send_to_kitchen
|
||||
today = Time.now.utc
|
||||
order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}'")
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.shop_code.nil?
|
||||
shop_code = shop.shop_code
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
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
|
||||
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation, shop_code: shop_code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_order_ready_to_delivery
|
||||
today = Time.now.utc
|
||||
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}'")
|
||||
shop = Shop.find_by_id(1)
|
||||
if !shop.shop_code.nil?
|
||||
shop_code = shop.shop_code
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
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
|
||||
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation, shop_code: shop_code
|
||||
end
|
||||
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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,8 +4,8 @@ class OrderSetItemPdf < Prawn::Document
|
||||
def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty)
|
||||
self.page_width = print_settings.page_width
|
||||
self.page_height = print_settings.page_height
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
self.item_font_size = printer_settings.item_font_size.to_i
|
||||
self.header_font_size = print_settings.header_font_size.to_i
|
||||
self.item_font_size = print_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.price_width = 40 # No Need for item
|
||||
self.qty_width = 40
|
||||
|
||||
@@ -206,7 +206,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||
price = item.unit_price
|
||||
product_name = item.product_name
|
||||
total_qty += item.qty
|
||||
|
||||
y_position = cursor
|
||||
|
||||
|
||||
@@ -19,6 +19,14 @@ class CommissionerImageUploader < CarrierWave::Uploader::Base
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
if Shop.find(1).shop_code.nil?
|
||||
"#{original_filename}" if original_filename.present?
|
||||
else
|
||||
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
|
||||
end
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
@@ -19,6 +19,14 @@ class CustomerImageUploader < CarrierWave::Uploader::Base
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
if Shop.find(1).shop_code.nil?
|
||||
"#{original_filename}" if original_filename.present?
|
||||
else
|
||||
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
|
||||
end
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
@@ -19,6 +19,14 @@ class EmployeeImageUploader < CarrierWave::Uploader::Base
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
if Shop.find(1).shop_code.nil?
|
||||
"#{original_filename}" if original_filename.present?
|
||||
else
|
||||
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
|
||||
end
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
@@ -19,6 +19,14 @@ class MenuItemImageUploader < CarrierWave::Uploader::Base
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
if Shop.find(1).shop_code.nil?
|
||||
"#{original_filename}" if original_filename.present?
|
||||
else
|
||||
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
|
||||
end
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
@@ -19,6 +19,14 @@ class ProductImageUploader < CarrierWave::Uploader::Base
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
if Shop.find(1).shop_code.nil?
|
||||
"#{original_filename}" if original_filename.present?
|
||||
else
|
||||
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
|
||||
end
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
@@ -19,6 +19,14 @@ class ShopImageUploader < CarrierWave::Uploader::Base
|
||||
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
if Shop.find(1).shop_code.nil?
|
||||
"#{original_filename}" if original_filename.present?
|
||||
else
|
||||
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
|
||||
end
|
||||
end
|
||||
|
||||
# def cache_dir
|
||||
# '/tmp/images'
|
||||
# end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||
:membership_id, :membership_type, :membership_authentication_code,
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
@@ -185,7 +185,7 @@ $(document).on('click',".customer_tr",function(){
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
success: function(data) {
|
||||
// Selected for Taxes
|
||||
var taxes = JSON.stringify(data.tax_profiles);
|
||||
var parse_taxes = JSON.parse(taxes);
|
||||
@@ -193,7 +193,7 @@ $(document).on('click',".customer_tr",function(){
|
||||
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
|
||||
});
|
||||
|
||||
$('#customer_id').val(data.id);
|
||||
$('#customer_id').val(data.id);
|
||||
$('#customer_name').val(data.name);
|
||||
$('#customer_company').val(data.company);
|
||||
$('#customer_contact_no').val(data.contact_no);
|
||||
@@ -205,6 +205,9 @@ $(document).on('click',".customer_tr",function(){
|
||||
$('#paypar_account_no').val(data.paypar_account_no);
|
||||
$('#customer_address').val(data.address);
|
||||
$('#customer_date_of_birth').val(data.date_of_birth);
|
||||
if(data.image_path.url!=undefined && data.image_path.url!=null){
|
||||
$('.menu-item-img .img-thumbnail').attr('src',data.image_path.url);
|
||||
}
|
||||
$('#customer_membership_type').val(data.membership_type);
|
||||
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
|
||||
if (data.gender == 'Male') {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
|
||||
:membership_id, :membership_type, :membership_authentication_code,
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
|
||||
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
|
||||
json.url crm_customer_url(@crm_customer, format: :json)
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
<%= f.input :queue_no , :class => "dining",:id => "dining", :readonly => true%>
|
||||
<%= f.hidden_field :customer_id %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :contact_no %>
|
||||
<%= f.input :seater %>
|
||||
<%= f.input :contact_no , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notChar(this.value);" } %>
|
||||
<%= f.input :seater , input_html: { min: 1, :onkeypress => "return isNumberKey(event);", :onkeyup => "notNegative(this.value);" } %>
|
||||
<%= f.input :remark %>
|
||||
</div>
|
||||
<br>
|
||||
@@ -111,11 +111,29 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function notNegative(val){
|
||||
if(parseInt(val)< 1) $("#dining_queue_seater").val(0);
|
||||
}
|
||||
|
||||
function notNegative(val){
|
||||
if(typeof val == "string") $("#dining_queue_seater").val(0);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
if($('form').attr('id') == "new_dining_queue"){
|
||||
var queue_no = $('.generate_no').text();
|
||||
$('#dining_queue_queue_no').val(queue_no);
|
||||
var queue_no = $('.generate_no').text();
|
||||
$('#dining_queue_queue_no').val(queue_no);
|
||||
}
|
||||
|
||||
$( "input" ).focusin(function() {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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? %>
|
||||
<% 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 %>
|
||||
<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>
|
||||
</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">
|
||||
<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 quick_service or cashier for table -->
|
||||
<% else %>
|
||||
<% 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
|
||||
@@ -313,7 +325,7 @@
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="9" data-type="num">9</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="0" data-type="num">0</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left" data-value="00" data-type="num">00</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left orange" data-type="clr">Clr</div>
|
||||
<div class="col-md-3 cashier_number border-top border-left bg-orange" data-type="clr">Clr</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -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,13 +648,60 @@
|
||||
});
|
||||
|
||||
$(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);
|
||||
var menus = JSON.parse(localStorage.getItem("menus"));
|
||||
if (menus != null) {
|
||||
menu_click_cache_append(name,menus,menu_id);
|
||||
}else{
|
||||
var url = "get_menu/"+menu_id;
|
||||
show_menu_cat_list(name, url);
|
||||
}
|
||||
});
|
||||
//End menu category Click
|
||||
|
||||
function menu_click_cache_append(name,menus,menu_id) {
|
||||
var menu_list = $('.menu_items_list');
|
||||
menu_list.empty();
|
||||
|
||||
var menu_cat = $('.category_list');
|
||||
menu_cat.empty();
|
||||
|
||||
$(".main_menu").text(name);
|
||||
for(var i in menus) {
|
||||
console.log(menus)
|
||||
console.log(menus[i]["id"]);
|
||||
console.log(menus[i]["is_active"]);
|
||||
console.log(menu_id);
|
||||
if (menu_id == menus[i]["id"] && menus[i]["is_active"] == true) {
|
||||
// menu_list_template(menus[i]);
|
||||
var category = menus[i]["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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//show menu item list when click menu category
|
||||
function show_menu_cat_list(name, url_item){
|
||||
var menu_list = $('.menu_items_list');
|
||||
@@ -578,15 +710,18 @@
|
||||
var menu_cat = $('.category_list');
|
||||
menu_cat.empty();
|
||||
|
||||
$(".main_menu").text(name)
|
||||
if (modify_order=="true" && type =="true") {
|
||||
$(".main_menu").text(name);
|
||||
cashier_type = window.location.href.indexOf("quick_service");
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
if (cashier_type != -1 && modify_order != -1) {
|
||||
url_item = '../../../addorders/'+url_item;
|
||||
}if(modify_order=="false" && type =="true"){
|
||||
url_item = 'addorders/'+url_item
|
||||
}else{
|
||||
url_item = url_item;
|
||||
}
|
||||
|
||||
if(modify_order == -1 && cashier_type != -1){
|
||||
url_item = 'addorders/'+url_item
|
||||
}
|
||||
if (cashier_type ==-1 && modify_order == -1){
|
||||
url_item = url_item;
|
||||
}
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -594,10 +729,8 @@
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
for(var i in data) {
|
||||
if (data[i].is_available == true) {
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated fadeInRight menu_category sub_click" data-id="'+ data[i].id +'">'
|
||||
+' <div class="card-block custom-card-block">'
|
||||
+' <p>'+ data[i].name +'<p>'
|
||||
@@ -616,7 +749,6 @@
|
||||
+'</li>';
|
||||
$('.category_list').append(list);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -626,6 +758,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 +773,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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -207,6 +207,21 @@
|
||||
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><%= t("views.right_panel.detail.customer_photo") %></label>
|
||||
<div class="panel padding-10">
|
||||
<div class="menu-item-img">
|
||||
<% if f.object.image_path? %>
|
||||
<p><%= f.object.name %></p>
|
||||
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
|
||||
<% else %>
|
||||
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= f.file_field :image_path, :class => "img-thumbnail" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><%= t("views.right_panel.detail.select_customer_type") %></label>
|
||||
<select class="form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >
|
||||
|
||||
36
app/views/origami/dashboard/_menu.json.jbuilder
Normal file
36
app/views/origami/dashboard/_menu.json.jbuilder
Normal 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
|
||||
15
app/views/origami/dashboard/get_all_menu.json.jbuilder
Normal file
15
app/views/origami/dashboard/get_all_menu.json.jbuilder
Normal 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
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @dinein_cashier == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
|
||||
<div class="info-box bg-green">
|
||||
<div class="icon" >
|
||||
@@ -36,6 +37,7 @@
|
||||
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @order_reservation == '1' %>
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation">
|
||||
<div class="info-box bg-blue">
|
||||
@@ -205,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';
|
||||
@@ -221,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>
|
||||
@@ -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;
|
||||
|
||||
@@ -487,8 +487,13 @@
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<!-- <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" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> -->
|
||||
<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>
|
||||
<% 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" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if current_login_employee.role != "waiter" %>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
@@ -1005,6 +1010,7 @@
|
||||
|
||||
$('#add_order').on('click', function () {
|
||||
var dining_id = "<%= @dining.id %>";
|
||||
|
||||
window.location.href = '/origami/addorders/' + dining_id;
|
||||
});
|
||||
|
||||
@@ -1111,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"){
|
||||
|
||||
@@ -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">
|
||||
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">
|
||||
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>
|
||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||
<% elsif @status_order == 'order' && !@customer.nil?
|
||||
%>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||
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>
|
||||
|
||||
@@ -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">
|
||||
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">
|
||||
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">
|
||||
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">
|
||||
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>
|
||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||
<% elsif @status_order == 'order' && !@customer.nil?
|
||||
%>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||
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>
|
||||
Customer : <%= @sale_array[0].customer.name rescue '' %>
|
||||
<% elsif @status_order == 'order' && !@customer.nil?
|
||||
%>
|
||||
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
|
||||
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 %>";
|
||||
|
||||
@@ -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|
|
||||
|
||||
@@ -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">
|
||||
<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>
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 div_order_margin">
|
||||
<ul class="nav nav-tabs tab-col-teal <%= @shop.shop_code ? @shop.shop_code : '' %>" role="tablist">
|
||||
<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>
|
||||
|
||||
@@ -50,7 +67,7 @@
|
||||
<div class="tab-pane active" id="pending" role="tabpanel">
|
||||
<div class="card-block font-13">
|
||||
<div id="menu-slimscroll" data-height="50">
|
||||
<table class="table table-stripe custom-table order_reserve_cable">
|
||||
<table class="table table-stripe custom-table <%= @shop.shop_code ? @shop.shop_code : '' %>_order_reserve_cable">
|
||||
<tbody>
|
||||
<% i=1
|
||||
@order.each do |order| %>
|
||||
@@ -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,47 +384,55 @@
|
||||
</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>
|
||||
<td width ="" class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
|
||||
<td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-block">
|
||||
<table class="table">
|
||||
<div class="card-block" id="customer-info-slimscroll" data-height="95">
|
||||
<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>
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<span class="font-13">REF.</span><br>
|
||||
<b id="trans_ref"></b>
|
||||
</td>
|
||||
<td class="body-td align-right">
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
<span class="font-13">REQUESTED TIME</span><br>
|
||||
<b id="requested_time"></b>
|
||||
</td>
|
||||
<td class="body-td align-right expected_time">
|
||||
<span class="font-13">COOKING TIME</span><br>
|
||||
<b><span id="expected_time"></span> MINS</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<span class="font-13">NAME</span><br>
|
||||
<b id="customer_name"></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<span class="font-13">PHONE</span><br>
|
||||
<b id="phone"></b>
|
||||
</td>
|
||||
<td class="body-td align-right expected_time">
|
||||
<span class="font-13">EXPECTED TIME</span><br>
|
||||
<b id="expected_time"></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<span class="font-13">ADDRESS</span><br>
|
||||
<b id="address"></b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="body-td align-left">
|
||||
<td colspan="2" class="body-td align-left">
|
||||
<span class="font-13">DELEVERY</span><br>
|
||||
<b id="delivery_to"></b>
|
||||
</td>
|
||||
@@ -372,13 +443,33 @@
|
||||
<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 class="card-footer order_close_cashier">
|
||||
<% if current_user.role != "waiter" %>
|
||||
<div class="row">
|
||||
<div class="col-sm-7 col-xs-7 col-md-7 col-lg-7"></div>
|
||||
<div class="col-sm-4 col-xs-4 col-md-4 col-lg-4">
|
||||
<button id="order_close_cashier" class="align-right text-center btn btn-md btn-link btn-primary waves-effect"><%= t("views.btn.close_cashier") %></button>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_new_order"></div>
|
||||
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_new_order"></div>
|
||||
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div>
|
||||
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p id="ref_no" class="hidden"></p>
|
||||
<p id="callback_url" class="hidden"></p>
|
||||
<p id="order_id" class="hidden"></p>
|
||||
@@ -391,24 +482,193 @@
|
||||
<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;">×</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="<%= @shop.shop_code ? @shop.shop_code : '' %>_doemal_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="doemal_new_orderLabel">New Order</h4><hr>
|
||||
</div>
|
||||
<div class="modal-body doemal_new_orderBody">
|
||||
<div class="form-group text-center">
|
||||
You have new order <b><span id="new_order"></span></b> requested for <b><span id="new_order_date"></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 new_order_close" data-value="<%= @shop.shop_code ? @shop.shop_code : '' %>" data-dismiss="modal">CLOSE</button>
|
||||
</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> -->
|
||||
|
||||
@@ -350,20 +350,30 @@
|
||||
<i class="material-icons">reply</i>
|
||||
Back
|
||||
</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>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
|
||||
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</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" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button> -->
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
|
||||
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
|
||||
<% end %>
|
||||
|
||||
<% if @cashier_type=="quick_service" %>
|
||||
<hr>
|
||||
|
||||
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
|
||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</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>
|
||||
<% else %>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<% end %>
|
||||
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
<!-- Waiter Buttons -->
|
||||
@@ -419,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">
|
||||
@@ -671,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,
|
||||
@@ -1331,4 +1341,4 @@ var customer_name = "<%= @customer.name %>";
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -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>
|
||||
@@ -514,6 +519,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</div>
|
||||
<div class="modal-footer ">
|
||||
<div class="row p-r-20">
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="waste_spoileModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
@@ -539,6 +567,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;">×</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,25 +999,61 @@ $('#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 () {
|
||||
var sure = confirm("Are you sure want to Void");
|
||||
if (sure == true) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
success: function () {
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// $('#void').on('click',function () {
|
||||
// var sure = confirm("Are you sure want to Void");
|
||||
// if (sure == true) {
|
||||
// var sale_id = $('#sale_id').val();
|
||||
// var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
// $.ajax({
|
||||
// type: 'POST',
|
||||
// url: ajax_url,
|
||||
// success: function () {
|
||||
// window.location.href = '/origami/';
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
$('#void').on('click', function () {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
if ($(this).attr('active')=== "true") {
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, void it!",
|
||||
closeOnConfirm: false
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/cashier/void';
|
||||
var remark = $("#remark").val();
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
|
||||
success: function (result) {
|
||||
// For Server Print - from jade
|
||||
if ($("#server_mode").val() == "cloud") {
|
||||
code2lab.printFile(result.filepath.substr(6), result.printer_url);
|
||||
}
|
||||
window.location.href = '/origami/';
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal("Opps","You are not authorized for void","warning")
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#commissions').on('click', function () {
|
||||
var dining_id = "<%= @room.id %>"
|
||||
@@ -1042,4 +1139,40 @@ $('#add_invoice').on('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") {
|
||||
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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,13 +213,75 @@
|
||||
<!-- 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' %>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
|
||||
<% end %>
|
||||
|
||||
<% 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 %>
|
||||
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
|
||||
</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;">×</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>
|
||||
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||
</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="void" active="true">VOID</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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".tables").on('click', function(){
|
||||
@@ -247,7 +324,14 @@ $('#back').on('click',function(){
|
||||
// // });
|
||||
// }
|
||||
// });
|
||||
|
||||
$(document).on('click', '.access_modal', function(event){
|
||||
type = $(this).data("type");
|
||||
$(".ok").attr("data-action",type)
|
||||
$('#AccessCodeModal').modal('show');
|
||||
});
|
||||
$('#void').on('click', function () {
|
||||
var access_code = localStorage.getItem("access_code");
|
||||
swal({
|
||||
title: "Alert",
|
||||
text: "Are you sure want to Void?",
|
||||
@@ -259,10 +343,12 @@ $('#back').on('click',function(){
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
|
||||
// var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: ajax_url,
|
||||
data: {'access_code':access_code},
|
||||
success: function () {
|
||||
window.location.href = '/origami/sale/'+sale_id;
|
||||
}
|
||||
@@ -271,10 +357,52 @@ $('#back').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 = $('#dining').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
if (dining_id) {
|
||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||
}else{
|
||||
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_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")
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#re-print').click(function() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||
|
||||
return false;
|
||||
// return false;
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn bg-default btn-block" id='back'><i class="material-icons">reply</i> <%= t("views.btn.back") %> </button>
|
||||
<button type="button" class="btn bg-blue btn-block green" id='close_cashier'> <%= t("views.btn.close_cashier") %> </button>
|
||||
<% if @bank_integration == '1' %>
|
||||
<% if @bank_integration == '1' && @cashier_type!="ordering" %>
|
||||
<button type="button" class="btn bg-blue btn-block green" id="card_settlement"> <%= t("views.btn.card_settle") %> </button>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -73,10 +73,12 @@
|
||||
});
|
||||
|
||||
$('#back').on('click',function(){
|
||||
if(cashier_type!='quick_service'){
|
||||
if(cashier_type=='cashier'){
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
}else if(cashier_type=='quick_service'){
|
||||
window.location.href = '/origami/quick_service';
|
||||
}else{
|
||||
window.location.href = '/origami/order_reservation';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :child, input_html: { value: @survey_data.child, class: 'col-md-10', :onChange => "total_customer();" }%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
@@ -67,29 +67,29 @@
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :child , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
|
||||
<%= f.input :child , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :adult , input_html: { class: 'col-md-10' , :onChange => "total_customer();"}%>
|
||||
<%= f.input :adult , input_html: { class: 'col-md-10' ,min:'1', :onChange => "total_customer();"}%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row clearfix">
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :male , input_html: { class: 'col-md-10' }%>
|
||||
<%= f.input :male , input_html: { min:'1',class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 ">
|
||||
<div class="form-group p-l-10 p-r-10">
|
||||
<%= f.input :female , input_html: { class: 'col-md-10' }%>
|
||||
<%= f.input :female , input_html: { min:'1',class: 'col-md-10' }%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= f.input :total_customer, input_html: { :readonly => true, class: 'col-md-11'} %>
|
||||
<%= f.input :local , input_html: { class: 'col-md-11' }%>
|
||||
<%= f.input :total_customer, input_html: { :readonly => true,min:'1', class: 'col-md-11'} %>
|
||||
<%= f.input :local , input_html: { min:'1',class: 'col-md-11' }%>
|
||||
|
||||
<fieldset style="border: 1px solid #BDBDBD;padding: 20px; width: 92%;margin: 20px 0 20px 0;">
|
||||
<legend style="font-size: 1.2em !important;font-weight: bold !important;text-align: left !important;border:none;width:100px;">Foreigner</legend>
|
||||
|
||||
@@ -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;">×</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>
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
@@ -151,23 +151,23 @@
|
||||
|
||||
<% total_tax = 0 %>
|
||||
<% unless @tax.empty? %>
|
||||
<% @tax.each do |tax| %>
|
||||
<% total_tax += tax.tax_amount.to_f %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
<% @tax.each do |tax| %>
|
||||
<% total_tax += tax.tax_amount.to_f %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="17" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(tax.tax_amount, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% net = total - total_tax %>
|
||||
<tr style="font-weight:600;">
|
||||
<td colspan="17" style='text-align:right;'><%= t("views.right_panel.detail.net_amount") %></td>
|
||||
<td style='text-align:right;'><%= number_with_precision(net, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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"> </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"> </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){
|
||||
|
||||
|
||||
@@ -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"> </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"> </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>
|
||||
|
||||
@@ -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"> </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"> </td>
|
||||
|
||||
@@ -59,16 +59,18 @@
|
||||
<% unless @sale_data.blank? %>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<!-- all total qty sum -->
|
||||
<!--
|
||||
|
||||
<% if sale.status_type != "Discount" && sale.status_type != "foc"
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
<% if sale.status_type == "foc" && sale.price > 0
|
||||
total_qty += sale.total_item
|
||||
end %>
|
||||
-->
|
||||
<% if sale.status_type == "Discount"
|
||||
total_qty += sale.total_item*(-1)
|
||||
end %>
|
||||
<!-- end all total qty -->
|
||||
<!--
|
||||
|
||||
<% if sale.status_type == "foc" && sale.grand_total < 0
|
||||
total_item_foc += sale.grand_total*(-1)
|
||||
end %>
|
||||
@@ -76,7 +78,7 @@
|
||||
<% if sale.status_type == "Discount" && sale.grand_total < 0
|
||||
total_item_dis += sale.grand_total*(-1)
|
||||
end %>
|
||||
-->
|
||||
|
||||
<% if !acc_arr.include?(sale.account_id) %>
|
||||
<tr>
|
||||
<td><b><%= sale.account_name %></b></td>
|
||||
@@ -103,7 +105,12 @@
|
||||
<% end %>
|
||||
<td><%= sale.item_code rescue '-' %></td>
|
||||
<td><%= sale.product_name rescue '-' %></td>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<% if sale.status_type != "Discount" %>
|
||||
<td><%= sale.total_item rescue '-' %></td>
|
||||
<%else%>
|
||||
<td><%= sale.total_item*(-1) rescue '-' %></td>
|
||||
<% end %>
|
||||
|
||||
<td><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
<td><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
</tr>
|
||||
@@ -114,10 +121,12 @@
|
||||
<% count = count + 1 %>
|
||||
<% sub_total += sale.grand_total %>
|
||||
<% #sub_qty += sale.total_item %>
|
||||
<% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC")
|
||||
<% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC")
|
||||
sub_qty += sale.total_item
|
||||
end %>
|
||||
|
||||
<% if sale.status_type =="Discount"
|
||||
sub_qty += sale.total_item*(-1)
|
||||
end %>
|
||||
<% if count == value %>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
|
||||
@@ -5,52 +5,77 @@
|
||||
|
||||
<table class="table table-striped" border="0">
|
||||
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% receipt_arr = Array.new %>
|
||||
<% menu_cat_arr = Array.new %>
|
||||
<% footer_arr = Array.new %>
|
||||
<% count = 0 %>
|
||||
<% waste_and_spoil_item_count = 0%>
|
||||
<thead>
|
||||
<tr>
|
||||
<td >
|
||||
<strong>Receipt No :<%= sale.receipt_no %></strong>
|
||||
</td>
|
||||
<td></td>
|
||||
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td ><strong>Item Name</strong></td>
|
||||
<td ><strong>Item Code</strong></td>
|
||||
<td><strong>Qty</strong></td>
|
||||
<td><strong>Price</strong></td>
|
||||
<td><strong>Total Price</strong></td>
|
||||
</tr>
|
||||
|
||||
<% @sale_data.each do |sale| %>
|
||||
<% if !receipt_arr.include?(sale.receipt_no) %>
|
||||
<thead>
|
||||
<td> </td>
|
||||
<tr>
|
||||
<td >
|
||||
<strong>Receipt No :<%= sale.receipt_no %></strong>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Menu Category</strong></td>
|
||||
<td><strong>Item Name</strong></td>
|
||||
<td><strong>Item Code</strong></td>
|
||||
<td><strong>Qty</strong></td>
|
||||
<td><strong>Price</strong></td>
|
||||
<td><strong>Total Price</strong></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<% receipt_arr.push(sale.receipt_no) %>
|
||||
<% menu_cat_arr.clear %>
|
||||
<% count = 0 %>
|
||||
<% end %>
|
||||
|
||||
<% sale.sale_items.each do |item| %>
|
||||
<% if !item.item_instance_code.nil?%>
|
||||
<% waste_and_spoil_item_count += item.qty.to_i%>
|
||||
<tr>
|
||||
<td><%= item.product_name %></td>
|
||||
<td><%= item.product_code %></td>
|
||||
<td><%= item.qty %></td>
|
||||
<td><%= item.price %></td>
|
||||
<td><%= item.price %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
|
||||
<td><span class="underline" style="text-align:right">
|
||||
<strong><%= waste_and_spoil_item_count %></strong>
|
||||
</span></td>
|
||||
<td style="text-align:right"> <strong>Grand Total: </strong></td>
|
||||
<td >
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= sale.grand_total %></strong>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<% end %>
|
||||
<tbody>
|
||||
|
||||
<% if !sale.item_instance_code.nil?%>
|
||||
<% waste_and_spoil_item_count += sale.qty.to_i %>
|
||||
<tr>
|
||||
<% if !menu_cat_arr.include?(sale.name) %>
|
||||
<td><%= sale.name %></td>
|
||||
<% menu_cat_arr.push(sale.name) %>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<% end %>
|
||||
<td><%= sale.product_name %></td>
|
||||
<td><%= sale.product_code %></td>
|
||||
<td><%= sale.qty.to_i %></td>
|
||||
<td><%= sale.unit_price %></td>
|
||||
<td><%= sale.price %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% count = count + 1 %>
|
||||
<% if sale.sale_items.count == count %>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
|
||||
<td>
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= waste_and_spoil_item_count %></strong>
|
||||
<% waste_and_spoil_item_count = 0%>
|
||||
</span></td>
|
||||
<td style="text-align:right"> <strong>Grand Total: </strong></td>
|
||||
<td >
|
||||
<span class="underline" style="text-align:right">
|
||||
<strong><%= sale.grand_total %></strong>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<% footer_arr.push(sale.sale_id) %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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: "ကောက်ခံသည်"
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||
# and maximum, this matches the default thread size of Active Record.
|
||||
#
|
||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
||||
threads threads_count, threads_count
|
||||
|
||||
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
||||
#
|
||||
port ENV.fetch("PORT") { 3000 }
|
||||
|
||||
# Specifies the `environment` that Puma will run in.
|
||||
#
|
||||
environment ENV.fetch("RAILS_ENV") { "development" }
|
||||
|
||||
# Specifies the number of `workers` to boot in clustered mode.
|
||||
# Workers are forked webserver processes. If using threads and workers together
|
||||
# the concurrency of the application would be max `threads` * `workers`.
|
||||
# Workers do not work on JRuby or Windows (both of which do not support
|
||||
# processes).
|
||||
#
|
||||
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
||||
|
||||
# Use the `preload_app!` method when specifying a `workers` number.
|
||||
# This directive tells Puma to first boot the application and load code
|
||||
# before forking the application. This takes advantage of Copy On Write
|
||||
# process behavior so workers use less memory. If you use this option
|
||||
# you need to make sure to reconnect any threads in the `on_worker_boot`
|
||||
# block.
|
||||
#
|
||||
# preload_app!
|
||||
|
||||
# The code in the `on_worker_boot` will be called if you are using
|
||||
# clustered mode by specifying a number of `workers`. After each worker
|
||||
# process is booted this block will be run, if you are using `preload_app!`
|
||||
# option you will want to use this block to reconnect to any threads
|
||||
# or connections that may have been created at application boot, Ruby
|
||||
# cannot share connections between processes.
|
||||
#
|
||||
# on_worker_boot do
|
||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||
# end
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
|
||||
plugin :tmp_restart
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@ every 1.minutes do
|
||||
runner "DiningFacility.checkin_time"
|
||||
end
|
||||
|
||||
every 3.minutes do
|
||||
every 10.minutes do
|
||||
runner "OrderReservation.check_new_order"
|
||||
end
|
||||
|
||||
every 5.minutes do
|
||||
every 10.minutes do
|
||||
runner "OrderReservation.check_order_send_to_kitchen"
|
||||
end
|
||||
|
||||
every 5.minutes do
|
||||
every 10.minutes do
|
||||
runner "OrderReservation.check_order_ready_to_delivery"
|
||||
end
|
||||
@@ -13,6 +13,20 @@
|
||||
"key": "634W2ioj6QA88vafKamHBRu5aKX/BLIPdTWuuXGFBsA=\n",
|
||||
"iv": "QqpO/h7o60dYTbNETRbZ4g==\n"
|
||||
}
|
||||
},
|
||||
{
|
||||
"lookup": "order-111.pos-myanmar.test",
|
||||
"value": {
|
||||
"key": "7NA6WkE58MZ56w6CUPEyUN5ZlWzuidRDkc2ao6LeHTs=\n",
|
||||
"iv": "B94kSYIdH6ff8s1ltQzB1Q==\n"
|
||||
}
|
||||
},
|
||||
{
|
||||
"lookup": "aungcafe-212.pos-myanmar.test",
|
||||
"value": {
|
||||
"key": "DvPxzB6QjHNnfuxBz6rdOuSn0/5TkckwCu3jNv0geHY=\n",
|
||||
"iv": "pJ5k8JKbfti70KQoLZCm/Q==\n"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
|
||||
t.string :order_reservation_id, :limit => 16, :primary_key => true
|
||||
t.string :order_reservation_type, :null => false
|
||||
t.string :customer_id, :null => false
|
||||
t.datetime :requested_time, :null => false
|
||||
t.string :requested_time, :null => false
|
||||
t.string :callback_url, :null => false
|
||||
t.string :transaction_ref, :null => false
|
||||
t.string :sale_id
|
||||
@@ -21,7 +21,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
|
||||
t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :status, :null => false, :default => "new"
|
||||
t.string :order_remark
|
||||
t.string :reservation_remark
|
||||
t.string :remark
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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.mp3
Normal file
BIN
public/beep.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user