From 6bbac9d14c4203c7f2cd188749f8662c0692b913 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 1 Dec 2017 16:23:50 +0630 Subject: [PATCH] check OQS edit process --- app/assets/javascripts/OQS.js | 17 ----------------- app/controllers/oqs/edit_controller.rb | 2 +- app/models/printer/order_queue_printer.rb | 6 +++--- app/views/oqs/edit/index.html.erb | 7 ++++--- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index f7d517ea..8a9214f7 100755 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -243,21 +243,4 @@ $(document).on('turbolinks:load', function() { success: function(data){ } }); }); - - // Qty update for OQS Edit Controller - $('#qty-update').on('click', function(){ - var qty_weight = $("input[name='qty_weight']").val(); - var remarks = $("textarea[name='remarks']").val(); - var order_items_id = $(this).attr('data-id'); - var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks } - $.ajax({ - type: 'POST', - url: '/oqs/' + order_items_id, - data: params, - success: function(result){ - alert("Updated!"); - window.location.href = '/oqs'; - } - }); - }); }); diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index b58719f6..bd7f94c8 100755 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -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,order_item.order_id, order_item.item_instance_code, print_status=" (Cancel)" ) + order_queue_printer.print_order_item(print_settings, oqs, order_item.order_items_id,order_item.order_id, order_item.item_instance_code, print_status=" (Cancel)" ) end end diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index 315b107c..541f1e9d 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, instance_code, print_status, options="") + def print_order_item(print_settings,oqs, order_items_id, 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', instance_code) #OrderItem.find_by_item_code(item_code) + order_item = print_query('order_item', order_items_id) #OrderItem.find_by_item_code(item_code) filename = "tmp/order_item.pdf" @@ -147,7 +147,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker left join dining_facilities AS df ON df.id = b.dining_facility_id left join customers as cus ON cus.customer_id = orders.customer_id left join menu_items as item ON item.item_code = order_items.item_code") - .where("order_items.item_instance_code = '#{ id }'") + .where("order_items.order_items_id = '#{ id }'") .group("order_items.item_code") elsif type == "order_summary" OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name") diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb index 750a04c8..07b7859c 100755 --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -99,11 +99,12 @@