Browse Source

feat: update filters view

pull/1998/head
natdeanlewissoftwire 3 years ago
parent
commit
15759e0602
  1. 2
      app/models/lettings_log.rb
  2. 18
      app/views/logs/_log_filters.html.erb

2
app/models/lettings_log.rb

@ -61,7 +61,7 @@ class LettingsLog < Log
scope :unresolved, -> { where(unresolved: true) }
scope :filter_by_organisation, ->(org, _user = nil) { where(owning_organisation: org).or(where(managing_organisation: org)) }
scope :filter_by_owning_organisation, ->(owning_organisation, _user = nil) { where(owning_organisation:) }
scope :filter_by_managing_organisation, ->(managing_organisation, _user = nil) { where(managing_organisation:) }
scope :filter_by_managing_organisation, ->(managing_organisation, _user = nil) { where(managing_organisation:) }
scope :age1_answered, -> { where.not(age1: nil).or(where(age1_known: 1)) }
scope :tcharge_answered, -> { where.not(tcharge: nil).or(where(household_charge: 1)).or(where(is_carehome: 1)) }
scope :chcharge_answered, -> { where.not(chcharge: nil).or(where(is_carehome: [nil, 0])) }

18
app/views/logs/_log_filters.html.erb

@ -42,13 +42,15 @@
category: "status",
} %>
<%= render partial: "filters/checkbox_filter",
locals: {
f:,
options: needstype_filters,
label: "Needs type",
category: "needstypes",
} %>
<% if request.path.include?("/lettings-logs") %>
<%= render partial: "filters/checkbox_filter",
locals: {
f:,
options: needstype_filters,
label: "Needs type",
category: "needstypes",
} %>
<% end %>
<% end %>
<%= render partial: "filters/radio_filter",
@ -71,7 +73,7 @@
category: "assigned_to",
} %>
<% if current_user.support? || current_user.organisation.stock_owners.count > 1 && request.path == "/lettings-logs" %>
<% if (current_user.support? || current_user.organisation.stock_owners.count > 1) && request.path == "/lettings-logs" %>
<%= render partial: "filters/radio_filter", locals: {
f:,
options: {

Loading…
Cancel
Save