diff --git a/app/controllers/schemes_controller.rb b/app/controllers/schemes_controller.rb index 73fe02f79..ad274d074 100644 --- a/app/controllers/schemes_controller.rb +++ b/app/controllers/schemes_controller.rb @@ -92,11 +92,7 @@ class SchemesController < ApplicationController validation_errors scheme_params if @scheme.errors.empty? && @scheme.save - if @scheme.arrangement_type_before_type_cast == "D" - redirect_to scheme_primary_client_group_path(@scheme) - else - redirect_to scheme_support_services_provider_path(@scheme) - end + redirect_to scheme_primary_client_group_path(@scheme) else @scheme.errors.add(:owning_organisation_id, message: @scheme.errors[:organisation]) @scheme.errors.delete(:owning_organisation) @@ -182,12 +178,6 @@ class SchemesController < ApplicationController render "schemes/edit_name" end - def support_services_provider - render_not_found and return unless @scheme - - render "schemes/support_services_provider" - end - private def validation_errors(scheme_params) @@ -196,10 +186,6 @@ private @scheme.errors.add(key.to_sym) end end - - if @scheme.arrangement_type_same? && arrangement_type_value(scheme_params[:arrangement_type]) != "D" - @scheme.errors.delete(:managing_organisation_id) - end end def confirm_secondary_page?(page) @@ -209,8 +195,6 @@ private def current_template(page) if page.include?("primary") "schemes/primary_client_group" - elsif page.include?("support-services-provider") - "schemes/support_services_provider" elsif page.include?("confirm") "schemes/confirm_secondary" elsif page.include?("secondary-client") @@ -228,8 +212,6 @@ private def next_page_path(page) case page - when "support-services-provider" - scheme_primary_client_group_path(@scheme) when "primary-client-group" scheme_confirm_secondary_client_group_path(@scheme) when "confirm-secondary" @@ -239,13 +221,7 @@ private when "support" scheme_check_answers_path(@scheme) when "details" - if @scheme.arrangement_type_before_type_cast == "D" - scheme_primary_client_group_path(@scheme) - elsif @scheme.arrangement_type.present? && @scheme.arrangement_type_before_type_cast != "D" - scheme_support_services_provider_path(@scheme) - else - scheme_details_path(@scheme) - end + scheme_primary_client_group_path(@scheme) when "edit-name" scheme_check_answers_path(@scheme) when "check-answers" diff --git a/app/helpers/schemes_helper.rb b/app/helpers/schemes_helper.rb index 3cbac5789..0503f88b3 100644 --- a/app/helpers/schemes_helper.rb +++ b/app/helpers/schemes_helper.rb @@ -8,7 +8,6 @@ module SchemesHelper { name: "Registered under Care Standards Act 2000", value: scheme.registered_under_care_act }, { name: "Housing stock owned by", value: scheme.owning_organisation.name, edit: true }, { name: "Support services provided by", value: scheme.arrangement_type }, - { name: "Organisation providing support", value: scheme.managing_organisation&.name }, { name: "Primary client group", value: scheme.primary_client_group }, { name: "Has another client group", value: scheme.has_other_client_group }, { name: "Secondary client group", value: scheme.secondary_client_group }, @@ -25,9 +24,10 @@ module SchemesHelper base_attributes.delete_if { |item| item[:name] == "Housing stock owned by" } end - if scheme.arrangement_type_same? - base_attributes.delete_if { |item| item[:name] == "Organisation providing support" } + if scheme.has_other_client_group == "Yes" + base_attributes.append end + base_attributes end diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 94d2b135b..ced65ac67 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -127,12 +127,6 @@ class Scheme < ApplicationRecord ] end - def check_support_services_provider_attributes - [ - { name: "Organisation providing support", value: managing_organisation&.name, id: "managing_organisation_id" }, - ] - end - def check_primary_client_attributes [ { name: "Primary client group", value: primary_client_group, id: "primary_client_group" }, @@ -201,7 +195,7 @@ class Scheme < ApplicationRecord end def validate_confirmed - required_attributes = attribute_names - %w[id created_at updated_at old_id old_visible_id confirmed end_date sensitive secondary_client_group total_units has_other_client_group deactivation_date deactivation_date_type] + required_attributes = attribute_names - %w[id created_at updated_at old_id old_visible_id confirmed end_date sensitive secondary_client_group total_units has_other_client_group deactivation_date deactivation_date_type managing_organisation_id] if confirmed == true required_attributes.any? do |attribute| diff --git a/app/services/imports/scheme_location_import_service.rb b/app/services/imports/scheme_location_import_service.rb index 4a4292883..5b77dfddd 100644 --- a/app/services/imports/scheme_location_import_service.rb +++ b/app/services/imports/scheme_location_import_service.rb @@ -38,6 +38,7 @@ module Imports end_date: attributes["end_date"], # These values were set by the scheme import (management groups) owning_organisation_id: source_scheme.owning_organisation_id, + # change this? managing_organisation_id: source_scheme.managing_organisation_id, service_name: source_scheme.service_name, arrangement_type: source_scheme.arrangement_type, diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb index 806b8838a..9dbb68bfd 100644 --- a/app/views/schemes/check_answers.html.erb +++ b/app/views/schemes/check_answers.html.erb @@ -12,11 +12,6 @@ <% next if current_user.data_coordinator? && attr[:name] == ("owned by") %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: @scheme.confirmed? ? scheme_edit_name_path(@scheme) : scheme_details_path(@scheme, check_answers: true) } %> <% end %> - <% if !@scheme.arrangement_type_same? %> - <% @scheme.check_support_services_provider_attributes.each do |attr| %> - <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_support_services_provider_path(@scheme, check_answers: true) } %> - <% end %> - <% end %> <% @scheme.check_primary_client_attributes.each do |attr| %> <%= render partial: "scheme_summary_list_row", locals: { scheme: @scheme, attribute: attr, change_link: scheme_primary_client_group_path(@scheme, check_answers: true) } %> <% end %> diff --git a/app/views/schemes/primary_client_group.html.erb b/app/views/schemes/primary_client_group.html.erb index f956884bb..610e916f4 100644 --- a/app/views/schemes/primary_client_group.html.erb +++ b/app/views/schemes/primary_client_group.html.erb @@ -2,8 +2,6 @@ <% if request.referer&.include?("new") || request.referer&.include?("details") %> <% back_button_path = scheme_details_path(@scheme) %> -<% elsif request.referer&.include?("provider") %> - <% back_button_path = scheme_support_services_provider_path(@scheme) %> <% elsif request.query_parameters["check_answers"] %> <% back_button_path = scheme_check_answers_path(@scheme) %> <% end %> diff --git a/app/views/schemes/support_services_provider.html.erb b/app/views/schemes/support_services_provider.html.erb deleted file mode 100644 index cf1891ef0..000000000 --- a/app/views/schemes/support_services_provider.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<% content_for :title, "Which organisation provides the support services used by this scheme?" %> - -<% content_for :before_content do %> - <%= govuk_back_link( - text: "Back", - href: request.query_parameters["check_answers"] ? "/schemes/#{@scheme.id}/check-answers" : "/schemes/#{@scheme.id}/details", - ) %> -<% end %> - -<%= form_for(@scheme, method: :patch) do |f| %> -