diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 1409c829..5e866699 100755 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -33,9 +33,25 @@ $(document).on('turbolinks:load', function() { $(".tables").on("click", function(){ - var table_id = $(this).val(); - $('#table_id').val(table_id); - oqs_id = $("#oqs_id").val(); + active = $(this).hasClass('selected-table'); + if (active) { + $(this).removeClass('bg-blue'); + $(this).addClass('green'); + $(this).removeClass('selected-table'); + }else{ + $(this).removeClass('green'); + $(this).addClass('bg-blue'); + $(this).addClass('selected-table'); + } + var list = document.getElementsByClassName('selected-table'); + var i; + var table_id =[]; + for (i = 0; i < list.length; i++) { + table_id.push(list[i].value); + } + $('#table_id').val(table_id); + + oqs_id = $("#oqs_id").val(); if (table_id){ var table = table_id }else{ diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 043fbb03..ca1bd0b9 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -13,6 +13,16 @@ $(document).ready(function() { touchScrollStep : 50 }); + $('#table-slimscroll').slimScroll({ + height: height, + size: '5px', + color: 'rgba(0,0,0,0.5)', + alwaysVisible: false, + borderRadius: '0', + railBorderRadius: '0', + touchScrollStep : 50 + }); + $('#order-detail-slimscroll').slimScroll({ height: height-$('#order-detail-slimscroll').attr('data-height'), size: '5px', diff --git a/app/controllers/oqs/backhome_controller.rb b/app/controllers/oqs/backhome_controller.rb index 4ac5f0a2..f809ef9f 100755 --- a/app/controllers/oqs/backhome_controller.rb +++ b/app/controllers/oqs/backhome_controller.rb @@ -89,6 +89,7 @@ class Oqs::HomeController < BaseOqsController # Query for OQS with delivery status def queue_items_query(status) + byebug 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 diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 23d6341e..c39de390 100755 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -161,9 +161,9 @@ class Oqs::HomeController < BaseOqsController oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' " end - if table_id.to_i>0 - table = "and df.id = '#{table_id}' " - + if !table_id.empty? + tableId = table_id.to_a.map{|h| h}.join(",") + table = "and df.id IN (#{tableId})" else table = '' end diff --git a/app/views/oqs/home/index.html.erb b/app/views/oqs/home/index.html.erb index ee73d560..ee786127 100644 --- a/app/views/oqs/home/index.html.erb +++ b/app/views/oqs/home/index.html.erb @@ -1,9 +1,10 @@
<%= @filter %>
+