Class: Search::CustomerPresenter
- Inherits:
-
BasePresenter
show all
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/customer_presenter.rb
Overview
Presenter: customer 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
#affiliations ⇒ Object
94
95
96
97
98
|
# File 'app/presenters/search/customer_presenter.rb', line 94
def affiliations
return unless has_columns?(:affiliations)
h.array_to_list(r.affiliations, class: 'list-unstyled')
end
|
#creation_method ⇒ Object
16
17
18
|
# File 'app/presenters/search/customer_presenter.rb', line 16
def creation_method
Customer.creation_methods.invert[r.creation_method]
end
|
#customer ⇒ Object
8
9
10
|
# File 'app/presenters/search/customer_presenter.rb', line 8
def customer
h.link_to r.full_name, h.customer_path(r.id)
end
|
#customer_main_fax ⇒ Object
48
49
50
|
# File 'app/presenters/search/customer_presenter.rb', line 48
def customer_main_fax
h.number_to_phone(r.customer_main_fax)
end
|
#customer_main_fax_international ⇒ Object
52
53
54
55
56
|
# File 'app/presenters/search/customer_presenter.rb', line 52
def customer_main_fax_international
return unless r.has_columns?(:customer_main_fax)
r.customer_main_fax
end
|
#customer_main_phone ⇒ Object
38
39
40
|
# File 'app/presenters/search/customer_presenter.rb', line 38
def customer_main_phone
h.number_to_phone(r.customer_main_phone)
end
|
#customer_main_phone_international ⇒ Object
42
43
44
45
46
|
# File 'app/presenters/search/customer_presenter.rb', line 42
def customer_main_phone_international
return unless r.has_columns?(:customer_main_phone)
r.customer_main_phone
end
|
#customer_watch_symbol ⇒ Object
20
21
22
23
24
|
# File 'app/presenters/search/customer_presenter.rb', line 20
def customer_watch_symbol
return unless r.has_columns?(:watch, :open_sales_activity)
h.concat h.customer_watch_symbol_raw(r.watch, r.open_sales_activity)
end
|
#distance ⇒ Object
100
101
102
103
104
|
# File 'app/presenters/search/customer_presenter.rb', line 100
def distance
return unless has_columns?(:distance)
"#{r.distance.to_f.round(2)} mi."
end
|
#drop_reasons ⇒ Object
58
59
60
|
# File 'app/presenters/search/customer_presenter.rb', line 58
def drop_reasons
h.array_to_list(r.drop_reasons, class: 'list-unstyled')
end
|
#floor_types_interest_last_2_years ⇒ Object
82
83
84
85
86
|
# File 'app/presenters/search/customer_presenter.rb', line 82
def floor_types_interest_last_2_years
return unless has_columns?(:floor_types_interest_last_2_years)
h.array_to_list(r.floor_types_interest_last_2_years.map { |ftid| FloorType.find(ftid).name }, class: 'list-unstyled')
end
|
#has_online_account ⇒ Object
30
31
32
|
# File 'app/presenters/search/customer_presenter.rb', line 30
def has_online_account
h.y r.has_online_account
end
|
#id ⇒ Object
12
13
14
|
# File 'app/presenters/search/customer_presenter.rb', line 12
def id
h.link_to "CN#{r.id}", h.customer_path(r.id)
end
|
#last_order_date ⇒ Object
70
71
72
|
# File 'app/presenters/search/customer_presenter.rb', line 70
def last_order_date
h.render_date(r.last_order_date)
end
|
#last_quote_date ⇒ Object
74
75
76
|
# File 'app/presenters/search/customer_presenter.rb', line 74
def last_quote_date
h.render_date(r.last_quote_date)
end
|
#lifetime_revenue ⇒ Object
66
67
68
|
# File 'app/presenters/search/customer_presenter.rb', line 66
def lifetime_revenue
h.number_to_currency(r.lifetime_revenue)
end
|
#open_sales_activity ⇒ Object
26
27
28
|
# File 'app/presenters/search/customer_presenter.rb', line 26
def open_sales_activity
h.y r.open_sales_activity
end
|
#profiling_data_last_edited_at ⇒ Object
78
79
80
|
# File 'app/presenters/search/customer_presenter.rb', line 78
def profiling_data_last_edited_at
h.render_date(r.profiling_data_last_edited_at)
end
|
#rating ⇒ Object
34
35
36
|
# File 'app/presenters/search/customer_presenter.rb', line 34
def rating
h.content_tag(:span, r.rating, id: 'customerrank', class: r.rating) if r.rating
end
|
#room_types_interest_last_2_years ⇒ Object
88
89
90
91
92
|
# File 'app/presenters/search/customer_presenter.rb', line 88
def room_types_interest_last_2_years
return unless has_columns?(:room_types_interest_last_2_years)
h.array_to_list(r.room_types_interest_last_2_years.map { |rtid| RoomType.find(rtid).name }, class: 'list-unstyled')
end
|
#trailing_twelve_months_revenue ⇒ Object
62
63
64
|
# File 'app/presenters/search/customer_presenter.rb', line 62
def trailing_twelve_months_revenue
h.number_to_currency(r.trailing_twelve_months_revenue)
end
|