Class: Crm::Reports::OpportunitiesReportController

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

Overview

Controller: opportunities report.

Instance Method Summary collapse

Instance Method Details

#existing_closed_pin_opportunitiesObject



50
51
52
53
54
55
56
57
58
# File 'app/controllers/crm/reports/opportunities_report_controller.rb', line 50

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

#existing_open_pin_opportunitiesObject



40
41
42
43
44
45
46
47
48
# File 'app/controllers/crm/reports/opportunities_report_controller.rb', line 40

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

#new_closed_pin_opportunitiesObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/crm/reports/opportunities_report_controller.rb', line 30

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

#new_open_pin_opportunitiesObject

Tag customer and send to advanced search



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

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

#showObject



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

def show
  @report_command = ::Report::OpportunitiesReport::OpportunitiesReportCommand.new(opportunities_report_command_params)
  @result = @report_command.execute

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