diff --git a/Gemfile b/Gemfile index 08464196..1481501c 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'mysql2', '>= 0.3.18', '< 0.5' #gem 'pg' # redis server for cable -gem 'redis', '~> 3.0' +# gem 'redis', '~> 3.0' # Use Puma as the app server gem 'puma', '~> 3.0' diff --git a/Gemfile.lock b/Gemfile.lock index 0c3a3a27..e2c1dd73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,7 +119,6 @@ GEM nokogiri (1.7.2) mini_portile2 (~> 2.1.0) pdf-core (0.7.0) - pg (0.20.0) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) @@ -253,13 +252,11 @@ DEPENDENCIES kaminari! listen (~> 3.0.5) mysql2 (>= 0.3.18, < 0.5) - pg prawn prawn-table puma (~> 3.0) rack-cors rails (~> 5.1.0) - redis (~> 3.0) rspec-rails (~> 3.5) sass-rails (~> 5.0) schema_to_scaffold diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index 091b6822..eb2bc9cb 100644 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -17,21 +17,32 @@ //= require cable $(document).ready(function(){ - $('.queue_station').on('click',function(){ - var title=$(this).children().children('.card-title').text(); - var titles=title.split(' '); - + $('.queue_station').on('click',function(){ + var orderZone=$(this).children().children().children('.order-zone').text(); + var orderItem=$(this).children().children().children('.order-item').text(); + var orderQty=$(this).children().children().children('.order-qty').text(); var orderBy=$(this).children().children().children().children('.order-by').text(); var orderAt=$(this).children().children().children().children('.order-at').text(); var orderCustomer=$(this).children().children('.order-customer').text(); - $('#order-title').text($('#order-title').text() + titles[0]); + $('#order-title').text("ORDER DETAILS - " + orderZone); $('#order-by').text(orderBy); $('#order-at').text(orderAt); $('#order-customer').text(orderCustomer); - $('#order-from').text(titles[0]); + $('#order-from').text(orderZone); - $('#order-items').text(titles[1]); - $('#order-qty').text(titles[2].substr(2).replace(']','')); + $('#order-items').text(orderItem); + $('#order-qty').text(orderQty); + }); + + // complete for queue item + $('.order-complete').on('click',function(){ + var assigned_item_id=$(this).attr('id').substr(15); + $.ajax({ + url: "", + data: "" + }).done(function(){ + + }); }); }); diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 0f73d20d..f59f2f18 100644 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -1,31 +1,47 @@ class Oqs::HomeController < BaseOqsController def index @queue_stations=OrderQueueStation.all + + @queue_items_details = queue_items_query('false') - #sample Data - @queue_items_details = { :queue_id => 1, :order_id => 1, :station_name => 'Queue Station 1', :zone => 'Table4', :item_name => 'beef', :price => 10.00, :qty => 2, :customer => 'Wathon', :item_order_by => 'Yan', :created_at => '2007-05-17'} - # @queue_items_details = OrderItem.select("oqs as queue_id, oqs.station_name, oqs.is_active, oqpz.zone_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.created_at") - # .joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = order_queue_items.order_queue_station_id") - # .joins("right join order_queue_stations as oqs ON oqs.id = order_queue_items.order_queue_station_id") - # .joins("right join orders as od ON od.id = order_queue_items.order_id") - # .joins("right join order_items as odt ON odt.item_code = order_queue_items.item_code") - # .order("odt.item_name DESC") + @queue_completed_item = queue_items_query('true') + + @queue_stations_items=Array.new - + # Calculate Count for each station tab + @queue_stations.each do |que| + i=0 + @queue_items_details.each do |qid| + if qid.station_name == que.station_name + i+=1 + @queue_stations_items.push({:station_name => que.station_name ,:item_count => i }) + break + end + end + end - # Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price, - # order_items.id as order_items_id,dining_facilities.name as table_name") - # .joins("left join booking_orders on booking_orders.order_id = orders.id - # left join bookings on bookings.id = booking_orders.id - # left join dining_facilities on dining_facilities.id = bookings.dining_facility_id - # left join order_items on order_items.order_id = orders.id") - # .where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true) - # .group("orders.id") + @queue_stations_items end def show end + + def update_delivery_status + + end + + # Query for OQS with status + def queue_items_query(status) + AssignedOrderItem.select("assigned_order_items.id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at") + .joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id + left join dining_facilities as df on df.zone_id = oqpz.zone_id + left join order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id + left join orders as od ON od.id = assigned_order_items.order_id + left join order_items as odt ON odt.item_code = assigned_order_items.item_code + left join customers as cus ON cus.id = od.customer_id") + .where('assigned_order_items.delivery_status=' + status) + .group('oqs.station_name') + .order("odt.item_name DESC") + end end - - diff --git a/app/views/oqs/home/index.html.erb b/app/views/oqs/home/index.html.erb index 24fa00d0..4e0b16ad 100644 --- a/app/views/oqs/home/index.html.erb +++ b/app/views/oqs/home/index.html.erb @@ -1,14 +1,16 @@
Well Done, Fries, Salad
-- Order at 12:23, Kyaw Lwin | - Printed at 12:23 | - Completed at 12:43 -
-Medium, Fries, Salad
++ Order at + + <%= qid.created_at.strftime("%Y %m %d") %> + - + + <%= qid.item_order_by %> + + +
+<%= qid.customer_name %>
+Medium, Fries, Salad
Order at - <%= @queue_items_details[:created_at] %> + <%= qid.created_at.strftime("%Y %m %d") %> - - <%= @queue_items_details[:item_order_by] %> + <%= qid.item_order_by %>
-<%= @queue_items_details[:customer] %>
+<%= qid.customer_name %>
| Items | -QTY + | QTY |
|---|
|
|