Class: Search::CreditMemoPresenter
- Inherits:
-
BasePresenter
- Object
- SimpleDelegator
- BasePresenter
- Search::CreditMemoPresenter
- Includes:
- Presenters::Timeable
- Defined in:
- app/presenters/search/credit_memo_presenter.rb
Overview
Row presenter for CreditMemoSearch — renders the cells in the CRM
credit-memo search/results table. Wraps a lightweight SQL projection
of CreditMemo columns rather than a fully-loaded model.
Instance Attribute Summary
Attributes inherited from BasePresenter
#current_account, #options, #url_helper
Instance Method Summary collapse
-
#billing_customer ⇒ ActiveSupport::SafeBuffer?
Linked billing-customer name → show page; nil when no separate billing customer is set.
-
#co ⇒ ActiveSupport::SafeBuffer?
Linked credit-Order reference → order show page; nil for memos not tied to a credit order.
-
#created_at ⇒ String
Created-at timestamp rendered through the shared
render_datehelper. -
#credit_memo ⇒ ActiveSupport::SafeBuffer
Linked credit-memo reference number → show page.
-
#customer ⇒ ActiveSupport::SafeBuffer
Linked customer name → customer show page.
-
#document_date ⇒ String
Document date rendered through the shared
render_datehelper. -
#original_order ⇒ ActiveSupport::SafeBuffer?
Linked original-Order reference → order show page; nil when no source order is recorded.
-
#request_date ⇒ String
Date the credit-memo request was filed (often the RMA-creation date) rendered as CRM date.
-
#rma ⇒ ActiveSupport::SafeBuffer?
Linked Rma number → RMA show page; nil for stand-alone credit memos.
-
#total ⇒ String
Credit-memo total formatted in its own currency (negative).
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
#billing_customer ⇒ ActiveSupport::SafeBuffer?
Linked billing-customer name → show page; nil when no separate
billing customer is set.
28 29 30 31 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 28 def billing_customer return nil if r.billing_customer_id.nil? h.link_to(r.billing_customer_name, h.customer_path(r.billing_customer_id)) end |
#co ⇒ ActiveSupport::SafeBuffer?
Linked credit-Order reference → order show page; nil for memos
not tied to a credit order.
45 46 47 48 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 45 def co return nil if r.credit_order_id.nil? h.link_to(r.credit_order_reference_number, h.order_path(r.credit_order_id)) end |
#created_at ⇒ String
Created-at timestamp rendered through the shared render_date helper.
84 85 86 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 84 def created_at h.render_date(r.created_at) end |
#credit_memo ⇒ ActiveSupport::SafeBuffer
Linked credit-memo reference number → show page.
13 14 15 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 13 def credit_memo h.link_to(r.reference_number, h.credit_memo_path(r.id)) end |
#customer ⇒ ActiveSupport::SafeBuffer
Linked customer name → customer show page.
20 21 22 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 20 def customer h.link_to(r.customer_name, h.customer_path(r.customer_id)) end |
#document_date ⇒ String
Document date rendered through the shared render_date helper.
69 70 71 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 69 def document_date h.render_date(r.document_date) end |
#original_order ⇒ ActiveSupport::SafeBuffer?
Linked original-Order reference → order show page; nil when no
source order is recorded.
54 55 56 57 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 54 def original_order return nil if r.original_order_id.nil? h.link_to(r.original_order_reference_number, h.order_path(r.original_order_id)) end |
#request_date ⇒ String
Date the credit-memo request was filed (often the RMA-creation
date) rendered as CRM date.
77 78 79 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 77 def request_date h.render_date(r.request_date) end |
#rma ⇒ ActiveSupport::SafeBuffer?
Linked Rma number → RMA show page; nil for stand-alone credit memos.
36 37 38 39 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 36 def rma return nil if r.rma_id.nil? h.link_to(r.rma_number, h.rma_path(r.rma_id)) end |
#total ⇒ String
Credit-memo total formatted in its own currency (negative).
62 63 64 |
# File 'app/presenters/search/credit_memo_presenter.rb', line 62 def total h.number_to_currency(r.total, unit: Money::Currency.new(r.currency).symbol) end |