Class: Search::RmaPresenter

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

Overview

Row presenter for RmaSearch — renders the cells in the CRM RMA
search/results table. Wraps a ViewRma projection rather than a fully-loaded
Rma so the search grid stays light.

Direct Known Subclasses

RmaTextPresenter

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

#actual_rma_creditString

Actual RMA credit formatted as currency.

Returns:

  • (String)


69
70
71
# File 'app/presenters/search/rma_presenter.rb', line 69

def actual_rma_credit
  h.number_to_currency(r.actual_rma_credit)
end

#created_atString

Creation date rendered through the shared render_date helper.

Returns:

  • (String)


55
56
57
# File 'app/presenters/search/rma_presenter.rb', line 55

def created_at
  h.render_date(r.created_at)
end

#customerActiveSupport::SafeBuffer?

Linked customer name → customer show page.

Returns:

  • (ActiveSupport::SafeBuffer, nil)


21
22
23
24
25
# File 'app/presenters/search/rma_presenter.rb', line 21

def customer
  return unless r.has_columns?(:customer_full_name, :customer_id)

  h.link_to r.customer_full_name, h.customer_path(r.customer_id)
end

#estimated_rma_creditString

Estimated RMA credit formatted as currency.

Returns:

  • (String)


62
63
64
# File 'app/presenters/search/rma_presenter.rb', line 62

def estimated_rma_credit
  h.number_to_currency(r.estimated_rma_credit)
end

#invoiceActiveSupport::SafeBuffer?

Linked original invoice reference number → invoice show page.

Returns:

  • (ActiveSupport::SafeBuffer, nil)


39
40
41
42
43
# File 'app/presenters/search/rma_presenter.rb', line 39

def invoice
  return unless r.has_columns?(:original_invoice_reference_number, :original_invoice_id)

  h.link_to r.original_invoice_reference_number, h.invoice_path(r.original_invoice_id)
end

#orderActiveSupport::SafeBuffer?

Linked original order reference number → order show page.

Returns:

  • (ActiveSupport::SafeBuffer, nil)


30
31
32
33
34
# File 'app/presenters/search/rma_presenter.rb', line 30

def order
  return unless r.has_columns?(:original_order_reference_number, :original_order_id)

  h.link_to r.original_order_reference_number, h.order_path(r.original_order_id)
end

#returned_reasonsActiveSupport::SafeBuffer

List of returned reasons with code descriptions.

Returns:

  • (ActiveSupport::SafeBuffer)


48
49
50
# File 'app/presenters/search/rma_presenter.rb', line 48

def returned_reasons
  h.rma_returned_reasons_with_explanations(r.returned_reasons)
end

#rmaActiveSupport::SafeBuffer

Linked RMA number → RMA show page.

Returns:

  • (ActiveSupport::SafeBuffer)


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

def rma
  h.link_to r.rma_number, h.rma_path(r)
end