Class: Search::CustomerPresenter

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

Direct Known Subclasses

CustomerTextPresenter

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

#affiliationsObject



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_methodObject



14
15
16
# File 'app/presenters/search/customer_presenter.rb', line 14

def creation_method
  Customer.creation_methods.invert[r.creation_method]
end

#customerObject



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_faxObject



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_internationalObject



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_phoneObject



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_internationalObject



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_symbolObject



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

#distanceObject



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_reasonsObject



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_yearsObject



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_accountObject



27
28
29
# File 'app/presenters/search/customer_presenter.rb', line 27

def 
  h.y r.
end

#idObject



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_dateObject



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_dateObject



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_revenueObject



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_activityObject



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_atObject



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

#ratingObject



31
32
33
# File 'app/presenters/search/customer_presenter.rb', line 31

def rating
  h.(:span, r.rating, id: 'customerrank', class: r.rating) if r.rating
end

#room_types_interest_last_2_yearsObject



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_revenueObject



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