dashboard check current_user for sales
This commit is contained in:
@@ -109,6 +109,13 @@ class HomeController < ApplicationController
|
||||
@sales = @sales.date_on(today)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
if shift = ShiftSale.current_open_shift(current_user.id)
|
||||
@orders = @orders.where(shift_sale_id: shift.id)
|
||||
@sales = @sales.where(shift_sale_id: shift.id)
|
||||
end
|
||||
end
|
||||
|
||||
@top_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"top")
|
||||
@bottom_products = Sale.top_bottom_products(today,current_user,@from,@to,@from_time,@to_time,"bottom")
|
||||
@hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time)
|
||||
|
||||
Reference in New Issue
Block a user