Class: Search::PurchaseOrderPresenter

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

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



15
16
17
18
# File 'app/presenters/search/purchase_order_presenter.rb', line 15

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



34
35
36
# File 'app/presenters/search/purchase_order_presenter.rb', line 34

def order_date
  h.render_date r.order_date
end

#promised_delivery_dateObject



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

def promised_delivery_date
  h.render_date r.promised_delivery_date
end


6
7
8
# File 'app/presenters/search/purchase_order_presenter.rb', line 6

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


10
11
12
13
# File 'app/presenters/search/purchase_order_presenter.rb', line 10

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



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

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

#total_costsObject



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

def total_costs
  return h.fa_icon('lock') unless h.can?(:manage_item_costs, r)
  h.number_to_currency(r.total_cost || 0)
end