Class: Crm::Reports::CustomerPerformanceController

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

Instance Method Summary collapse

Instance Method Details

#pin_customersObject

Tag customer and send to advanced search



19
20
21
22
23
24
25
26
27
# File 'app/controllers/crm/reports/customer_performance_controller.rb', line 19

def pin_customers
  se = CustomerSearch.new(query_params: { id_in: params[:customer_ids] }, employee_id: current_user.id)
  if se.save
    se.record_list('*')
    redirect_to search_path(se)
  else
    redirect_to :show, notice: "Could not create search, errors reported: #{se.errors_to_s}"
  end
end

#showObject



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

def show
  authorize! :read, Invoice
  @report_command = ::Report::CustomerPerformanceCommand.new(customer_performance_command_params)
  @results = @report_command.execute

  flash_report_command_errors
  respond_to do |format|
    format.html
    format.turbo_stream
  end
end