shop code
This commit is contained in:
@@ -81,10 +81,4 @@ class Oqs::EditController < BaseOqsController
|
||||
render :json => {:status=> false, :message => "Not allowed over quantity!" }
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,13 +6,13 @@ class Oqs::HomeController < BaseOqsController
|
||||
|
||||
# Query for OQS with delivery status true
|
||||
# @tables = DiningFacility.all.active.order('status desc')
|
||||
@tables = DiningFacility.where(:type => 'Table').order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@tables = DiningFacility.all.active.where("type = 'Table' and shop_code='#{@shop.shop_code}' ").order('status desc')
|
||||
@rooms = DiningFacility.all.active.where("type = 'Room' and shop_code='#{@shop.shop_code}' ").order('status desc')
|
||||
|
||||
@filter = params[:filter]
|
||||
|
||||
@queue_stations = OrderQueueStation.active
|
||||
|
||||
|
||||
# @queue_completed_item = completed_order(@filter)
|
||||
@queue_completed_item = all_order(@filter)
|
||||
if !@queue_completed_item.empty?
|
||||
@@ -49,7 +49,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
# zone_id = qid.zone_id
|
||||
# i=i+1
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# @queue_stations_items.push({:zone_id => zone_id , :station_name => que.station_name, :is_active => que.is_active , :is_ap => que.auto_print, :item_count => i })
|
||||
# end
|
||||
@@ -157,8 +157,8 @@ puts items.to_json
|
||||
|
||||
|
||||
# Query for OQS with delivery status
|
||||
def queue_items_query(status,oqs_id=nil,filter,table_id,delivery_status)
|
||||
if oqs_id != "0"
|
||||
def queue_items_query(status,oqs_id=nil,filter,table_id,delivery_status)
|
||||
if oqs_id != "0"
|
||||
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
|
||||
else
|
||||
oqs = ''
|
||||
@@ -169,7 +169,7 @@ puts items.to_json
|
||||
elsif delivery_status == "Processed"
|
||||
queue_status = "and assigned_order_items.delivery_status = true "
|
||||
else
|
||||
queue_status = "and assigned_order_items.delivery_status = false "
|
||||
queue_status = "and assigned_order_items.delivery_status = false "
|
||||
end
|
||||
if !table_id.empty?
|
||||
tableId = table_id.to_a.map{|h| h}.join(",")
|
||||
@@ -178,12 +178,12 @@ puts items.to_json
|
||||
table = ''
|
||||
end
|
||||
|
||||
query = 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, odt.set_menu_items,
|
||||
query = 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, odt.set_menu_items,
|
||||
cus.name as customer_name, odt.created_at,
|
||||
assigned_order_items.delivery_status")
|
||||
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
@@ -234,7 +234,7 @@ puts items.to_json
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
query = query.where("df.shop_code='#{@shop.shop_code}' and df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("odt.order_items_id")
|
||||
.order("assigned_order_items.created_at desc")
|
||||
|
||||
@@ -242,7 +242,7 @@ puts items.to_json
|
||||
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
|
||||
end
|
||||
|
||||
# def queue_items_count_query(status,filter)
|
||||
# def queue_items_count_query(status,filter)
|
||||
# query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
|
||||
# .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
|
||||
# left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||
@@ -257,7 +257,7 @@ puts items.to_json
|
||||
|
||||
# end
|
||||
|
||||
def queue_items_count_query(status,filter)
|
||||
def queue_items_count_query(status,filter)
|
||||
# query = OrderQueueStation.all
|
||||
query = OrderQueueStation.select("order_queue_stations.id as station_id,
|
||||
(case when (count(odt.item_code)>0) then count(odt.item_code) else 0 end) as total")
|
||||
|
||||
Reference in New Issue
Block a user