Class: CustomerPickerInput

Inherits:
TomSelectInput
  • Object
show all
Defined in:
app/inputs/customer_picker_input.rb

Overview

Supports remote search via /customers/lookup endpoint

Instance Method Summary collapse

Methods inherited from TomSelectInput

#input_html_classes

Instance Method Details

#collectionObject



12
13
14
15
16
# File 'app/inputs/customer_picker_input.rb', line 12

def collection
  return [] unless selected_value

  Customer.where(id: selected_value).pluck(:full_name, :id)
end

#input(wrapper_options = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'app/inputs/customer_picker_input.rb', line 4

def input(wrapper_options = nil)
  input_html_options[:data] ||= {}
  input_html_options[:data]['tom-select-suggest-url-value'] = template.lookup_customers_path
  input_html_options[:data]['tom-select-min-chars-value'] = 0

  super
end