From 916dbf2cd37f1c04691cf542047432c5407fd684 Mon Sep 17 00:00:00 2001 From: San Wai Lwin Date: Mon, 14 May 2018 16:00:31 +0630 Subject: [PATCH] Pull from master --- app/assets/javascripts/addorder.js | 2 +- .../javascripts/channels/check_new_order.js | 51 ++++++++-------- .../channels/check_order_ready_to_delivery.js | 51 ++++++++-------- .../channels/check_order_send_to_kitchen.js | 51 ++++++++-------- app/assets/javascripts/order_reservation.js | 57 +++++++++--------- app/assets/stylesheets/addorder.scss | 4 ++ app/models/menu.rb | 32 ++++++---- app/views/origami/addorders/detail.html.erb | 2 +- app/views/origami/dashboard/index.html.erb | 16 ++++- app/views/origami/home/show.html.erb | 8 ++- .../origami/order_reservation/index.html.erb | 18 +++--- app/views/origami/payments/show.html.erb | 18 +++--- config/environments/development.rb | 2 +- public/AC-beep.mp3 | Bin 0 -> 63528 bytes 14 files changed, 173 insertions(+), 139 deletions(-) create mode 100644 public/AC-beep.mp3 diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 344e663b..8b9c4e01 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1373,7 +1373,7 @@ $(function() { if (JSON.stringify(menu_items[field].item_sets)!='[]') { fa_plus = ''; add = ''; - menu_item_box = 'add_icon'; + menu_item_box = 'set_add_icon'; data_target = 'sx_item_set_detailModal'; data_modal = 'modal' add_icon = "set_item_box" diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js index a6317af6..92e0e715 100644 --- a/app/assets/javascripts/channels/check_new_order.js +++ b/app/assets/javascripts/channels/check_new_order.js @@ -19,33 +19,34 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', { }); // alert(order_lists); - swal({ - title: 'Information', - target: document.getElementById(shop_code+"_notify_new_order"), - text: "You have new orders
"+ - "Are you accept or reject for these orders "+order_lists+"?", - type: 'success', - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function (isConfirm) { - if(isConfirm){ - swal.close(); - } - }); - // $("#notify_new_order_lists").text(order_lists); + // swal({ + // title: 'Information', + // target: document.getElementById(shop_code+"_notify_new_order"), + // text: "You have new orders
"+ + // "Are you accept or reject for these orders "+order_lists+"?", + // type: 'success', + // html: true, + // closeOnConfirm: false, + // closeOnCancel: false, + // allowOutsideClick: false + // }, 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").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}); + $("#notify_new_order").on('shown.bs.modal', function(e){ + $(document).off('focusin.modal'); + $("#notify_new_order").focus(); + $("#"+shop_code+"_doemal_new_order").addClass("hidden"); + $("#notify_order_send_to_kitchen").addClass("hidden"); + $("#notify_order_ready_to_delivery").addClass("hidden"); + }).on('hide.bs.modal', function (e) { + $("#notify_new_order").addClass("hidden"); + }).modal({show: true, keyboard: false, backdrop: false}); } } }); diff --git a/app/assets/javascripts/channels/check_order_ready_to_delivery.js b/app/assets/javascripts/channels/check_order_ready_to_delivery.js index 319f7781..05a257b3 100644 --- a/app/assets/javascripts/channels/check_order_ready_to_delivery.js +++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js @@ -19,33 +19,34 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe }); // alert(order_lists); - swal({ - title: 'Information', - target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"), - text: "You have orders that are ready to deliver
"+ - "Could you ready these orders "+order_lists+" to deliver?", - type: 'success', - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function (isConfirm) { - if(isConfirm){ - swal.close(); - } - }); - // $("#notify_order_ready_to_delivery_lists").text(order_lists); + // swal({ + // title: 'Information', + // target: document.getElementById(shop_code+"_notify_order_ready_to_delivery"), + // text: "You have orders that are ready to deliver
"+ + // "Could you ready these orders "+order_lists+" to deliver?", + // type: 'success', + // html: true, + // closeOnConfirm: false, + // closeOnCancel: false, + // allowOutsideClick: false + // }, function (isConfirm) { + // if(isConfirm){ + // swal.close(); + // } + // }); + $("#notify_order_ready_to_delivery_lists").text(order_lists); // if($("#notify_order_ready_to_delivery").hasClass("hidden")){ - // $("#notify_order_ready_to_delivery").removeClass("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}); + $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){ + // $(document).off('focusin.modal'); + $("#notify_order_ready_to_delivery").focus(); + $("#"+shop_code+"_doemal_new_order").addClass("hidden"); + $("#notify_new_order").addClass("hidden"); + $("#notify_order_send_to_kitchen").addClass("hidden"); + }).on('hide.bs.modal', function (e) { + $("#notify_order_ready_to_delivery").addClass("hidden"); + }).modal({show: true, keyboard: false, backdrop: false}); } } }); diff --git a/app/assets/javascripts/channels/check_order_send_to_kitchen.js b/app/assets/javascripts/channels/check_order_send_to_kitchen.js index df9eb324..f9432810 100644 --- a/app/assets/javascripts/channels/check_order_send_to_kitchen.js +++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js @@ -19,33 +19,34 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend }); // alert(order_lists); - swal({ - title: 'Information', - target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"), - text: "You have to send order to kitchen
"+ - "Could you send these orders "+order_lists+" to kitchen?", - type: 'success', - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function (isConfirm) { - if(isConfirm){ - swal.close(); - } - }); - // $("#notify_order_send_to_kitchen_lists").text(order_lists); + // swal({ + // title: 'Information', + // target: document.getElementById(shop_code+"_notify_order_send_to_kitchen"), + // text: "You have to send order to kitchen
"+ + // "Could you send these orders "+order_lists+" to kitchen?", + // type: 'success', + // html: true, + // closeOnConfirm: false, + // closeOnCancel: false, + // allowOutsideClick: false + // }, function (isConfirm) { + // if(isConfirm){ + // swal.close(); + // } + // }); + $("#notify_order_send_to_kitchen_lists").text(order_lists); // if($("#notify_order_send_to_kitchen").hasClass("hidden")){ - // $("#notify_order_send_to_kitchen").removeClass("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}); + $("#notify_order_send_to_kitchen").on('shown.bs.modal', function(e){ + // $(document).off('focusin.modal'); + $("#notify_order_send_to_kitchen").focus(); + $("#"+shop_code+"_doemal_new_order").addClass("hidden"); + $("#notify_new_order").addClass("hidden"); + $("#notify_order_ready_to_delivery").addClass("hidden"); + }).on('hide.bs.modal', function (e) { + $("#notify_order_send_to_kitchen").addClass("hidden"); + }).modal({show: true, keyboard: false, backdrop: false}); } } }); diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index 83618770..d674926a 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -157,6 +157,7 @@ $(function() { } }); + // $('button[data-dismiss="modal"]').on('click', function(){ $(this).parent().parent().parent().parent().modal('hide'); }); // $(".new_order_close").on("click",function(){ @@ -473,36 +474,36 @@ function showNewOrder(order_reservation,shop_code){ audio.play(); // },10000); - // $("#new_order").text(order_reservation.order_reservation_id); - // $("#new_order_date").text(requested_date); + $("#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").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({ - title: 'Information', - target: document.getElementById(shop_code+"_notify_new_order"), - text: "You have new order "+ - ""+order_reservation.order_reservation_id+" requested for "+requested_date+"?", - type: 'success', - html: true, - closeOnConfirm: false, - closeOnCancel: false, - allowOutsideClick: false - }, function (isConfirm) { - if(isConfirm){ - audio.pause(); - swal.close(); - } - }); + $("#"+shop_code+"_doemal_new_order").on('shown.bs.modal', function(e){ + // $(document).off('focusin.modal'); + $("#"+shop_code+"_doemal_new_order").focus(); + $("#notify_new_order").addClass("hidden"); + $("#notify_order_send_to_kitchen").addClass("hidden"); + $("#notify_order_ready_to_delivery").addClass("hidden"); + }).on('hide.bs.modal', function (e) { + $("#"+shop_code+"_doemal_new_order").addClass("hidden"); + }).modal({show: true, keyboard: false, backdrop: false}); + // swal({ + // title: 'Information', + // target: document.getElementById(shop_code+"_notify_new_order"), + // text: "You have new order "+ + // ""+order_reservation.order_reservation_id+" requested for "+requested_date+"?", + // type: 'success', + // html: true, + // closeOnConfirm: false, + // closeOnCancel: false, + // allowOutsideClick: false + // }, function (isConfirm) { + // if(isConfirm){ + // audio.pause(); + // swal.close(); + // } + // }); } } diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index ba1089d2..d9b62131 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -270,4 +270,8 @@ i.logout_icon{ .border-left{ border-left:1px solid #fff; +} + +.set_add_icon{ + display:none; } \ No newline at end of file diff --git a/app/models/menu.rb b/app/models/menu.rb index 60200aeb..a9b88a85 100755 --- a/app/models/menu.rb +++ b/app/models/menu.rb @@ -155,24 +155,28 @@ class Menu < ApplicationRecord # Menu Item Attributes item_attrs = [] - attributes = row["Attributes"].split(',') - attributes.each do |attr| - attribute = MenuItemAttribute.find_by_name(attr) - if attribute.nil? - attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase }) + if !row["Attributes"].nil? + attributes = row["Attributes"].split(',') + attributes.each do |attr| + attribute = MenuItemAttribute.find_by_name(attr) + if attribute.nil? + attribute = MenuItemAttribute.create({ attribute_type:"any", name: attr.capitalize, value: attr.downcase }) + end + item_attrs.push(attribute.id) end - item_attrs.push(attribute.id) end # Menu Item Options item_opts = [] + if !row["Options"].nil? options = row["Options"].split(',') - options.each do |opt| - option = MenuItemOption.find_by_name(opt) - if option.nil? - option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase }) + options.each do |opt| + option = MenuItemOption.find_by_name(opt) + if option.nil? + option = MenuItemOption.create({ option_type:"any", name: opt.capitalize, value: opt.downcase }) + end + item_opts.push(option.id) end - item_opts.push(option.id) end menu_itm = MenuItem.find_by_item_code(row["Item Code"]) @@ -189,7 +193,11 @@ class Menu < ApplicationRecord menu_inst = MenuItemInstance.find_by_item_instance_code(row["Instance Code"]) if !menu_inst - imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: row["Instance Name"], item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"]) + instance_name = '' + if !row["Instance Name"].nil? + instance_name = row["Instance Name"] + end + imported_instance = MenuItemInstance.create(menu_item_id: menu_itm.id, item_instance_code: row["Instance Code"], item_instance_name: instance_name, item_attributes: [], price: row["Price"], is_on_promotion: false, promotion_price: 0, is_available: true, is_default: row["Is Default"]) # else # status = status + "Instance Code already exists for " + row["Instance Name"] + "." end diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 391ba83b..65ea665b 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -17,7 +17,7 @@ <%if @menu.present? %> - <%=menu[0].name%> + <%=@menus[0].name%> <% end%> diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 4712a481..a0b0dc51 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -1,4 +1,7 @@
+

<%= t :date_time %> : <%= Time.zone.now.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %>

@@ -208,23 +211,32 @@ " id="server_mode">