Module: Models::RepSearchable::ClassMethods
- Defined in:
- app/concerns/models/rep_searchable.rb
Instance Method Summary collapse
- #grouped_local_sales_reps_for_select(include_unassigned_search: true) ⇒ Object
- #grouped_primary_sales_reps_for_select(include_unassigned_search: true) ⇒ Object
- #grouped_rep_for_select(active_reps: [], label: 'Reps - Active', include_unassigned_search: true) ⇒ Object
- #grouped_secondary_sales_reps_for_select(include_unassigned_search: true) ⇒ Object
- #grouped_service_reps_for_select(include_unassigned_search: true) ⇒ Object
- #grouped_technical_reps_for_select(include_unassigned_search: true) ⇒ Object
Instance Method Details
#grouped_local_sales_reps_for_select(include_unassigned_search: true) ⇒ Object
28 29 30 31 |
# File 'app/concerns/models/rep_searchable.rb', line 28 def grouped_local_sales_reps_for_select(include_unassigned_search: true) active_reps = Employee.local_sales_reps.sorted.pluck(:full_name, :id) grouped_rep_for_select(active_reps: active_reps, label: 'Local Reps - Active') end |
#grouped_primary_sales_reps_for_select(include_unassigned_search: true) ⇒ Object
18 19 20 21 |
# File 'app/concerns/models/rep_searchable.rb', line 18 def grouped_primary_sales_reps_for_select(include_unassigned_search: true) active_reps = Employee.primary_sales_reps.active_employees.sorted.pluck(:full_name, :id) grouped_rep_for_select(active_reps: active_reps, label: 'Primary Reps - Active') end |
#grouped_rep_for_select(active_reps: [], label: 'Reps - Active', include_unassigned_search: true) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'app/concerns/models/rep_searchable.rb', line 9 def grouped_rep_for_select(active_reps: [], label: 'Reps - Active', include_unassigned_search: true) all_reps = Employee.(active_only: false, exclude_ids: active_reps.map(&:last).compact) res = {} res['Special Search'] = [['Unassigned','Unassigned']] if include_unassigned_search res[label] = active_reps if active_reps.present? res['All Reps Past and Present'] = all_reps res end |
#grouped_secondary_sales_reps_for_select(include_unassigned_search: true) ⇒ Object
23 24 25 26 |
# File 'app/concerns/models/rep_searchable.rb', line 23 def grouped_secondary_sales_reps_for_select(include_unassigned_search: true) active_reps = Employee.secondary_sales_reps.sorted.pluck(:full_name, :id) grouped_rep_for_select(active_reps: active_reps, label: 'Secondary Reps - Active') end |
#grouped_service_reps_for_select(include_unassigned_search: true) ⇒ Object
33 34 35 36 |
# File 'app/concerns/models/rep_searchable.rb', line 33 def grouped_service_reps_for_select(include_unassigned_search: true) active_reps = Employee.(active_only: true) grouped_rep_for_select(active_reps: active_reps, label: 'Service Reps - Active') end |
#grouped_technical_reps_for_select(include_unassigned_search: true) ⇒ Object
38 39 40 41 |
# File 'app/concerns/models/rep_searchable.rb', line 38 def grouped_technical_reps_for_select(include_unassigned_search: true) active_reps = Employee. grouped_rep_for_select(active_reps: active_reps, label: 'Technical Reps - Active') end |