Module: Crm::RmaDashboardHelper
- Defined in:
- app/helpers/crm/rma_dashboard_helper.rb
Overview
View helpers for the CRM RMA dashboard: the store-switcher dropdown and the
per-state tab definitions (counts plus remote RmaSearch/OrderSearch/CreditMemoSearch links).
Instance Method Summary collapse
-
#rma_dashboard_store_switch_links ⇒ Array<Object>
Store-switcher dropdown items: the current store name followed by links to every other WarmlyYours warehouse store.
-
#rma_tab_options ⇒ Hash{Symbol => Hash}
Tab definitions for the dashboard: one entry per RMA workflow state plus the credit-memo states.
Instance Method Details
#rma_dashboard_store_switch_links ⇒ Array<Object>
Store-switcher dropdown items: the current store name followed by links to
every other WarmlyYours warehouse store.
10 11 12 13 14 15 16 |
# File 'app/helpers/crm/rma_dashboard_helper.rb', line 10 def rma_dashboard_store_switch_links links = [@store.short_name.to_s] Store.warmlyyours_warehouses.excluding(@store).each do |s| links << link_to("Switch to #{s.name}", rma_dashboard_path(s.id), class: 'dropdown-item') end links end |
#rma_tab_options ⇒ Hash{Symbol => Hash}
Tab definitions for the dashboard: one entry per RMA workflow state plus
the credit-memo states. Each entry carries a live :counter and a
:remote_href that lazy-loads the corresponding saved-search table.
States: requested, awaiting_return, auto_return_review, awaiting_inspection,
returned, credited, offset, voided.
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 94 95 96 97 98 99 |
# File 'app/helpers/crm/rma_dashboard_helper.rb', line 24 def 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: %w[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: %w[printed partially_offset], rma_id_not_null: true } ) } hsh end |