Class: Search::OrderPresenter
- Inherits:
-
BasePresenter
show all
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/order_presenter.rb
Overview
Presenter: order presenter.
Instance Attribute Summary
#current_account, #options, #url_helper
Instance Method Summary
collapse
#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
97
98
99
100
101
|
# File 'app/presenters/search/order_presenter.rb', line 97
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
|
#coupons ⇒ Object
85
86
87
88
89
|
# File 'app/presenters/search/order_presenter.rb', line 85
def coupons
return unless r.has_columns?(:coupons)
r.coupons.to_sentence
end
|
#currency_symbol ⇒ Object
44
45
46
|
# File 'app/presenters/search/order_presenter.rb', line 44
def currency_symbol
Money::Currency.new('USD').symbol
end
|
#customer_link ⇒ Object
79
80
81
82
83
|
# File 'app/presenters/search/order_presenter.rb', line 79
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_cost ⇒ Object
60
61
62
63
64
65
66
|
# File 'app/presenters/search/order_presenter.rb', line 60
def estimated_cost
return unless current_account.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_margin ⇒ Object
68
69
70
71
72
73
|
# File 'app/presenters/search/order_presenter.rb', line 68
def estimated_profit_margin
return unless current_account.is_manager?
return unless r.has_columns?(:estimated_profit_margin)
h.number_to_percentage r.estimated_profit_margin, precision: 2
end
|
#gross_revenue ⇒ Object
48
49
50
|
# File 'app/presenters/search/order_presenter.rb', line 48
def gross_revenue
h.number_to_currency (r.line_total || 0.00), unit: currency_symbol
end
|
#has_pending_drop_ship_deliveries ⇒ Object
75
76
77
|
# File 'app/presenters/search/order_presenter.rb', line 75
def has_pending_drop_ship_deliveries
h.y r.has_pending_drop_ship_deliveries
end
|
#msrp ⇒ Object
56
57
58
|
# File 'app/presenters/search/order_presenter.rb', line 56
def msrp
h.number_to_currency (r.line_total_msrp || 0.00), unit: currency_symbol
end
|
#notes_indicator ⇒ Object
40
41
42
|
# File 'app/presenters/search/order_presenter.rb', line 40
def notes_indicator
h.notes_popover r.notes
end
|
#opportunity_link ⇒ Object
30
31
32
33
34
|
# File 'app/presenters/search/order_presenter.rb', line 30
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
|
#order_link ⇒ Object
8
9
10
|
# File 'app/presenters/search/order_presenter.rb', line 8
def order_link
h.link_to r.reference_number || "Cart id #{r.id}", h.order_path(r.id)
end
|
#original_order_link ⇒ Object
12
13
14
15
16
|
# File 'app/presenters/search/order_presenter.rb', line 12
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
|
#rma_link ⇒ Object
18
19
20
21
22
|
# File 'app/presenters/search/order_presenter.rb', line 18
def rma_link
return nil if r.rma_id.nil?
h.link_to r.credit_rma_number, h.rma_path(r.rma_id)
end
|
#spiff_rep_link ⇒ Object
91
92
93
94
95
|
# File 'app/presenters/search/order_presenter.rb', line 91
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
|
#state ⇒ Object
36
37
38
|
# File 'app/presenters/search/order_presenter.rb', line 36
def state
Order.human_state_name(r.state)
end
|
#support_case_link ⇒ Object
24
25
26
27
28
|
# File 'app/presenters/search/order_presenter.rb', line 24
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_revenue ⇒ Object
52
53
54
|
# File 'app/presenters/search/order_presenter.rb', line 52
def total_revenue
h.number_to_currency (r.total || 0.00), unit: currency_symbol
end
|