diff --git a/app/components/search_component.rb b/app/components/search_component.rb index d13882645..e97398f9e 100644 --- a/app/components/search_component.rb +++ b/app/components/search_component.rb @@ -23,6 +23,8 @@ class SearchComponent < ViewComponent::Base user_path(current_user) elsif request.path.include?("organisations") organisations_path + elsif FeatureToggle.sales_log_enabled? && request.path.include?("sales-logs") + sales_logs_path elsif request.path.include?("logs") lettings_logs_path end diff --git a/app/views/logs/index.html.erb b/app/views/logs/index.html.erb index 31768c731..349d9f29d 100644 --- a/app/views/logs/index.html.erb +++ b/app/views/logs/index.html.erb @@ -64,9 +64,24 @@ <%= render partial: "log_filters" %>
- <%= render SearchComponent.new(current_user:, search_label: "Search by log ID, tenant code, property reference or postcode", value: @searched) %> + <% if current_page?(controller: 'lettings_logs', action: 'index') %> + <%= render SearchComponent.new(current_user:, search_label: "Search by log ID, tenant code, property reference or postcode", value: @searched) %> + <% end %> + + <% if FeatureToggle.sales_log_enabled? && current_page?(controller: 'sales_logs', action: 'index') %> + <%= render SearchComponent.new(current_user:, search_label: "Search by log ID, purchaser code or postcode", value: @searched) %> + <% end %> + <%= govuk_section_break(visible: true, size: "m") %> - <%= render partial: "log_list", locals: { logs: @logs, title: "Logs", pagy: @pagy, searched: @searched, item_label:, total_count: @total_count, csv_download_url: csv_download_lettings_logs_path(search: @search_term) } %> + + <% if current_page?(controller: 'lettings_logs', action: 'index') %> + <%= render partial: "log_list", locals: { logs: @logs, title: "Logs", pagy: @pagy, searched: @searched, item_label:, total_count: @total_count, csv_download_url: csv_download_lettings_logs_path(search: @search_term) } %> + <% end %> + + <% if FeatureToggle.sales_log_enabled? && current_page?(controller: 'sales_logs', action: 'index') %> + <%= render partial: "log_list", locals: { logs: @logs, title: "Logs", pagy: @pagy, searched: @searched, item_label:, total_count: @total_count } %> + <% end %> + <%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "logs" } %>