From 07044775cf7b3c3a6573eefbc8ae6aa1e5799c73 Mon Sep 17 00:00:00 2001 From: Rachael Booth Date: Fri, 22 Nov 2024 16:56:06 +0000 Subject: [PATCH] Update hint message about created locations, and restrict location creation to relevant org statuses --- app/helpers/schemes_helper.rb | 7 ++++++- app/views/locations/index.html.erb | 15 +++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/helpers/schemes_helper.rb b/app/helpers/schemes_helper.rb index 11ebd4a6b..4d95bef8a 100644 --- a/app/helpers/schemes_helper.rb +++ b/app/helpers/schemes_helper.rb @@ -84,7 +84,12 @@ module SchemesHelper when :deactivating_soon "This scheme deactivates on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date." when :deactivated - "This scheme deactivated on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date." + case scheme.organisation.status + when :active + "This scheme deactivated on #{scheme.last_deactivation_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Reactivate the scheme to add locations active after this date." + when :merged + "This scheme has been deactivated due to its organisation merging on #{scheme.organisation.merge_date.to_formatted_s(:govuk_date)}. Any locations you add will be deactivated on the same date. Use the new (after merge) organisation for schemes and locations active after this date." + end end end diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb index 64d9bf286..aa1fa6253 100644 --- a/app/views/locations/index.html.erb +++ b/app/views/locations/index.html.erb @@ -56,14 +56,13 @@ <% end %> <% end %> - <% if status_hint_message = scheme_status_hint(@scheme) %> -
- <%= status_hint_message %> -
-
- <% end %> - - <% if LocationPolicy.new(current_user, @scheme.locations.new).create? %> + <% if LocationPolicy.new(current_user, @scheme.locations.new).create? && [:active, :merged].include?(@scheme.organisation.status) %> + <% if status_hint_message = scheme_status_hint(@scheme) %> +
+ <%= status_hint_message %> +
+
+ <% end %> <%= govuk_button_to "Add a location", scheme_locations_path(@scheme), method: "post" %> <% end %>