2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'app/helpers/crm/tech_bench_helper.rb', line 2
def render_tech_bench_item_actions(store_item)
options = ['Select Action']
can_reclass = can?(:do_item_reclassification, ItemLedgerEntry)
can_location_transfer = can?(:do_location_transfer, ItemLedgerEntry)
options << link_to("Print Item Label for #{store_item.item.sku}", print_label_item_path(store_item.item_id, return_path: request.url))
if refurb_item = store_item.item.refurbished_version
options << link_to("Print Item Label for #{refurb_item.sku}", print_label_item_path(refurb_item, return_path: request.url))
elsif store_item.item.condition_new? && can?(:create, Item)
catalog_ids = store_item.item.catalog_items.map(&:catalog_id).uniq options << link_to('Create B-Stock SKU', clone_item_path(store_item.item_id, item: { action_type: 'refurbish', catalogs: catalog_ids }, return_path: request.url))
end
if can_reclass
if bl = reclass_to_bstock_link(store_item)
options << link_to('Re-class to B-Stock', bl)
end
end
if can_location_transfer && store_item.item.condition_new?
location_transfer_params = {
store_id: store_item.store_id,
store: store_item.store_id,
from: store_item.location,
item_id: store_item.item_id,
return_path: request.url,
to: 'AVAILABLE'
}
options << link_to('Transfer to A-Stock', location_transfer_item_ledger_entries_path(location_transfer_params))
end
if can_reclass
reclass_params = {
store: store_item.store_id,
from: store_item.location,
from_store_item_id: store_item.id,
return_path: request.url
}
options << link_to('Item Re-classification',
item_reclassification_item_ledger_entries_path(reclass_params))
end
if can_location_transfer
options << link_to('Location Transfer', location_transfer_item_ledger_entries_path(store_id: store_item.store_id, store: store_item.store_id, from: store_item.location, item_id: store_item.item_id, return_path: request.url ))
end
if can?(:do_inventory_adjustment, ItemLedgerEntry)
options << link_to('Inventory Adjustment', inventory_adjustment_item_ledger_entries_path(store_item_id: store_item.id, return_path: request.url ))
end
if can?(:read, ItemLedgerEntrySearch)
query_params = { store_id_in: [store_item.store_id], location_in: [store_item.location], item_id_in: [store_item.item_id] }
options << link_to('Item Ledger Search', search_and_show_searches_path(search_mode: :full, type: 'ItemLedgerEntrySearch', query_params: query_params))
end
render_simple_drop_down options
end
|