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
|
# File 'app/helpers/crm/order_dashboard_helper.rb', line 2
def order_dashboard_tab_options
hsh = {}
params_hash = {company_id: @company_id, report_grouping: @report_grouping, sales_rep_id: @sales_rep_id, sort_by: @sort_by, sort_direction: @sort_direction}
orders_need_attention_counter = get_orders_from_selections.all_awaiting_deliveries.with_associations.joins(:deliveries).where("deliveries.state = 'quoting'").count
if orders_need_attention_counter > 0
hsh[:orders_need_attention] = { counter: orders_need_attention_counter, remote_href: order_dashboard_tab_orders_need_attention_path(params_hash) }
end
dropship_orders_need_attention_counter = get_orders_from_selections.all_awaiting_deliveries.with_associations.joins(:deliveries).where("deliveries.state = 'awaiting_po_fulfillment' OR deliveries.state = 'processing_po_fulfillment'").count
if dropship_orders_need_attention_counter > 0
hsh[:dropship_orders_need_attention] = { counter: dropship_orders_need_attention_counter, remote_href: order_dashboard_tab_dropship_orders_need_attention_path(params_hash) }
end
pending_counter = get_orders_from_selections.pending.count
if pending_counter > 0
hsh[:pending] = { counter: pending_counter, remote_href: order_dashboard_tab_pending_path(params_hash) }
end
profit_review_counter = get_orders_from_selections.profit_review.count
if profit_review_counter > 0
hsh[:profit_review] = { counter: profit_review_counter, remote_href: order_dashboard_tab_profit_review_path(params_hash) }
end
in_cr_hold_counter = get_orders_from_selections.held.count
if in_cr_hold_counter > 0
hsh[:in_cr_hold] = { counter: in_cr_hold_counter, remote_href: order_dashboard_tab_in_cr_hold_path(params_hash) }
end
back_order_counter = get_orders_from_selections.back_order.count
if back_order_counter > 0
hsh[:back_order] = { counter: back_order_counter, remote_href: order_dashboard_tab_back_order_path(params_hash) }
end
pending_release_authorization_counter = get_orders_from_selections.in_state(:pending_release_authorization).count
if pending_release_authorization_counter > 0
hsh[:pending_release_authorization] = { counter: pending_release_authorization_counter, remote_href: order_dashboard_tab_pending_release_authorization_path(params_hash) }
end
pending_payment_counter = get_orders_from_selections.in_state(:pending_payment).count
if pending_payment_counter > 0
hsh[:pending_payment] = { counter: pending_payment_counter, remote_href: order_dashboard_tab_pending_payment_path(params_hash) }
end
pre_pack_counter = get_orders_from_selections.in_state(:pre_pack).count
if pre_pack_counter > 0
hsh[:pre_pack] = { counter: pre_pack_counter, remote_href: order_dashboard_tab_pre_pack_path(params_hash) }
end
awaiting_carrier_assignment_counter = get_orders_from_selections.in_state(:awaiting_carrier_assignment).count
if awaiting_carrier_assignment_counter > 0
hsh[:awaiting_carrier_assignment] = { counter: awaiting_carrier_assignment_counter, remote_href: order_dashboard_tab_awaiting_carrier_assignment_path(params_hash) }
end
if @report_grouping == "Amazon"
awaiting_deliveries_counter = get_orders_from_selections.in_state(:awaiting_deliveries).count
if awaiting_deliveries_counter > 0
hsh[:awaiting_deliveries] = { counter: awaiting_deliveries_counter, remote_href: order_dashboard_tab_awaiting_deliveries_path(params_hash) }
end
end
future_release_counter = get_orders_from_selections.future_release.count
if future_release_counter > 0
hsh[:future_release] = { counter: future_release_counter, remote_href: order_dashboard_tab_future_release_path(params_hash) }
end
hsh
end
|