Class: Crm::Reports::OpportunitiesReportController

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

Instance Method Summary collapse

Instance Method Details

#existing_closed_pin_opportunitiesObject



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

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



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

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



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

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



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

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



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

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