diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index cad815bf..19d0429e 100644 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -46,7 +46,8 @@ $(document).ready(function(){ url: url, data: {}, dataType: "json", - success: function(data) { + success: function(data) { + for(var field in data) { var price = parseFloat(data[field].price).toFixed(2); @@ -62,7 +63,7 @@ $(document).ready(function(){ row ='
' +'
' +'

' - +''+data[field]["type"]+'- ' + +''+data[field]["table_type"]+'- ' +''+ data[field]["zone"] +'' +''+ data[field]["order_id"] +'- ' +'

' @@ -200,7 +201,8 @@ $(document).ready(function(){ $(document).on('click', '#print_order_item', function(event){ var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text(); var options = $('.selected-item').children('.card-block').find('.item-options').text(); - var params = { 'options':options }; + var params = { 'options':options }; + $.ajax({ type: 'GET', url: '/oqs/print/print/'+assigned_item_id, diff --git a/app/controllers/oqs/backhome_controller.rb b/app/controllers/oqs/backhome_controller.rb index b09e4a2d..4ac5f0a2 100644 --- a/app/controllers/oqs/backhome_controller.rb +++ b/app/controllers/oqs/backhome_controller.rb @@ -89,7 +89,7 @@ class Oqs::HomeController < BaseOqsController # Query for OQS with delivery status def queue_items_query(status) - AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at") + AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at") .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id left join orders as od ON od.order_id = assigned_order_items.order_id diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index d25ab0ac..dfe648d0 100644 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -95,7 +95,6 @@ class Oqs::HomeController < BaseOqsController end - # Query for OQS with delivery status def queue_items_query(status,oqs_id=nil) if oqs_id == nil @@ -103,7 +102,13 @@ class Oqs::HomeController < BaseOqsController else oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' " end - AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at") + AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, + oqs.id as station_id, oqs.station_name, + oqs.is_active, oqpz.zone_id, + df.name as zone, df.type as table_type, + odt.order_id, odt.item_code, odt.item_name, + odt.price, odt.qty, odt.item_order_by, odt.options, + cus.name as customer_name, odt.created_at") .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id left join orders as od ON od.order_id = assigned_order_items.order_id @@ -114,7 +119,6 @@ class Oqs::HomeController < BaseOqsController left join dining_facilities as df on df.id = bk.dining_facility_id") .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs}") .group("assigned_order_items.assigned_order_item_id") - .order("assigned_order_items.created_at") end diff --git a/app/views/oqs/home/index.html.erb b/app/views/oqs/home/index.html.erb index c6c35e1c..3ab1cf24 100644 --- a/app/views/oqs/home/index.html.erb +++ b/app/views/oqs/home/index.html.erb @@ -17,12 +17,11 @@ > <%= qsi.station_name %> - <%= qsi.assigned_order_items.count(:delivery_status) %> + <%= qsi.assigned_order_items.where("delivery_status=0").count %> <% if qsi.auto_print %> (ap) <% end %> - <%= qsi.assigned_order_items.where("delivery_status=0").count %> <% end %>