Class: ExportedCatalogItemPacketPresenter

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

Overview

Presenter: exported catalog item packet presenter.

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



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/presenters/exported_catalog_item_packet_presenter.rb', line 8

def catalog_items_link(state = 'active')
  catalogs = exported_catalog_items.map do |eci|
    eci.catalog_item.catalog.id
  rescue StandardError
    'unassigned'
  end.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