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 @@