Class: Crm::DailyFocusSummaryComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/crm/daily_focus_summary_component.rb

Overview

ViewComponent: renders the daily focus summary block.

Instance Attribute Summary collapse

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(pending_count:, approved_count:, missing_count:, processing_count: 0, audience: 'sales') ⇒ DailyFocusSummaryComponent

Returns a new instance of DailyFocusSummaryComponent.

Parameters:

  • pending_count (Integer)

    reps awaiting review

  • approved_count (Integer)

    reps approved for the day

  • missing_count (Integer)

    reps with no daily focus submitted

  • processing_count (Integer) (defaults to: 0)

    reps whose daily focus is still being processed

  • audience (String) (defaults to: 'sales')

    which population this card counts — also what
    scopes the frame id and the review link



11
12
13
14
15
16
17
18
# File 'app/components/crm/daily_focus_summary_component.rb', line 11

def initialize(pending_count:, approved_count:, missing_count:, processing_count: 0, audience: 'sales')
  super()
  @processing_count = processing_count
  @pending_count = pending_count
  @approved_count = approved_count
  @missing_count = missing_count
  @audience = audience
end

Instance Attribute Details

#approved_countInteger (readonly)

Returns reps approved for the day.

Returns:

  • (Integer)

    reps approved for the day



30
# File 'app/components/crm/daily_focus_summary_component.rb', line 30

attr_reader :processing_count, :pending_count, :approved_count, :missing_count, :audience

#audienceObject (readonly)

Returns the value of attribute audience.



30
# File 'app/components/crm/daily_focus_summary_component.rb', line 30

attr_reader :processing_count, :pending_count, :approved_count, :missing_count, :audience

#missing_countInteger (readonly)

Returns reps with no daily focus submitted.

Returns:

  • (Integer)

    reps with no daily focus submitted



30
# File 'app/components/crm/daily_focus_summary_component.rb', line 30

attr_reader :processing_count, :pending_count, :approved_count, :missing_count, :audience

#pending_countInteger (readonly)

Returns reps awaiting review.

Returns:

  • (Integer)

    reps awaiting review



30
# File 'app/components/crm/daily_focus_summary_component.rb', line 30

attr_reader :processing_count, :pending_count, :approved_count, :missing_count, :audience

#processing_countInteger (readonly)

Returns reps whose daily focus is still being processed.

Returns:

  • (Integer)

    reps whose daily focus is still being processed



30
31
32
# File 'app/components/crm/daily_focus_summary_component.rb', line 30

def processing_count
  @processing_count
end

Instance Method Details

#frame_idString

CrmHelper#panel wraps a lazy body in frame-<panel id>, and the dashboard
now renders one panel per audience. The response has to carry the SAME id
or Turbo finds no matching frame and falls back to a full-page navigation —
which is what a hardcoded frame-panel-daily-focus-review did to both
cards the moment they were split.

Returns:

  • (String)


39
40
41
# File 'app/components/crm/daily_focus_summary_component.rb', line 39

def frame_id
  "frame-panel-daily-focus-review-#{audience}"
end