Class: Dashboard::V2::Group::InventoriesController

Inherits:
InventoriesController show all
Defined in:
app/controllers/dashboard/v2/group/inventories_controller.rb

Overview

typed: ignore frozen_string_literal: true

Instance Method Summary collapse

Methods inherited from InventoriesController

#activate_order_now, #block_form, #create_or_update, #edit, #index, #undo

Methods included from CountryEmailHelper

#merchant_email_for_country

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

#block(_restaurant_id = nil) ⇒ Object



8
9
10
11
12
13
14
# File 'app/controllers/dashboard/v2/group/inventories_controller.rb', line 8

def block(_restaurant_id = nil)
  if current_owner.restaurant_ids.include?(valid_params[:restaurant_id].to_i)
    super(valid_params[:restaurant_id])
  else
    render json: { message: 'Invalid restaurant' }, status: 422
  end
end

#flag_dataObject



16
17
18
19
# File 'app/controllers/dashboard/v2/group/inventories_controller.rb', line 16

def flag_data
  restaurant = current_owner.restaurants.find(params[:restaurant_id])
  super(restaurant)
end

#override_reportObject



21
22
23
24
25
26
# File 'app/controllers/dashboard/v2/group/inventories_controller.rb', line 21

def override_report
  grid_params = default_params.merge(search_params).merge(current_group: current_owner)
  @grid = Dashboard::V2::Group::OverrideInventoriesGrid.new(grid_params) do |scope|
    scope.joins(:restaurant).where(restaurants: { id: current_owner.restaurant_ids }).page(params[:page])
  end
end