Browse Source

added support_services_provider

juris_katrina_test
JG 3 years ago
parent
commit
1c0f00df4c
  1. 9
      app/models/scheme.rb
  2. 25
      app/views/schemes/new.html.erb
  3. 5
      db/migrate/20220711134558_add_support_services_provider_to_schemes.rb
  4. 1
      db/schema.rb

9
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

25
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" %>
</div>
</div>

5
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

1
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

Loading…
Cancel
Save