Module: DashboardsHelper

Defined in:
app/helpers/dashboards_helper.rb

Constant Summary collapse

DASHBOARD_PANEL_SUMMARIES =

One-line subtitles under each dashboard widget title (same idea as sales commission show card copy).

{
  'panel-daily-focus' => 'AI-generated morning briefing with priority activities, call follow-ups, and opportunity highlights.',
  'panel-revenues' => 'Month-to-date revenue vs last month and the same month last year.',
  'panel-sales-commission' => 'KPI tiles, profit tables, channel breakdown, and year-over-year trends for this commission month.',
  'panel-activity-performance' => 'Today’s activities and calls compared to expectations for the selected scope.',
  'panel-call-stats' => 'Switchvox call counts and talk time for today for the selected rep or company.',
  'panel-opp-funnel' => 'Open opportunities by pipeline stage; respects the company or rep filter above.',
  'panel-sales-goal' => 'Progress toward monthly and quarterly goals for this rep.',
  'panel-kpi' => 'Weekly KPI call metrics; open the report for rep- or team-level detail.',
  'panel-orders-leads' => 'Web orders, leads, and conversion trends from site performance.',
  'panel-item-sale' => 'Units sold by product grouping and category.',
  'panel-sales-rep-ranking' => 'Rep standings for the current calendar month.',
  'panel-reports' => 'Shortcuts to channel revenue, customer performance, gross sales, and smart services.'
}.freeze

Instance Method Summary collapse

Instance Method Details

#dashboard_employee_heading_avatar(employee) ⇒ Object

Circular profile photo (or initials) for rep dashboard page title—matches CRM employee avatars.



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
# File 'app/helpers/dashboards_helper.rb', line 23

def dashboard_employee_heading_avatar(employee)
  return ''.html_safe unless employee

  size = 48
  inner = if (pic = employee.profile_image)
            image_tag(
              pic.image_url(size: '96x96>'),
              class: 'dashboard-page-heading__avatar rounded-circle object-fit-cover',
              width: size, height: size,
              alt: employee.full_name,
              loading: 'lazy',
              decoding: 'async'
            )
          else
            initials = employee.full_name.to_s.split.map(&:first).join.upcase.first(2)
            (
              :span, initials.presence || '?',
              class: 'dashboard-page-heading__avatar dashboard-page-heading__avatar--initials rounded-circle d-inline-flex align-items-center justify-content-center bg-primary bg-opacity-10 text-primary fw-semibold',
              style: "width: #{size}px; height: #{size}px; font-size: #{size * 0.34}px; line-height: 1;",
              aria: { hidden: true }
            )
          end

  link_to(
    inner,
    employee_path(employee),
    class: 'dashboard-page-heading__avatar-link flex-shrink-0',
    title: "View #{employee.full_name}'s profile"
  )
end

#dashboard_panel_summary(panel_id) ⇒ Object



18
19
20
# File 'app/helpers/dashboards_helper.rb', line 18

def dashboard_panel_summary(panel_id)
  DASHBOARD_PANEL_SUMMARIES[panel_id.to_s]
end