Class: ExportedCatalogItemPacketPresenter

Inherits:
BasePresenter
  • Object
show all
Includes:
Presenters::StandardOperationsForRecord
Defined in:
app/presenters/exported_catalog_item_packet_presenter.rb

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



6
7
8
9
10
11
12
13
# File 'app/presenters/exported_catalog_item_packet_presenter.rb', line 6

def catalog_items_link(state = 'active')
  catalogs = exported_catalog_items.collect{|eci| eci.catalog_item.catalog.id rescue 'unassigned'}.uniq
  query_params = {
    catalog_id_in: catalogs.empty? ? [customer.catalog.id] : catalogs,
    catalog_item_state_in: [state]
  }
  h.query_template_link(ProductCatalogSearch, nil, { counter_class: 'badge bg-secondary', query_params: query_params })[0]
end