class HomeController < ApplicationController def index redirect_to route_by_role end private def route_by_role if current_user.role == "administrator" dashboard_path elsif current_user.role == "cashier" food_court = Lookup.find_by_lookup_type_and_value("food_court", "1") #check if cashier has existing open cashier shift = ShiftSale.current_open_shift(current_user) if food_court if !shift.nil? foodcourt_food_court_path(:anchor => "") else new_foodcourt_shift_path end else if !shift.nil? origami_dashboard_path else new_origami_shift_path end end elsif current_user.role == "manager" dashboard_path elsif current_user.role == "supervisor" origami_dashboard_path elsif current_user.role == "waiter" origami_dashboard_path elsif current_user.role == "crm" crm_root_path elsif current_user.role == "account" reports_dailysale_index_path elsif current_user.role == "kitchen" oqs_root_path elsif @current_user.role == "foodcourt_cashier" #check if cashier has existing open cashier shift = ShiftSale.current_open_shift(employee) if !shift.nil? foodcourt_food_court_path else new_foodcourt_shift_path end else login_path end end end