diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 67b73720f..20df33b67 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -91,6 +91,15 @@ class Scheme < ApplicationRecord enum intended_stay: INTENDED_STAY, _suffix: true enum has_other_client_group: HAS_OTHER_CLIENT_GROUP, _suffix: true + SUPPORT_SERVICES_PROVIDER = { + "The same organisation that owns the housing stock": 0, + "Another registered housing provider": 1, + "A registered charity or voluntary organisation": 2, + "Another organisation": 3, + }.freeze + + enum support_services_provider: SUPPORT_SERVICES_PROVIDER + def id_to_display "S#{id}" end diff --git a/app/views/schemes/new.html.erb b/app/views/schemes/new.html.erb index 297af9cef..5fe4e883f 100644 --- a/app/views/schemes/new.html.erb +++ b/app/views/schemes/new.html.erb @@ -39,14 +39,6 @@ :name, label: { text: "Which organisation manages this scheme?", size: "m" }, "data-controller": %w[accessible-autocomplete conditional-filter] %> - <% if current_user.support? %> - <%= f.govuk_collection_select :owning_organisation_id, - answer_options, - :id, - :name, - label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, - "data-controller": %w[accessible-autocomplete conditional-filter] %> - <% end %> <% if current_user.data_coordinator? %> <%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %> @@ -66,6 +58,23 @@ :name, legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> + <% if current_user.support? %> + <%= f.govuk_collection_select :owning_organisation_id, + answer_options, + :id, + :name, + label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, + "data-controller": %w[accessible-autocomplete conditional-filter] %> + <% end %> + + <% support_services_provider_selection = Scheme.support_services_providers.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> + + <%= f.govuk_collection_radio_buttons :support_services_provider, + support_services_provider_selection, + :id, + :name, + legend: { text: "Who provides the support services used by this scheme?", size: "m" } %> + <%= f.govuk_submit "Save and continue" %> diff --git a/db/migrate/20220711134558_add_support_services_provider_to_schemes.rb b/db/migrate/20220711134558_add_support_services_provider_to_schemes.rb new file mode 100644 index 000000000..e2c7de937 --- /dev/null +++ b/db/migrate/20220711134558_add_support_services_provider_to_schemes.rb @@ -0,0 +1,5 @@ +class AddSupportServicesProviderToSchemes < ActiveRecord::Migration[7.0] + def change + add_column :schemes, :support_services_provider, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 60780a3eb..2699c71d7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -321,6 +321,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_07_13_095713) do t.string "old_id" t.integer "old_visible_id" t.integer "total_units" + t.integer "support_services_provider" t.index ["managing_organisation_id"], name: "index_schemes_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_schemes_on_owning_organisation_id" end