Class: Dashboard::V2::Group::ReportsController

Inherits:
ReportsController show all
Defined in:
app/controllers/dashboard/v2/group/reports_controller.rb

Instance Method Summary collapse

Methods inherited from ReportsController

#packages_name, #revenue, #summary, #total

Methods included from ReportsShared

#download_menu_report, #index, #report_branch_covers_by_hour, #report_by_day, #report_by_hour, #report_cover_dine_in_by_day, #report_package_by_day, #report_package_by_hour, #report_sales_and_rating, #report_service_type_by_day, #report_service_type_by_hour, #report_sold_out, #report_sold_out_per_date, #sync_package_solds

Methods included from CopperHelper

#copper_sort_restaurants

Methods included from Modules::Owners::Reports::DineInCoversReport

#build_reports_dine_in_covers_by_day

Methods included from Modules::Owners::Reports::SoldOutReport

#build_sold_out_report, #status_seat_by

Methods included from Modules::Owners::Reports::SalesAndRatingReport

#build_package_sales, #build_ratings

Methods included from Modules::Owners::Reports::ServiceTypeReport

#build_reports_service_type_by_day, #build_reports_service_type_by_hour, #service_type_report_by

Methods included from Modules::Owners::Reports::PackageReport

#build_package_reports_by_day, #build_package_reports_by_hour, #package_report_by

Methods included from Modules::Owners::Reports::DineInReport

#build_reports_by_day, #build_reports_by_hour

Methods included from Modules::Owners::Reports::BranchCoversReport

#build_reports_branch_covers_by_day

Methods inherited from MainController

#default_fallback_location, #default_url_options, #kiosque_callback

Methods included from LogrageCustomLogger

#append_info_to_payload

Methods included from Stimulus::TagController

#stimulus

Methods included from OwnerLoginMode

#current_owner, #group_owner_type?, #request_path_contain_group?, #single_owner_type?

Methods included from OwnerDashboardsHelper

#events_ajax_previous_link, #show_source

Methods inherited from ApplicationController

#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=

Methods included from ControllerHelpers

#check_boolean_param, #get_banners, #inventory_params, #reservation_params

Instance Method Details

#set_restaurantObject

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/dashboard/v2/group/reports_controller.rb', line 7

def set_restaurant
  restaurant_id = params[:restaurant_id]
  return @restaurant if defined?(@restaurant)

  @restaurant = if restaurant_id.present? && restaurant_id == 'all'
                  current_owner
                else
                  restaurant = Restaurant.find_by(id: Restaurant.decrypt_id(restaurant_id))
                  if restaurant.nil?
                    current_owner
                  else
                    current_owner.fetch_restaurant_ids.include?(restaurant.id) ? restaurant : :nil
                  end
                end
  raise ArgumentError, 'Invalid restaurant' if @restaurant == :nil

  @restaurant
end