Class: Search::OrderPresenter

Inherits:
BasePresenter show all
Includes:
Presenters::Timeable
Defined in:
app/presenters/search/order_presenter.rb

Direct Known Subclasses

OrderTextPresenter

Instance Attribute Summary

Attributes inherited from BasePresenter

#current_account, #options, #url_helper

Instance Method Summary collapse

Methods inherited from BasePresenter

#can?, #capture, #concat, #content_tag, #fa_icon, #h, #initialize, #link_to, #number_to_currency, #present, presents, #r, #safe_present, #simple_format, #u

Constructor Details

This class inherits a constructor from BasePresenter

Instance Method Details



90
91
92
93
# File 'app/presenters/search/order_presenter.rb', line 90

def contact_link
  return unless r.has_columns?(:contact_full_name, :contact_id)
  h.link_to r.contact_full_name, h.contact_path(r.contact_id)
end

#couponsObject



80
81
82
83
# File 'app/presenters/search/order_presenter.rb', line 80

def coupons
  return unless r.has_columns?(:coupons)
  r.coupons.to_sentence
end

#currency_symbolObject



38
39
40
# File 'app/presenters/search/order_presenter.rb', line 38

def currency_symbol
  Money::Currency.new('USD').symbol
end


75
76
77
78
# File 'app/presenters/search/order_presenter.rb', line 75

def customer_link
  return unless r.has_columns?(:customer_full_name, :customer_id)
  h.link_to r.customer_full_name, h.customer_path(r.customer_id)
end

#estimated_costObject



58
59
60
61
62
63
# File 'app/presenters/search/order_presenter.rb', line 58

def estimated_cost
  return unless .is_manager?
  return unless r.has_columns?(:estimated_cost, :currency)
  return unless r.estimated_cost
  h.number_to_currency r.estimated_cost, unit: currency_symbol
end

#estimated_profit_marginObject



65
66
67
68
69
# File 'app/presenters/search/order_presenter.rb', line 65

def estimated_profit_margin
  return unless .is_manager?
  return unless r.has_columns?(:estimated_profit_margin)
  h.number_to_percentage r.estimated_profit_margin, precision: 2
end

#gross_revenueObject



46
47
48
# File 'app/presenters/search/order_presenter.rb', line 46

def gross_revenue
  h.number_to_currency (r.line_total || 0.00), unit: currency_symbol
end

#has_pending_drop_ship_deliveriesObject



71
72
73
# File 'app/presenters/search/order_presenter.rb', line 71

def has_pending_drop_ship_deliveries
  h.y r.has_pending_drop_ship_deliveries
end

#msrpObject



42
43
44
# File 'app/presenters/search/order_presenter.rb', line 42

def msrp
  h.number_to_currency (r.line_total_msrp || 0.00), unit: currency_symbol
end

#notes_indicatorObject



34
35
36
# File 'app/presenters/search/order_presenter.rb', line 34

def notes_indicator
  h.notes_popover r.notes
end


25
26
27
28
# File 'app/presenters/search/order_presenter.rb', line 25

def opportunity_link
  return unless r.has_columns?(:opportunity_name, :opportunity_id)
  h.link_to r.opportunity_name, h.opportunity_path(r.opportunity_id)
end


6
7
8
# File 'app/presenters/search/order_presenter.rb', line 6

def order_link
  h.link_to r.reference_number || "Cart id #{r.id}", h.order_path(r.id)
end


10
11
12
13
# File 'app/presenters/search/order_presenter.rb', line 10

def original_order_link
  return nil if r.original_order_id.nil?
  h.link_to r.original_order_reference_number, h.order_path(r.original_order_id)
end


15
16
17
18
# File 'app/presenters/search/order_presenter.rb', line 15

def rma_link
  return nil if r.rma_id.nil?
  h.link_to r.credit_rma_number, h.rma_path(r.rma_id)
end


85
86
87
88
# File 'app/presenters/search/order_presenter.rb', line 85

def spiff_rep_link
  return unless r.has_columns?(:spiff_rep_full_name, :spiff_rep_id)
  h.link_to r.spiff_rep_full_name, h.contact_path(r.spiff_rep_id)
end

#stateObject



30
31
32
# File 'app/presenters/search/order_presenter.rb', line 30

def state
  Order.human_state_name(r.state)
end


20
21
22
23
# File 'app/presenters/search/order_presenter.rb', line 20

def support_case_link
  return nil if r.support_case_id.nil?
  h.link_to r.support_case_number, h.support_case_path(r.support_case_id)
end

#total_revenueObject



50
51
52
# File 'app/presenters/search/order_presenter.rb', line 50

def total_revenue
  h.number_to_currency (r.total || 0.00), unit: currency_symbol
end