UI updated
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user