Class: Crm::Reports::ActivityPerformanceController

Inherits:
CrmController
  • Object
show all
Includes:
Controllers::ReportCommandFlashable
Defined in:
app/controllers/crm/reports/activity_performance_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/crm/reports/activity_performance_controller.rb', line 6

def show
  @report_command = ::Report::ActivityPerformance::Command.new(activity_performance_command_params)
  @results = @report_command.execute

  @chart_data = build_chart_data if @results.present?

  return render partial: 'mini_view', layout: false if request.headers['Turbo-Frame'].present?

  flash_report_command_errors
  flash.now[:warning] = @report_command.warnings.join('.') if @report_command.warnings.any?

  respond_to do |format|
    format.html do
      render partial: 'mini_view', layout: false if request.xhr?
    end
    format.turbo_stream
  end
end