From 05fff8c136b94c79784c699c4bb624de571c333c Mon Sep 17 00:00:00 2001 From: Zin Moe Date: Fri, 13 Mar 2020 12:10:18 +0630 Subject: [PATCH 1/5] add pending order --- app/assets/javascripts/addorder.js | 38 +- app/assets/stylesheets/addorder.scss | 2 +- .../foodcourt/orders_controller.rb | 198 ++++++++- app/models/card_sale_tran.rb | 2 +- app/models/card_settle_tran.rb | 2 +- app/models/sale.rb | 14 +- app/views/foodcourt/addorders/detail.html.erb | 24 +- .../foodcourt/orders/app_orders.html.erb | 400 +++++++++++++++--- app/views/foodcourt/payments/show.html.erb | 5 +- config/routes.rb | 3 + 10 files changed, 591 insertions(+), 97 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 6ea9abf6..e26374c0 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1014,7 +1014,8 @@ $(function() { dataType: "json", success:function(result){ if (type == "quick_service" || type=="food_court") { - window.location.href = "/origami/"+type; + module_name = window.location.href.includes('foodcourt') ? 'foodcourt' : 'origami' + window.location.href = "/"+module_name+"/"+type; }else{ if(table_type == "Table"){ window.location.href = "/origami/table/" + table_id; @@ -1093,7 +1094,13 @@ $(function() { }); }else if(result.data == 'OK'){ - window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text(); + if (window.location.pathname.includes('foodcourt')) { + order_id = $('#order_id').val() + window.location.href = '/foodcourt/food_court/'+order_id+'/request_bill' + } + else { + window.location.href = '/origami/'+type+'/pending_order/' + $('#sale_id').text(); + } }else{ if(result.current_user_role == 'cashier'){ window.location.href = "/foodcourt/sale/"+result.data["sale_id"]+"/"+type+"/payment"; @@ -1601,20 +1608,22 @@ $(function() { image_path = menu_items[field].image; } if (out_of_stock === true) { - oos_item = out_of_stock_item - oos_item = '
' - oos_header = '
OUT OF STOCK
' + // oos_item = out_of_stock_item + oos_item = '
' + oos_header = '
OUT OF STOCK
' + opacity = 0.5 }else{ - oos_item = '
' + oos_item = '
' oos_header = '' + opacity = '' } - row = '
' + row = '
' + oos_item + oos_header - +'
' + +'
' +'
'+ menu_items[field].name +'
' +'
' - +"
" + + '' +'
' - +'