diff --git a/app/controllers/organisation_relationships_controller.rb b/app/controllers/organisation_relationships_controller.rb index 15184fbd5..7ead349c6 100644 --- a/app/controllers/organisation_relationships_controller.rb +++ b/app/controllers/organisation_relationships_controller.rb @@ -53,7 +53,8 @@ class OrganisationRelationshipsController < ApplicationController return end create!(child_organisation_id:, parent_organisation_id:, relationship_type:) - redirect_to housing_providers_organisation_path(related_organisation_id:) + flash[:notice] = "#{Organisation.find(related_organisation_id).name} is now one of #{current_user.data_coordinator? ? 'your' : "this organisation's"} housing providers" + redirect_to housing_providers_organisation_path end def create_managing_agent @@ -84,7 +85,8 @@ class OrganisationRelationshipsController < ApplicationController def delete_housing_provider organisation_relationship_to_remove = OrganisationRelationship.find_by!(child_organisation_id: @organisation.id, parent_organisation_id: target_organisation_id, relationship_type: OrganisationRelationship::OWNING) organisation_relationship_to_remove.destroy! - redirect_to housing_providers_organisation_path(removed_organisation_id: target_organisation_id) + flash[:notice] = "#{Organisation.find(target_organisation_id).name} is no longer one of #{current_user.data_coordinator? ? 'your' : "this organisation's"} housing providers" + redirect_to housing_providers_organisation_path end private diff --git a/app/views/organisation_relationships/housing_providers.html.erb b/app/views/organisation_relationships/housing_providers.html.erb index f9b7ceb7c..3598cb280 100644 --- a/app/views/organisation_relationships/housing_providers.html.erb +++ b/app/views/organisation_relationships/housing_providers.html.erb @@ -1,45 +1,8 @@ <% item_label = format_label(@pagy.count, "housing providers") %> - -<% if current_user.data_coordinator? %> - <% if params["related_organisation_id"] %> - <%= govuk_notification_banner( - title_text: "Success", - success: true, title_heading_level: 3, - title_id: "swanky-notifications" - ) do |notification_banner| - notification_banner.heading(text: "#{Organisation.find(params['related_organisation_id']).name} is now one of your housing providers") - end %> - <% elsif params["removed_organisation_id"] %> - <%= govuk_notification_banner( - title_text: "Success", - success: true, title_heading_level: 3, - title_id: "swanky-notifications" - ) do |notification_banner| - notification_banner.heading(text: "#{Organisation.find(params['removed_organisation_id']).name} is no longer one of your housing providers") - end %> - <% end %> -<% end %> <% if current_user.support? %> <%= render partial: "organisations/headings", locals: { main: @organisation.name, sub: nil } %> <%= render SubNavigationComponent.new(items: secondary_items(request.path, @organisation.id)) %>

Housing Providers

- <% if params["related_organisation_id"] %> - <%= govuk_notification_banner( - title_text: "Success", - success: true, title_heading_level: 3, - title_id: "swanky-notifications" - ) do |notification_banner| - notification_banner.heading(text: "#{Organisation.find(params['related_organisation_id']).name} is now one of this organisation's housing providers") - end %> - <% elsif params["removed_organisation_id"] %> - <%= govuk_notification_banner( - title_text: "Success", - success: true, title_heading_level: 3, - title_id: "swanky-notifications" - ) do |notification_banner| - notification_banner.heading(text: "#{Organisation.find(params['removed_organisation_id']).name} is no longer one of this organisation's housing providers") - end %> - <% end %>

This organisation can submit logs for its housing providers.

<% if @total_count == 0 %>

This organisation does not currently have any housing providers.