Class: Search::PurchaseOrderPresenter

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

Overview

Presenter: purchase order presenter.

Direct Known Subclasses

PurchaseOrderTextPresenter

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



18
19
20
21
22
# File 'app/presenters/search/purchase_order_presenter.rb', line 18

def items_report_link
  return unless r.has_columns?(:items_report)

  h.render partial: '/purchase_orders/search_items_report', locals: { items_report: r.items_report, search_result: r }
end

#order_dateObject



40
41
42
# File 'app/presenters/search/purchase_order_presenter.rb', line 40

def order_date
  h.render_date r.order_date
end

#promised_delivery_dateObject



36
37
38
# File 'app/presenters/search/purchase_order_presenter.rb', line 36

def promised_delivery_date
  h.render_date r.promised_delivery_date
end


8
9
10
# File 'app/presenters/search/purchase_order_presenter.rb', line 8

def purchase_order_link
  h.link_to r.reference_number, h.purchase_order_path(r.id)
end


12
13
14
15
16
# File 'app/presenters/search/purchase_order_presenter.rb', line 12

def supplier_link
  return unless r.has_columns?(:supplier_full_name, :supplier_id) && h.can?(:read, Supplier)

  h.link_to r.supplier_full_name, h.supplier_path(r.supplier_id)
end

#termsObject



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

def terms
  return h.fa_icon('lock') unless h.can?(:manage_item_costs, r)

  r.terms
end

#total_costsObject



24
25
26
27
28
# File 'app/presenters/search/purchase_order_presenter.rb', line 24

def total_costs
  return h.fa_icon('lock') unless h.can?(:manage_item_costs, r)

  h.number_to_currency(r.total_cost || 0)
end