Module: Crm::RmaDashboardHelper

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

Instance Method Summary collapse

Instance Method Details



2
3
4
5
6
7
8
# File 'app/helpers/crm/rma_dashboard_helper.rb', line 2

def rma_dashboard_store_switch_links
  links = ["#{@store.short_name}"]
  Store.warmlyyours_warehouses.where.not(id: @store.id).each do |s|
  	links << link_to("Switch to #{s.name}", rma_dashboard_path(s.id), class: 'dropdown-item')
  end
  links
end

#rma_tab_optionsObject

awaiting_return
auto_return_review
awaiting_inspection
returned
credited
offset
voided



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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'app/helpers/crm/rma_dashboard_helper.rb', line 18

def rma_tab_options
  hsh = {}
  hsh[:requested] = {
    counter: Rma.rma_count(@company_id, {state: 'requested'}),
    remote_href: search_and_show_searches_path(
      type: 'RmaSearch',
      target_id: "search_rma_requested",
      query_params: { state_in: ['requested'], company_id_eq: @company_id },
      selected_columns: %i[rma company_name customer order returned_reasons created_at]
    )
  }
  hsh[:awaiting_return] = {
    counter: Rma.rma_count(@company_id, {state: 'awaiting_return'}),
    remote_href: search_and_show_searches_path(
      type: 'RmaSearch',
      target_id: "search_awaiting_return",
      query_params: { state_in: ['awaiting_return'], company_id_eq: @company_id },
      selected_columns: %i[rma company_name customer order returned_reasons created_at]
    )
  }
  hsh[:auto_return_review] = {
    counter: Rma.rma_count(@company_id, {state: 'auto_return_review'}),
    remote_href: search_and_show_searches_path(
      type: 'RmaSearch',
      target_id: "search_auto_return_review",
      query_params: { state_in: ['auto_return_review'], company_id_eq: @company_id },
      selected_columns: %i[rma company_name customer order returned_reasons created_at]
    )
  }
  hsh[:awaiting_inspection] = {
    counter: Rma.rma_count(@company_id, {state: 'awaiting_inspection'}),
    remote_href: search_and_show_searches_path(
      type: 'RmaSearch',
      target_id: "search_awaiting_inspection",
      query_params: { state_in: ['awaiting_inspection'], company_id_eq: @company_id },
      selected_columns: %i[rma company_name customer order returned_reasons created_at]
    )
  }
  hsh[:returned] = {
    counter: Rma.rma_count(@company_id, {state: 'returned'}),
    remote_href: search_and_show_searches_path(
      type: 'RmaSearch',
      target_id: "search_returned",
      query_params: { state_in: ['returned'], company_id_eq: @company_id },
      selected_columns: %i[rma company_name customer order returned_reasons returned_date]
    )
  }
  hsh[:credits_pending_review] = {
    counter: Order.order_count(@company_id, {state: 'pending_review'}),
    remote_href: search_and_show_searches_path(
      type: 'OrderSearch',
      target_id: "search_credits_pending_review",
      query_params: { state_in: ['pending_review'], company_id_eq: @company_id },
      selected_columns: %i[order_link company_name rma_link customer_link original_order_link updated_at]
    )
  }
  hsh[:credits_ready_for_printing] = {
    counter: Order.order_count(@company_id, {state: 'ready_for_printing'}),
    remote_href: search_and_show_searches_path(
      type: 'OrderSearch',
      target_id: "search_credits_ready_for_printing",
      query_params: { state_in: ['ready_for_printing'], company_id_eq: @company_id },
      selected_columns: %i[order_link company_name rma_link customer_link original_order_link created_at]
    )
  }
  hsh[:printed_credit_memos] = {
    counter: CreditMemo.credit_memo_count(@company_id, {state: ['printed', 'partially_offset']}, {rma_id: nil}),
    remote_href: search_and_show_searches_path(
      type: 'CreditMemoSearch',
      target_id: "search_printed_credit_memos",
      query_params: { state_in: ['printed', 'partially_offset'], rma_id_not_null: true }
    )
  }

  hsh
end