Class: Search::QuotePresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::QuotePresenter
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/quote_presenter.rb
Overview
Row presenter for QuoteSearch — renders the cells in the CRM quote
search/results table. Wraps a ViewQuote projection rather than a
fully-loaded Quote so the search grid stays light.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#currency_symbol ⇒ String
Currency symbol for quote totals (USD).
-
#customer_link ⇒ ActiveSupport::SafeBuffer?
Linked customer name → customer show page.
-
#hold_for_transmission_indicator ⇒ ActiveSupport::SafeBuffer
Visual indicator showing whether the quote is held for transmission.
-
#notes_indicator ⇒ ActiveSupport::SafeBuffer?
Bootstrap popover with the quote notes.
-
#quote_link ⇒ ActiveSupport::SafeBuffer
Linked quote reference number → quote show page.
-
#state ⇒ String
Localized human-readable quote state name.
-
#total ⇒ String
Quote total formatted as currency.
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
#currency_symbol ⇒ String
Currency symbol for quote totals (USD).
37 38 39 |
# File 'app/presenters/search/quote_presenter.rb', line 37 def currency_symbol Money::Currency.new('USD').symbol end |
#customer_link ⇒ ActiveSupport::SafeBuffer?
Linked customer name → customer show page.
28 29 30 31 32 |
# File 'app/presenters/search/quote_presenter.rb', line 28 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 |
#hold_for_transmission_indicator ⇒ ActiveSupport::SafeBuffer
Visual indicator showing whether the quote is held for transmission.
51 52 53 |
# File 'app/presenters/search/quote_presenter.rb', line 51 def hold_for_transmission_indicator r.hold_for_transmission ? h.fa_icon('ban', style: 'color:red', text: 'Hold') : h.fa_icon('check', style: 'color:green', text: 'Can Release') end |
#notes_indicator ⇒ ActiveSupport::SafeBuffer?
Bootstrap popover with the quote notes.
58 59 60 |
# File 'app/presenters/search/quote_presenter.rb', line 58 def notes_indicator h.notes_popover r.notes end |
#quote_link ⇒ ActiveSupport::SafeBuffer
Linked quote reference number → quote show page.
14 15 16 |
# File 'app/presenters/search/quote_presenter.rb', line 14 def quote_link h.link_to r.reference_number, h.quote_path(r) end |
#state ⇒ String
Localized human-readable quote state name.
21 22 23 |
# File 'app/presenters/search/quote_presenter.rb', line 21 def state Quote.human_state_name(r.state) end |
#total ⇒ String
Quote total formatted as currency.
44 45 46 |
# File 'app/presenters/search/quote_presenter.rb', line 44 def total h.number_to_currency (r.total || 0.00), unit: currency_symbol end |