Module: Workarea::Admin::ReportsHelper

Defined in:
app/helpers/workarea/admin/reports_helper.rb

Instance Method Summary collapse

Instance Method Details

#customers_report_filter_optionsObject



48
49
50
51
52
53
54
# File 'app/helpers/workarea/admin/reports_helper.rb', line 48

def customers_report_filter_options
  [
    [t('workarea.admin.reports.customers.filters.all'), nil],
    [t('workarea.admin.reports.customers.filters.one_time'), 'one_time'],
    [t('workarea.admin.reports.customers.filters.returning'), 'returning']
  ]
end


28
29
30
31
32
33
34
35
36
37
38
# File 'app/helpers/workarea/admin/reports_helper.rb', line 28

def link_to_reports_sorting(name, report:, sort_by:)
  direction = if report.sort_by == sort_by
    report.sort_direction == 'desc' ? 'asc' : 'desc'
  else
    :desc
  end

  icons = { 'desc' => '↓', 'asc' => '↑' }
  icon = report.sort_by == sort_by ? icons[report.sort_direction] : ''
  link_to "#{name} #{icon}".strip, params.merge(sort_by: sort_by, sort_direction: direction)
end

#render_reports_results_message(report) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/workarea/admin/reports_helper.rb', line 4

def render_reports_results_message(report)
  if report.more_results?
    t(
      'workarea.admin.reports.partial_results_html',
      count: report.count,
      export_link: link_to(
        t('workarea.admin.reports.export_results').downcase,
        '#export-results',
        data: { tooltip: { interactive: true, side: 'bottom' } }
      )
    )
  else
    t(
      'workarea.admin.reports.full_results_html',
      count: report.count,
      export_link: link_to(
        t('workarea.admin.reports.export_results'),
        '#export-results',
        data: { tooltip: { interactive: true, side: 'bottom' } }
      )
    )
  end
end

#searches_report_filter_optionsObject



40
41
42
43
44
45
46
# File 'app/helpers/workarea/admin/reports_helper.rb', line 40

def searches_report_filter_options
  [
    [t('workarea.admin.reports.searches.filters.all'), nil],
    [t('workarea.admin.reports.searches.filters.with_results'), 'with_results'],
    [t('workarea.admin.reports.searches.filters.without_results'), 'without_results']
  ]
end