Class: Crm::RevenueWidgetComponent

Inherits:
ApplicationComponent show all
Includes:
DashboardQueryLink
Defined in:
app/components/crm/revenue_widget_component.rb

Overview

ViewComponent: renders the revenue widget block on the CRM dashboard,
with per-company invoiced totals and sales/delivery queue aggregates.

Constant Summary collapse

ON_HOLD_STATES =

Recognised on-hold order states shown in the widget's on-hold queue.

%i[
  pending pending_payment pending_release_authorization
  awaiting_carrier_assignment pre_pack in_cr_hold
  needs_programming_details needs_serial_number_reservation
  profit_review
].freeze

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#cms_link, #fetch_or_fallback, #image_asset_tag, #image_tag, #number_to_currency, #number_with_delimiter, #post_path, #post_url, #strip_tags

Constructor Details

#initialize(employee: nil) ⇒ RevenueWidgetComponent

Returns a new instance of RevenueWidgetComponent.

Parameters:

  • employee (Employee, nil) (defaults to: nil)

    optional sales rep used to scope the
    widget's links and counters to a single employee



18
19
20
21
22
23
# File 'app/components/crm/revenue_widget_component.rb', line 18

def initialize(employee: nil)
  super()
  @employee = employee
  @companies = Company.sales_companies
  @company_ids = @companies.map(&:id)
end