diff --git a/app/controllers/support/cases/confirm_organisation_controller.rb b/app/controllers/support/cases/confirm_organisation_controller.rb index 2e9489a23..a7aac55d0 100644 --- a/app/controllers/support/cases/confirm_organisation_controller.rb +++ b/app/controllers/support/cases/confirm_organisation_controller.rb @@ -20,7 +20,12 @@ def update private def get_organisation - type = params[:type] == Support::EstablishmentGroup.name ? Support::EstablishmentGroup : Support::Organisation + type = + case params[:type] + when "Support::Organisation" then Support::Organisation + when "Support::EstablishmentGroup" then Support::EstablishmentGroup + when "LocalAuthority" then LocalAuthority + end type.find(params[:id]) end end diff --git a/app/controllers/support/cases/school_details/participating_schools_controller.rb b/app/controllers/support/cases/school_details/participating_schools_controller.rb index d01451a40..f4ab28fb1 100644 --- a/app/controllers/support/cases/school_details/participating_schools_controller.rb +++ b/app/controllers/support/cases/school_details/participating_schools_controller.rb @@ -4,7 +4,7 @@ module SchoolDetails class ParticipatingSchoolsController < Cases::ApplicationController def show @back_url = support_case_school_details_path - @participating_schools = @current_case.participating_schools.map { |s| Support::OrganisationPresenter.new(s) } + @participating_schools = @current_case.participating_schools.includes([:local_authority]).map { |s| Support::OrganisationPresenter.new(s) } end def edit diff --git a/app/controllers/support/concerns/filter_parameters.rb b/app/controllers/support/concerns/filter_parameters.rb index 6697a8766..6380f9f8c 100644 --- a/app/controllers/support/concerns/filter_parameters.rb +++ b/app/controllers/support/concerns/filter_parameters.rb @@ -45,6 +45,7 @@ def permitted_params :level, :sort_by, :sort_order, + :exact_match, { category: [], agent: [], diff --git a/app/controllers/support/establishments_controller.rb b/app/controllers/support/establishments_controller.rb index 8d02cc3ef..1ee8a058a 100644 --- a/app/controllers/support/establishments_controller.rb +++ b/app/controllers/support/establishments_controller.rb @@ -3,7 +3,7 @@ class EstablishmentsController < ::ApplicationController def index respond_to do |format| format.json do - render json: EstablishmentSearch.omnisearch(params[:q]).as_json + render json: EstablishmentSearch.omnisearch(params[:q]).as_json(methods: %i[autocomplete_template]) end end end diff --git a/app/helpers/school_picker_helper.rb b/app/helpers/school_picker_helper.rb index a4be27d91..36bed26e5 100644 --- a/app/helpers/school_picker_helper.rb +++ b/app/helpers/school_picker_helper.rb @@ -18,7 +18,7 @@ def show_school_picker_phase_filters?(organisations) end def show_school_picker_la_filters?(organisations) - organisations.pluck(:local_authority).uniq.length > 1 + organisations.map(&:local_authority).uniq.length > 1 end def show_school_picker_filters?(organisations) diff --git a/app/helpers/support/case_helper.rb b/app/helpers/support/case_helper.rb index d1283bb8f..16fa499f1 100644 --- a/app/helpers/support/case_helper.rb +++ b/app/helpers/support/case_helper.rb @@ -1,7 +1,7 @@ module Support module CaseHelper def other_cases_by_case_org_path(case_organisation, back_to:) - support_case_search_index_path(search_case_form: { search_term: case_organisation.name, state: Support::Case.states.keys.excluding("closed") }, back_to:) + support_case_search_index_path(search_case_form: { search_term: case_organisation.name, state: Support::Case.states.keys.excluding("closed"), exact_match: true }, back_to:) end def other_cases_by_case_org_exist?(case_organisation) diff --git a/app/models/case_request/school_pickable.rb b/app/models/case_request/school_pickable.rb index c7d020415..a18d69d4f 100644 --- a/app/models/case_request/school_pickable.rb +++ b/app/models/case_request/school_pickable.rb @@ -19,7 +19,7 @@ def selected_schools end def eligible_for_school_picker? - return false unless organisation.is_a?(Support::EstablishmentGroup) + return false unless organisation.class.in?([Support::EstablishmentGroup, LocalAuthority]) organisation.eligible_for_school_picker? end diff --git a/app/models/case_request/school_picker.rb b/app/models/case_request/school_picker.rb index 7921a9b62..8527a1293 100644 --- a/app/models/case_request/school_picker.rb +++ b/app/models/case_request/school_picker.rb @@ -1,5 +1,6 @@ class CaseRequest::SchoolPicker include ActiveModel::Model + include CaseRequest::SchoolPicker::Presentable attr_accessor( :case_request, diff --git a/app/models/case_request/school_picker/presentable.rb b/app/models/case_request/school_picker/presentable.rb new file mode 100644 index 000000000..129cbcce3 --- /dev/null +++ b/app/models/case_request/school_picker/presentable.rb @@ -0,0 +1,10 @@ +module CaseRequest::SchoolPicker::Presentable + extend ActiveSupport::Concern + + def organisation_type + case case_request.organisation_type + when "Support::EstablishmentGroup" then "academy trust or federation" + when "LocalAuthority" then "local authority" + end + end +end diff --git a/app/models/local_authority.rb b/app/models/local_authority.rb index 4fc0ce24e..6e5378c56 100644 --- a/app/models/local_authority.rb +++ b/app/models/local_authority.rb @@ -3,4 +3,8 @@ class LocalAuthority < ApplicationRecord validates :la_code, uniqueness: true validates :name, uniqueness: true + + def eligible_for_school_picker? + organisations.count > 1 + end end diff --git a/app/models/support/case/filtering.rb b/app/models/support/case/filtering.rb index d061f4a01..b3b14062d 100644 --- a/app/models/support/case/filtering.rb +++ b/app/models/support/case/filtering.rb @@ -16,6 +16,7 @@ class Support::Case::Filtering attribute :legacy_stage, default: -> { [] } attribute :sort_by attribute :sort_order + attribute :exact_match, default: -> { false } validates :search_term, presence: true, @@ -48,7 +49,7 @@ def filters level: Support::Concerns::ScopeFilter.new(level, scope: :by_level), procurement_stage: Support::Concerns::ScopeFilter.new(procurement_stage, scope: :by_procurement_stage), has_org: Support::Concerns::ScopeFilter.new(ActiveModel::Type::Boolean.new.cast(has_org), scope: :by_has_org, multiple: false), - search_term: Support::Concerns::ScopeFilter.new(search_term, scope: :by_search_term, multiple: false), + search_term: Support::Concerns::ScopeFilterForSearch.new(search_term, exact_match: ActiveModel::Type::Boolean.new.cast(exact_match)), legacy_stage: Support::Concerns::ScopeFilter.new(legacy_stage, scope: :by_legacy_stage), } end diff --git a/app/models/support/case/searchable.rb b/app/models/support/case/searchable.rb index 86806745d..6d4fe9163 100644 --- a/app/models/support/case/searchable.rb +++ b/app/models/support/case/searchable.rb @@ -4,6 +4,6 @@ module Support::Case::Searchable included do has_many :support_case_searches, class_name: "Support::CaseSearch" - scope :by_search_term, ->(terms) { joins(:support_case_searches).merge(Support::CaseSearch.find_a_case(terms)) } + scope :by_search_term, ->(terms, exact_match: false) { joins(:support_case_searches).merge(Support::CaseSearch.find_a_case(terms, exact_match:)) } end end diff --git a/app/models/support/case_search.rb b/app/models/support/case_search.rb index 5a5fab268..d1a518283 100644 --- a/app/models/support/case_search.rb +++ b/app/models/support/case_search.rb @@ -6,17 +6,20 @@ class CaseSearch < ApplicationRecord find_a_case(query).limit(30) } - scope :find_a_case, lambda { |query| + scope :find_a_case, lambda { |query, exact_match: false| + comp = exact_match ? "=" : "LIKE" + query_str = exact_match ? query.downcase : "#{query.downcase}%" + sql = <<-SQL - lower(organisation_name) LIKE :q OR - lower(case_email) LIKE :q OR - lower(organisation_urn) LIKE :q OR - lower(agent_first_name) LIKE :q OR - lower(agent_last_name) LIKE :q + lower(organisation_name) #{comp} :q OR + lower(case_email) #{comp} :q OR + lower(organisation_urn) #{comp} :q OR + lower(agent_first_name) #{comp} :q OR + lower(agent_last_name) #{comp} :q SQL where("case_ref = ?", sprintf("%06d", query.to_i)) - .or(where(sql, q: "#{query.downcase}%")) + .or(where(sql, q: query_str)) .order("case_ref DESC") } end diff --git a/app/models/support/concerns/scope_filter_for_search.rb b/app/models/support/concerns/scope_filter_for_search.rb new file mode 100644 index 000000000..f8da5c2b1 --- /dev/null +++ b/app/models/support/concerns/scope_filter_for_search.rb @@ -0,0 +1,20 @@ +class Support::Concerns::ScopeFilterForSearch + def initialize(value, exact_match: false) + @value = value + @exact_match = exact_match + end + + def filter(records) + return records unless entered? + + records.send(:by_search_term, value, exact_match:) + end + + def entered? + value.present? + end + +private + + attr_reader :value, :exact_match +end diff --git a/app/models/support/establishment_search.rb b/app/models/support/establishment_search.rb index edfd20e6f..1949827a6 100644 --- a/app/models/support/establishment_search.rb +++ b/app/models/support/establishment_search.rb @@ -1,9 +1,12 @@ module Support class EstablishmentSearch < ApplicationRecord + include Presentable + scope :omnisearch, lambda { |query| sql = <<-SQL urn LIKE :q OR ukprn LIKE :q OR + code LIKE :q OR lower(name) LIKE lower(:q) OR lower(postcode) LIKE lower(:q) SQL diff --git a/app/models/support/establishment_search/presentable.rb b/app/models/support/establishment_search/presentable.rb new file mode 100644 index 000000000..30911bf20 --- /dev/null +++ b/app/models/support/establishment_search/presentable.rb @@ -0,0 +1,16 @@ +module Support::EstablishmentSearch::Presentable + extend ActiveSupport::Concern + + def autocomplete_template + ApplicationController.render(partial: "support/establishment_search/#{source.underscore}/autocomplete_template", locals: autocomplete_template_vars) + end + +private + + def autocomplete_template_vars + case source + when "LocalAuthority" then { name:, establishment_type:, code: } + else { name:, postcode:, establishment_type:, urn:, ukprn: } + end + end +end diff --git a/app/presenters/local_authority_presenter.rb b/app/presenters/local_authority_presenter.rb new file mode 100644 index 000000000..0e5a1ab35 --- /dev/null +++ b/app/presenters/local_authority_presenter.rb @@ -0,0 +1,7 @@ +class LocalAuthorityPresenter < SimpleDelegator + def establishment_type_name + "Local authority" + end + + def gias_url = nil +end diff --git a/app/presenters/support/organisation_presenter.rb b/app/presenters/support/organisation_presenter.rb index bb30fb6b9..345030fcb 100644 --- a/app/presenters/support/organisation_presenter.rb +++ b/app/presenters/support/organisation_presenter.rb @@ -21,7 +21,7 @@ def postcode def local_authority return I18n.t("generic.not_provided") unless super - super["name"] + super.name end # @return [String] diff --git a/app/views/components/_new_case_request_components.html.erb b/app/views/components/_new_case_request_components.html.erb index 0af83caca..fafaf1ee7 100644 --- a/app/views/components/_new_case_request_components.html.erb +++ b/app/views/components/_new_case_request_components.html.erb @@ -7,7 +7,7 @@ label_class: "govuk-hint", element_id: "school-urn-autocomplete", element_name: "case_request[organisation_name]", - template_suggestion: "{{name}}, {{postcode}}
{{establishment_type}}
URN: {{urn}} - UKPRN: {{ukprn}}", + template_suggestion: "{{autocomplete_template}}", value_field: :name, default_value: form.object.organisation&.name, hidden_fields: { diff --git a/app/views/engagement/case_requests/school_pickers/edit.html.erb b/app/views/engagement/case_requests/school_pickers/edit.html.erb index d4cb5ed97..3139b1e1f 100644 --- a/app/views/engagement/case_requests/school_pickers/edit.html.erb +++ b/app/views/engagement/case_requests/school_pickers/edit.html.erb @@ -1,4 +1,4 @@ -

<%= I18n.t("support.case_hub_migration.school_picker.title") %>

+

<%= I18n.t("support.case_hub_migration.school_picker.title", organisation_type: @school_picker.organisation_type) %>

<%= render "components/school_picker/school_picker", results_model: @school_picker, diff --git a/app/views/engagement/case_requests/show.html.erb b/app/views/engagement/case_requests/show.html.erb index f2a0f1085..e557edbf9 100644 --- a/app/views/engagement/case_requests/show.html.erb +++ b/app/views/engagement/case_requests/show.html.erb @@ -17,21 +17,23 @@ <%= @case_request.organisation.name %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
-
-
- <%= I18n.t("support.case_hub_migration.label.school_postcode") %> -
-
- <%= @case_request.organisation.postcode %> -
-
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> -
-
+ <% if @case_request.organisation.respond_to?(:postcode) %> +
+
+ <%= I18n.t("support.case_hub_migration.label.school_postcode") %> +
+
+ <%= @case_request.organisation.postcode %> +
+
+ <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %> +
+
+ <% end %> <% if @case_request.organisation.respond_to?(:urn) %>
@@ -42,7 +44,7 @@ <%= @case_request.organisation.urn %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
<% end %> @@ -56,22 +58,38 @@ <%= @case_request.organisation.uid %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
<% end %> -
-
- <%= I18n.t("support.case_hub_migration.label.school_ukprn") %> -
-
- <%= @case_request.organisation.ukprn %> -
-
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> -
-
+ <% if @case_request.organisation.respond_to?(:la_code) %> +
+
+ <%= I18n.t("support.case_hub_migration.label.la_code") %> +
+
+ <%= @case_request.organisation.la_code %> +
+
+ <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %> +
+
+ <% end %> + + <% if @case_request.organisation.respond_to?(:ukprn) %> +
+
+ <%= I18n.t("support.case_hub_migration.label.school_ukprn") %> +
+
+ <%= @case_request.organisation.ukprn %> +
+
+ <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %> +
+
+ <% end %> <% if @case_request.multischool? %>
@@ -82,7 +100,7 @@ <%= I18n.t("support.case_hub_migration.label.school_number", selected: @case_request.school_urns.count, total: @case_request.organisation.organisations.length ) %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_school_picker_path(source: :change_link), class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_school_picker_path(source: :change_link), no_visited_state: true %>
<% end %> @@ -101,7 +119,7 @@ <%= @case_request.full_name %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
@@ -113,7 +131,7 @@ <%= @case_request.email %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
@@ -125,7 +143,7 @@ <%= @case_request.phone_number %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
@@ -137,7 +155,7 @@ <%= @case_request.extension_number %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
@@ -156,7 +174,7 @@ <%= if @case_request.discovery_method == Support::Case::discovery_methods[:other] && !@case_request.discovery_method_other_text.empty? then "- #{@case_request.discovery_method_other_text}" end %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
@@ -175,7 +193,7 @@ <%= @case_request.type %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
@@ -188,7 +206,7 @@ <%= @case_request.category.title %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
<% else %> @@ -200,7 +218,7 @@ <%= @case_request.query.title %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
<% end %> @@ -219,7 +237,7 @@ <%= simple_format(@case_request.request_text, class: "govuk-body") %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
@@ -237,7 +255,7 @@ <%= number_to_currency(@case_request.procurement_amount, unit: "£", precision: 2) %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
<% if @case_request.is_energy_or_services? %> @@ -249,7 +267,7 @@ <%= @case_request.contract_start_date_formatted || I18n.t("faf.check_answers.not_known") %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_contract_start_date_path(@case_request, source: :change_link), class: "govuk-link", id: "edit-contract-start-date", "aria-label": I18n.t("faf.check_answers.aria.change_contract_start_date") %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_contract_start_date_path(@case_request, source: :change_link), class: "govuk-link", id: "edit-contract-start-date", "aria-label": I18n.t("faf.check_answers.aria.change_contract_start_date") %>
<% end %> @@ -262,7 +280,7 @@ <%= @case_request.same_supplier_used_formatted %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_same_supplier_path(@case_request, source: :change_link), class: "govuk-link", id: "edit-same-supplier", "aria-label": I18n.t("faf.check_answers.aria.change_same_supplier_used") %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_same_supplier_path(@case_request, source: :change_link), class: "govuk-link", id: "edit-same-supplier", "aria-label": I18n.t("faf.check_answers.aria.change_same_supplier_used") %>
<% end %> @@ -280,7 +298,7 @@ <%= f.filename %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_engagement_case_request_path, no_visited_state: true %>
<% end %> diff --git a/app/views/support/case_requests/school_pickers/edit.html.erb b/app/views/support/case_requests/school_pickers/edit.html.erb index 1eab73a7d..e57352c4e 100644 --- a/app/views/support/case_requests/school_pickers/edit.html.erb +++ b/app/views/support/case_requests/school_pickers/edit.html.erb @@ -1,4 +1,4 @@ -

<%= I18n.t("support.case_hub_migration.school_picker.title") %>

+

<%= I18n.t("support.case_hub_migration.school_picker.title", organisation_type: @school_picker.organisation_type) %>

<%= render "components/school_picker/school_picker", results_model: @school_picker, diff --git a/app/views/support/case_requests/show.html.erb b/app/views/support/case_requests/show.html.erb index 20ac7a3e9..2aa525dce 100644 --- a/app/views/support/case_requests/show.html.erb +++ b/app/views/support/case_requests/show.html.erb @@ -17,21 +17,23 @@ <%= @case_request.organisation&.name || "No organisation selected" %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
-
-
- <%= I18n.t("support.case_hub_migration.label.school_postcode") %> -
-
- <%= @case_request.organisation&.postcode %> -
-
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> -
-
+ <% if @case_request.organisation.respond_to?(:postcode) %> +
+
+ <%= I18n.t("support.case_hub_migration.label.school_postcode") %> +
+
+ <%= @case_request.organisation.postcode %> +
+
+ <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %> +
+
+ <% end %> <% if @case_request.organisation.respond_to?(:urn) %>
@@ -42,7 +44,7 @@ <%= @case_request.organisation.urn %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
<% end %> @@ -56,22 +58,38 @@ <%= @case_request.organisation.uid %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
<% end %> -
-
- <%= I18n.t("support.case_hub_migration.label.school_ukprn") %> -
-
- <%= @case_request.organisation&.ukprn %> -
-
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> -
-
+ <% if @case_request.organisation.respond_to?(:la_code) %> +
+
+ <%= I18n.t("support.case_hub_migration.label.la_code") %> +
+
+ <%= @case_request.organisation.la_code %> +
+
+ <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %> +
+
+ <% end %> + + <% if @case_request.organisation.respond_to?(:ukprn) %> +
+
+ <%= I18n.t("support.case_hub_migration.label.school_ukprn") %> +
+
+ <%= @case_request.organisation.ukprn %> +
+
+ <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %> +
+
+ <% end %> <% if @case_request.multischool? %>
@@ -82,7 +100,7 @@ <%= I18n.t("support.case_hub_migration.label.school_number", selected: @case_request.school_urns.count, total: @case_request.organisation.organisations.length ) %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_school_picker_path(source: :change_link), class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_school_picker_path(source: :change_link), no_visited_state: true %>
<% end %> @@ -101,7 +119,7 @@ <%= @case_request.full_name %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -113,7 +131,7 @@ <%= @case_request.email %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -125,7 +143,7 @@ <%= @case_request.phone_number %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -137,7 +155,7 @@ <%= @case_request.extension_number %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -156,7 +174,7 @@ <%= if @case_request.discovery_method == Support::Case::discovery_methods[:other] && !@case_request.discovery_method_other_text.empty? then "- #{@case_request.discovery_method_other_text}" end %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -174,7 +192,7 @@ <%= I18n.t("support.case.label.source.#{@case_request.source}") %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -194,7 +212,7 @@ <%= @case_request.type %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -207,7 +225,7 @@ <%= @case_request.category&.title %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
<% else %> @@ -219,7 +237,7 @@ <%= @case_request.query&.title %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
<% end %> @@ -238,7 +256,7 @@ <%= simple_format(@case_request.request_text, class: "govuk-body") %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
@@ -256,7 +274,7 @@ <%= number_to_currency(@case_request.procurement_amount, unit: "£", precision: 2) %>
- <%= link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, class: "govuk-link govuk-link--no-visited-state" %> + <%= govuk_link_to I18n.t("generic.button.change_answer"), edit_support_case_request_path, no_visited_state: true %>
diff --git a/app/views/support/cases/organisations/edit.html.erb b/app/views/support/cases/organisations/edit.html.erb index d99f4e546..3ffdd7e8e 100644 --- a/app/views/support/cases/organisations/edit.html.erb +++ b/app/views/support/cases/organisations/edit.html.erb @@ -7,7 +7,7 @@ label_class: "govuk-!-font-weight-bold govuk-!-font-size-36 govuk-!-margin-bottom-5", element_id: "organisation-autocomplete", element_name: "case_organisation_form[organisation_name]", - template_suggestion: "{{name}}, {{postcode}}
{{establishment_type}}
URN: {{urn}} - UKPRN: {{ukprn}}", + template_suggestion: "{{autocomplete_template}}", value_field: :name, hidden_fields: { 'case_organisation_form[organisation_id]' => :id, diff --git a/app/views/support/cases/school_details/show.html.erb b/app/views/support/cases/school_details/show.html.erb index e7b10ac07..5f4f3a12d 100644 --- a/app/views/support/cases/school_details/show.html.erb +++ b/app/views/support/cases/school_details/show.html.erb @@ -103,12 +103,14 @@ <% if @current_case.organisation.present? %>