From fd5b65a277e0ff3d20b06d58638b12cf8e9a28ee Mon Sep 17 00:00:00 2001 From: Manny Dinssa Date: Mon, 15 Jul 2024 16:06:43 +0100 Subject: [PATCH] Fix merge conflict --- app/models/scheme.rb | 3 +++ app/views/schemes/_scheme_list.html.erb | 7 ++++++- app/views/schemes/show.html.erb | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 5b95ed98a..b33136e5c 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -295,6 +295,9 @@ class Scheme < ApplicationRecord status == :active end + def all_locations_inactive? + active? && locations.all? { |location| !location.active? } + end def reactivating_soon? status == :reactivating_soon end diff --git a/app/views/schemes/_scheme_list.html.erb b/app/views/schemes/_scheme_list.html.erb index 83908d85b..2317b038b 100644 --- a/app/views/schemes/_scheme_list.html.erb +++ b/app/views/schemes/_scheme_list.html.erb @@ -26,7 +26,12 @@ <% row.with_cell(text: scheme.owning_organisation&.name) %> <% row.with_cell(text: scheme.id_to_display) %> <% row.with_cell(text: scheme.locations.visible&.count) %> - <% row.with_cell(text: status_tag_from_resource(scheme)) %> + <% row.with_cell do %> + <%= status_tag_from_resource(scheme) %> + <% if scheme.all_locations_inactive? %> + <%= content_tag(:div, "No currently active locations", class: "app-!-colour-muted", style: "margin-top: 10px") %> + <% end %> + <% end %> <% end %> <% end %> <% end %> diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb index 1aefadef5..d8f31fd37 100644 --- a/app/views/schemes/show.html.erb +++ b/app/views/schemes/show.html.erb @@ -26,6 +26,9 @@
Status
<%= details_html({ name: "Status", value: status_tag_from_resource(@scheme), id: "status" }) %> + <% if @scheme.confirmed? && @scheme.all_locations_inactive? %> + No currently active locations + <% end %> <% if @scheme.confirmed? && @scheme.locations.confirmed.none? && LocationPolicy.new(current_user, @scheme.locations.new).create? %> Complete this scheme by adding a location using the <%= govuk_link_to("‘locations’ tab", scheme_locations_path(@scheme)) %>. <% end %>