Class: Search::CustomerPresenter
- Inherits:
-
BasePresenter
show all
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/customer_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
#affiliations ⇒ Object
87
88
89
90
|
# File 'app/presenters/search/customer_presenter.rb', line 87
def affiliations
return unless has_columns?(:affiliations)
h.array_to_list(r.affiliations, class: 'list-unstyled')
end
|
#creation_method ⇒ Object
14
15
16
|
# File 'app/presenters/search/customer_presenter.rb', line 14
def creation_method
Customer.creation_methods.invert[r.creation_method]
end
|
#customer ⇒ Object
6
7
8
|
# File 'app/presenters/search/customer_presenter.rb', line 6
def customer
h.link_to r.full_name, h.customer_path(r.id)
end
|
#customer_main_fax ⇒ Object
44
45
46
|
# File 'app/presenters/search/customer_presenter.rb', line 44
def customer_main_fax
h.number_to_phone(r.customer_main_fax)
end
|
#customer_main_fax_international ⇒ Object
48
49
50
51
|
# File 'app/presenters/search/customer_presenter.rb', line 48
def customer_main_fax_international
return unless r.has_columns?(:customer_main_fax)
r.customer_main_fax
end
|
#customer_main_phone ⇒ Object
35
36
37
|
# File 'app/presenters/search/customer_presenter.rb', line 35
def customer_main_phone
h.number_to_phone(r.customer_main_phone)
end
|
#customer_main_phone_international ⇒ Object
39
40
41
42
|
# File 'app/presenters/search/customer_presenter.rb', line 39
def customer_main_phone_international
return unless r.has_columns?(:customer_main_phone)
r.customer_main_phone
end
|
#customer_watch_symbol ⇒ Object
18
19
20
21
|
# File 'app/presenters/search/customer_presenter.rb', line 18
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
92
93
94
95
|
# File 'app/presenters/search/customer_presenter.rb', line 92
def distance
return unless has_columns?(:distance)
"#{r.distance.to_f.round(2)} mi."
end
|
#drop_reasons ⇒ Object
53
54
55
|
# File 'app/presenters/search/customer_presenter.rb', line 53
def drop_reasons
h.array_to_list(r.drop_reasons, class: 'list-unstyled')
end
|
#floor_types_interest_last_2_years ⇒ Object
77
78
79
80
|
# File 'app/presenters/search/customer_presenter.rb', line 77
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
27
28
29
|
# File 'app/presenters/search/customer_presenter.rb', line 27
def has_online_account
h.y r.has_online_account
end
|
#id ⇒ Object
10
11
12
|
# File 'app/presenters/search/customer_presenter.rb', line 10
def id
h.link_to "CN#{r.id}", h.customer_path(r.id)
end
|
#last_order_date ⇒ Object
65
66
67
|
# File 'app/presenters/search/customer_presenter.rb', line 65
def last_order_date
h.render_date(r.last_order_date)
end
|
#last_quote_date ⇒ Object
69
70
71
|
# File 'app/presenters/search/customer_presenter.rb', line 69
def last_quote_date
h.render_date(r.last_quote_date)
end
|
#lifetime_revenue ⇒ Object
61
62
63
|
# File 'app/presenters/search/customer_presenter.rb', line 61
def lifetime_revenue
h.number_to_currency(r.lifetime_revenue)
end
|
#open_sales_activity ⇒ Object
23
24
25
|
# File 'app/presenters/search/customer_presenter.rb', line 23
def open_sales_activity
h.y r.open_sales_activity
end
|
#profiling_data_last_edited_at ⇒ Object
73
74
75
|
# File 'app/presenters/search/customer_presenter.rb', line 73
def profiling_data_last_edited_at
h.render_date(r.profiling_data_last_edited_at)
end
|
#rating ⇒ Object
31
32
33
|
# File 'app/presenters/search/customer_presenter.rb', line 31
def rating
h.content_tag(:span, r.rating, id: 'customerrank', class: r.rating) if r.rating
end
|
#room_types_interest_last_2_years ⇒ Object
82
83
84
85
|
# File 'app/presenters/search/customer_presenter.rb', line 82
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
57
58
59
|
# File 'app/presenters/search/customer_presenter.rb', line 57
def trailing_twelve_months_revenue
h.number_to_currency(r.trailing_twelve_months_revenue)
end
|