diff --git a/app/components/search_component.rb b/app/components/search_component.rb index 201c341cf..676257263 100644 --- a/app/components/search_component.rb +++ b/app/components/search_component.rb @@ -11,6 +11,8 @@ class SearchComponent < ViewComponent::Base def path(current_user) if request.path.include?("users") user_path(current_user) + elsif request.path.include?("organisations") && request.path.include?("logs") + request.path elsif request.path.include?("organisations") organisations_path elsif request.path.include?("logs") diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb index 7b5eceac4..ad195b624 100644 --- a/app/controllers/organisations_controller.rb +++ b/app/controllers/organisations_controller.rb @@ -55,7 +55,17 @@ class OrganisationsController < ApplicationController set_session_filters(specific_org: true) organisation_logs = CaseLog.all.where(owning_organisation_id: @organisation.id) - @pagy, @case_logs = pagy(filtered_case_logs(organisation_logs)) + + @pagy, @case_logs = pagy( + filtered_case_logs( + filtered_collection( + organisation_logs, search_term + ), + ), + ) + @searched = search_term.presence + @total_count = organisation_logs.size + render "logs", layout: "application" else redirect_to(case_logs_path)