From 494d90c11149b5dbafad53131871a3acdeb59c17 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 28 Nov 2017 11:38:08 +0630 Subject: [PATCH 1/3] order item edit and print --- app/controllers/oqs/edit_controller.rb | 6 +++--- app/controllers/settings/menu_item_instances_controller.rb | 4 ---- app/jobs/order_queue_processor_job.rb | 5 ++--- app/models/printer/order_queue_printer.rb | 4 ++-- app/models/printer/printer_worker.rb | 1 - app/models/printer/receipt_printer.rb | 4 ++++ 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 33ffd8a6..190c4918 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -2,7 +2,7 @@ class Oqs::EditController < BaseOqsController def index assigned_item_id = params[:id] assigned_item = AssignedOrderItem.find(assigned_item_id) - @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'"); + @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'"); end def update @@ -17,7 +17,7 @@ class Oqs::EditController < BaseOqsController order_item.save # print - assigned_item = AssignedOrderItem.find_by_item_code(order_item.item_code) + assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) # order queue stations oqs = assigned_item.order_queue_station @@ -25,6 +25,6 @@ class Oqs::EditController < BaseOqsController 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,assigned_item.order_id, assigned_item.item_code, print_status=" (Edited)" ) + order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.instance_code, print_status=" (Edited)" ) end end diff --git a/app/controllers/settings/menu_item_instances_controller.rb b/app/controllers/settings/menu_item_instances_controller.rb index 60646323..a214ffec 100755 --- a/app/controllers/settings/menu_item_instances_controller.rb +++ b/app/controllers/settings/menu_item_instances_controller.rb @@ -67,11 +67,7 @@ class Settings::MenuItemInstancesController < ApplicationController respond_to do |format| if @settings_menu_item_instances.save -<<<<<<< HEAD - @settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split("") -======= @settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ") ->>>>>>> 7a28dc1ddc100e61789fae7f1f3503e2f703711e @settings_menu_item_instances.save format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' } format.json { render :show, status: :created, location: @settings_menu_item_instances } diff --git a/app/jobs/order_queue_processor_job.rb b/app/jobs/order_queue_processor_job.rb index d8e5d6e1..18fdc2dd 100755 --- a/app/jobs/order_queue_processor_job.rb +++ b/app/jobs/order_queue_processor_job.rb @@ -3,9 +3,8 @@ class OrderQueueProcessorJob < ApplicationJob def perform(order_id, table_id) # Do something later - #Order ID - - order = Order.find(order_id) + #Order ID + order = Order.find(order_id) #Execute orders and send to order stations if order diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 554236de..315b107c 100755 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -1,6 +1,6 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker - def print_order_item(print_settings,oqs,order_id, item_code, print_status, options="") + def print_order_item(print_settings,oqs,order_id, instance_code, print_status, options="") #Use CUPS service #Generate PDF #Print @@ -10,7 +10,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker print_settings.save! end - order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code) + order_item = print_query('order_item', instance_code) #OrderItem.find_by_item_code(item_code) filename = "tmp/order_item.pdf" diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index 832e24bf..ad844cfe 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -33,7 +33,6 @@ class Printer::PrinterWorker end def print(file_path,printer_destination = nil ) - if printer_destination.nil? printer_destination = self.printer_destination end diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index 852a70fc..40a60201 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -74,6 +74,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker # print as print copies in printer setting count = printer_settings.print_copies + + # override print copies for print worker loop + print_settings.print_copies = 1 + print_settings.save! begin if count == 1 pdf.render_file "tmp/receipt_bill_#{sale_data.receipt_no}.pdf" From dd99b5041915183c900a09dc9158c7a9ae370832 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 28 Nov 2017 11:41:47 +0630 Subject: [PATCH 2/3] add focus input first all backend form --- app/assets/javascripts/application.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 249a933f..f2aaf1e2 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -62,9 +62,6 @@ $(document).ready(function() { clearButton: true, date: false }); - - // first input focus for all form - $("body").has("form").find("input:first").focus(); // Image Upload $("#simple_menu_item_image_path").fileinput({ @@ -107,6 +104,7 @@ $(document).ready(function() { } }); + // first input focus for all form $('form:first *:input[type!=hidden]:first').focus(); // $(document).on("focus", "[data-behaviour~='datepicker']", function(e){ From 144aea94c7a646a6dd531e4401d8b8d7a80ae368 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 28 Nov 2017 14:41:27 +0630 Subject: [PATCH 3/3] remove comment --- app/controllers/origami/void_controller.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index a243a388..76c386a0 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -101,9 +101,4 @@ class Origami::VoidController < BaseOrigamiController end end end - - def void_before_pay - - end - end \ No newline at end of file