Module: Crm::StorageLocationsHelper

Defined in:
app/helpers/crm/storage_locations_helper.rb

Instance Method Summary collapse

Instance Method Details

#storage_location_breadcrumb(storage_location = @storage_location) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/crm/storage_locations_helper.rb', line 3

def storage_location_breadcrumb(storage_location = @storage_location)
  bc_array = []
  concatenated_filter = {}
  %i[zone aisle section level bin].each do |filter|
    location_val = storage_location.send(filter)
    location_val_formatted = storage_location.send("formatted_#{filter}".to_sym)
    concatenated_filter["#{filter}_eq"] = location_val
    bc_array << tag.li(class: 'breadcrumb-item') do
      link_to "#{filter.to_s.humanize} #{location_val_formatted}", store_storage_locations_path(storage_location.store, q: concatenated_filter)
    end
  end
  bc_array.join('').html_safe
end

#storage_location_reference(storage_location = @storage_location) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/crm/storage_locations_helper.rb', line 17

def storage_location_reference(storage_location = @storage_location)
  bc_array = []
  concatenated_filter = {}
  storage_location.index_fields.each do |filter|
    location_val = storage_location.send(filter)
    location_val_formatted = storage_location.send("formatted_#{filter}".to_sym)
    concatenated_filter["#{filter}_eq"] = location_val
    bc_array << link_to(location_val_formatted,
                store_storage_locations_path(storage_location.store, q: concatenated_filter),
                title: filter.to_s.humanize,
                data: { 'bs-toggle': 'tooltip' },
                class: 'btn btn-link')
  end
  bc_array.join('.').html_safe
end