Class: ItemMovedScrapSkuPickerInput
- Inherits:
-
TomSelectInput
- Object
- SimpleForm::Inputs::CollectionSelectInput
- TomSelectInput
- ItemMovedScrapSkuPickerInput
- Defined in:
- app/inputs/item_moved_scrap_sku_picker_input.rb
Overview
SimpleForm input wrapper: item moved scrap sku picker.
Instance Method Summary collapse
Methods inherited from TomSelectInput
Instance Method Details
#collection ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/inputs/item_moved_scrap_sku_picker_input.rb', line 9 def collection sql = " select distinct it.sku,it.id from item_ledger_entries le inner join items it on le.item_id = it.id inner join product_lines pl on it.primary_product_line_id = pl.id inner join supplier_items sp on it.id = sp.item_id inner join parties pt on sp.supplier_id = pt.id where location = 'SCRAP' and quantity > 0 and category = 'RMA_RECEIPT'; " result = ActiveRecord::Base.lease_connection.execute(sql) result_data = result.map { |r| [r['sku'], r['id'].to_i] } result_data.map { |r| [r[0], r[1]] }.uniq.sort end |
#input(wrapper_options = nil) ⇒ Object
4 5 6 7 |
# File 'app/inputs/item_moved_scrap_sku_picker_input.rb', line 4 def input( = nil) [:multiple] = true if [:multiple].nil? super end |