Class: Crm::Reports::PhoneQueueReportController

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

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/crm/reports/phone_queue_report_controller.rb', line 4

def show
  authorize! :read, CallLog
  cmd_params = phone_queue_report_command_params
  @report_command = ::Report::PhoneQueueReportCommand.new(cmd_params)
  @results = @report_command.execute(cmd_params)

  @groupby = cmd_params[:grouping] || Array(@report_command.grouping).first
  flash_report_command_errors
  respond_to do |format|
    format.html
    format.turbo_stream
    format.csv { send_data @report_command.to_csv(cmd_params), filename: "phone-queue-report-#{Date.current}.csv" }
  end
end