Class: Search::OrderPresenter
- Inherits:
-
BasePresenter
show all
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/order_presenter.rb
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
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
|
#coupons ⇒ Object
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_symbol ⇒ Object
38
39
40
|
# File 'app/presenters/search/order_presenter.rb', line 38
def currency_symbol
Money::Currency.new('USD').symbol
end
|
#customer_link ⇒ Object
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_cost ⇒ Object
58
59
60
61
62
63
|
# File 'app/presenters/search/order_presenter.rb', line 58
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
65
66
67
68
69
|
# File 'app/presenters/search/order_presenter.rb', line 65
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
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_deliveries ⇒ Object
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
|
#msrp ⇒ Object
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_indicator ⇒ Object
34
35
36
|
# File 'app/presenters/search/order_presenter.rb', line 34
def notes_indicator
h.notes_popover r.notes
end
|
#opportunity_link ⇒ Object
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
|
#order_link ⇒ Object
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
|
#original_order_link ⇒ Object
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
|
#rma_link ⇒ Object
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
|
#spiff_rep_link ⇒ Object
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
|
#state ⇒ Object
30
31
32
|
# File 'app/presenters/search/order_presenter.rb', line 30
def state
Order.human_state_name(r.state)
end
|
#support_case_link ⇒ Object
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_revenue ⇒ Object
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
|