Class: Crm::Reports::TechCallsReportController
- Inherits:
-
CrmController
- Object
- CrmController
- Crm::Reports::TechCallsReportController
- Includes:
- Controllers::ReportCommandFlashable
- Defined in:
- app/controllers/crm/reports/tech_calls_report_controller.rb
Overview
Controller: tech calls report.
Constant Summary collapse
- PER_PAGE =
Per page.
25- SORTABLE_COLUMNS =
Sortable columns.
%w[start_time origination full_name caller_id_number queue_name queue_extension outcome member_name talk_time].freeze
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/crm/reports/tech_calls_report_controller.rb', line 13 def show @report_command = ::Report::TechCallsReport::TechCallsReportCommand.new(tech_calls_report_command_params) @result = @report_command.execute @command_params = tech_calls_report_command_params.to_h.presence || {} if @result @tab = params[:tab].presence || 'ttl' @page = [params[:page].to_i, 1].max @per_page = PER_PAGE @sort_col = SORTABLE_COLUMNS.include?(params[:sort_col]) ? params[:sort_col] : 'start_time' @sort_dir = params[:sort_dir] == 'asc' ? 'asc' : 'desc' tab_records = sorted_records(tab_data(@tab)) @tab_total = tab_records.size @tab_pages = [(@tab_total.to_f / @per_page).ceil, 1].max @tab_records = tab_records.slice((@page - 1) * @per_page, @per_page) || [] end flash_report_command_errors respond_to do |format| format.html format.turbo_stream end end |