Class: Crm::Report::ActivityPerformanceResultPresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- Crm::Report::ActivityPerformanceResultPresenter
- Defined in:
- app/presenters/crm/report/activity_performance_result_presenter.rb
Overview
Presenter: activity performance result presenter.
Delegated Instance Attributes collapse
-
#tags ⇒ Object
Alias for Class#tags.
Class Method Summary collapse
-
.tags ⇒ Array
Activity tags shown in the report.
Instance Method Summary collapse
-
#closed_activities(tag = nil) ⇒ ActiveSupport::SafeBuffer
Link to the activity search for closed activities, optionally tag-scoped.
-
#closed_by_tag(tag) ⇒ ActiveSupport::SafeBuffer
Link (or dash) for closed activities with the given tag.
-
#date ⇒ Date, ...
Report date from the presenter options.
-
#open_activities(tag = nil) ⇒ ActiveSupport::SafeBuffer
Link to the activity search for open activities, optionally tag-scoped.
-
#open_by_tag(tag) ⇒ ActiveSupport::SafeBuffer
Link (or dash) for open activities with the given tag.
-
#total_closed_activities ⇒ ActiveSupport::SafeBuffer
Link (or dash) for the total closed activities.
-
#total_open_activities ⇒ ActiveSupport::SafeBuffer
Link (or dash) for the total open activities.
Class Method Details
.tags ⇒ Array
Activity tags shown in the report.
15 16 17 18 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 15 def self. # (1..ActivityType::TOTAL_TIERS) ActivityType::TAGS_FOR_REPORTS end |
Instance Method Details
#closed_activities(tag = nil) ⇒ ActiveSupport::SafeBuffer
Link to the activity search for closed activities, optionally tag-scoped.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 76 def closed_activities(tag = nil) ca_count = tag.present? ? r.closed_by_tag[tag[1]] : r.total_closed_activities return h.content_tag(:span, '-') if ca_count == 0 = { query_params: { completion_datetime_gteq_time: date.beginning_of_day, completion_datetime_lteq_time: date.end_of_day, closed_by_id_in: [r.employee_id], activity_type_id: ['Any'], activity_result_type_id: ['AnyCompletion'] }, counter_class: 'badge bg-success', num_records: ca_count, set_limit: 100 } if tag tag[0] == 'CALLBLOCK' ? [:query_params][:tag2_in] = tag[0] : [:query_params][:tag1_in] = tag[0] end link, = h.query_template_link(ActivitySearch, nil, ) link.html_safe end |
#closed_by_tag(tag) ⇒ ActiveSupport::SafeBuffer
Link (or dash) for closed activities with the given tag.
44 45 46 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 44 def closed_by_tag(tag) closed_activities(tag) end |
#date ⇒ Date, ...
Report date from the presenter options.
9 10 11 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 9 def date @options[:date] end |
#open_activities(tag = nil) ⇒ ActiveSupport::SafeBuffer
Link to the activity search for open activities, optionally tag-scoped.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 51 def open_activities(tag = nil) oa_count = tag.present? ? r.open_by_tag[tag[1]] : r.total_open_activities return h.content_tag(:span, '-') if oa_count == 0 = { query_params: { open_on_date: date, assigned_resource_id: [r.employee_id], activity_type_id: ['Any'] }, counter_class: 'badge bg-warning', num_records: oa_count, set_limit: 100 } # options[:query_params][:activity_type_priority_in] = [tier] if tier if tag tag[0] == 'CALLBLOCK' ? [:query_params][:tag2_in] = tag[0] : [:query_params][:tag1_in] = tag[0] end link, = h.query_template_link(ActivitySearch, nil, ) link.html_safe end |
#open_by_tag(tag) ⇒ ActiveSupport::SafeBuffer
Link (or dash) for open activities with the given tag.
37 38 39 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 37 def open_by_tag(tag) open_activities(tag) end |
#tags ⇒ Object
Alias for Class#tags
20 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 20 delegate :tags, to: :class |
#total_closed_activities ⇒ ActiveSupport::SafeBuffer
Link (or dash) for the total closed activities.
30 31 32 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 30 def total_closed_activities closed_activities end |
#total_open_activities ⇒ ActiveSupport::SafeBuffer
Link (or dash) for the total open activities.
24 25 26 |
# File 'app/presenters/crm/report/activity_performance_result_presenter.rb', line 24 def total_open_activities open_activities end |