diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js index a51327c3..a4890681 100644 --- a/app/assets/javascripts/channels/check_new_order.js +++ b/app/assets/javascripts/channels/check_new_order.js @@ -34,10 +34,11 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', { // } // }); $("#notify_new_order_lists").text(order_lists); - $("#notify_new_order").on('shown.bs.modal', function(e){ - $("#notify_new_order").focus(); + $("#notify_new_order").on('show.bs.modal', function(e){ $("#notify_order_send_to_kitchen").modal('hide'); $("#notify_order_ready_to_delivery").modal('hide'); + }).on('shown.bs.modal', function(e){ + $("#notify_new_order").focus(); }).on('hide.bs.modal', function (e) { $("#notify_new_order").modal("hide"); }).modal({show: true, keyboard: false, backdrop: false}); 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 97e2a266..2e576266 100644 --- a/app/assets/javascripts/channels/check_order_ready_to_delivery.js +++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js @@ -35,9 +35,10 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe // }); $("#notify_order_ready_to_delivery_lists").text(order_lists); $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){ - $("#notify_order_ready_to_delivery").focus(); $("#notify_new_order").modal('hide'); $("#notify_order_send_to_kitchen").modal('hide'); + }).on('shown.bs.modal', function(e){ + $("#notify_order_ready_to_delivery").focus(); }).on('hide.bs.modal', function (e) { $("#notify_order_ready_to_delivery").modal("hide"); }).modal({show: true, keyboard: false, backdrop: false}); 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 f3a15903..fbb233f8 100644 --- a/app/assets/javascripts/channels/check_order_send_to_kitchen.js +++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js @@ -34,10 +34,11 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend // } // }); $("#notify_order_send_to_kitchen_lists").text(order_lists); - $("#notify_order_send_to_kitchen").on('shown.bs.modal', function(e){ - $("#notify_order_send_to_kitchen").focus(); + $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){ $("#notify_new_order").modal('hide'); $("#notify_order_ready_to_delivery").modal('hide'); + }).on('shown.bs.modal', function(e){ + $("#notify_order_send_to_kitchen").focus(); }).on('hide.bs.modal', function (e) { $("#notify_order_send_to_kitchen").modal("hide"); }).modal({show: true, keyboard: false, backdrop: false}); diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 4bc99f59..e8f0edb5 100644 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -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 diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb index b7260863..8f1430a6 100755 --- a/app/controllers/origami/moveroom_controller.rb +++ b/app/controllers/origami/moveroom_controller.rb @@ -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 diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index eaf7fca1..7efdd46c 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -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' diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index e3536205..827cfcda 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -1,7 +1,6 @@ class Origami::OrderReservationController < BaseOrigamiController def index - puts Time.now.utc @order = OrderReservation.latest_order #.active @count_on_order = OrderReservation.get_count_on_order @count_on_completed = OrderReservation.get_count_on_completed diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index a86fb9b2..aa1dd8bd 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -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 diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb index 27595303..d9485b3a 100644 --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -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"); + } } }); }); diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb index 240d3b20..543e33d0 100755 --- a/app/views/origami/moveroom/move_dining.html.erb +++ b/app/views/origami/moveroom/move_dining.html.erb @@ -1,215 +1,376 @@