You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
4.8 KiB
88 lines
4.8 KiB
<% content_for :title, "Create a new supported housing scheme" %> |
|
|
|
<% content_for :before_content do %> |
|
<%= govuk_back_link(href: scheme_back_button_path(@scheme, "details")) %> |
|
<% end %> |
|
|
|
<%= form_for(@scheme, method: :patch) do |f| %> |
|
<div class="govuk-grid-row"> |
|
<div class="govuk-grid-column-two-thirds"> |
|
<%= f.govuk_error_summary %> |
|
|
|
<% if @scheme.id.present? %> |
|
<%= render partial: "organisations/headings", locals: { main: "Scheme details", sub: @scheme.service_name } %> |
|
<% else %> |
|
<%= render partial: "organisations/headings", locals: { main: "Create a new supported housing scheme", sub: nil } %> |
|
<% end %> |
|
<%= govuk_inset_text(text: "Only update a scheme if you’re fixing an error. If the scheme is changing, create a new scheme.") if @scheme.confirmed? %> |
|
|
|
<%= f.govuk_text_field :service_name, |
|
label: { text: "Scheme name", size: "m" }, |
|
hint: { text: "This is how you refer to this supported housing scheme within your organisation. For example, the name could relate to the address or location. You’ll be able to see the client group when selecting it." } %> |
|
|
|
<%= f.govuk_check_boxes_fieldset :sensitive, |
|
legend: nil do %> |
|
<%= f.govuk_check_box :sensitive, |
|
1, |
|
0, |
|
multiple: false, |
|
checked: @scheme.sensitive == "Yes", |
|
label: { text: "This scheme contains confidential information" } %> |
|
<% end %> |
|
|
|
<% scheme_types_selection = Scheme.scheme_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> |
|
|
|
<%= f.govuk_collection_radio_buttons :scheme_type, |
|
scheme_types_selection, |
|
:id, |
|
:name, |
|
legend: { text: "What is this type of scheme?", size: "m" } %> |
|
|
|
<% care_acts_options_hints = { "Yes – part registered as a care home": "A proportion of units are registered as being a care home." } %> |
|
|
|
<% care_acts_options_with_hints = Scheme.registered_under_care_acts.keys.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: care_acts_options_hints[key.to_sym]) } %> |
|
|
|
<%= f.govuk_collection_radio_buttons :registered_under_care_act, |
|
care_acts_options_with_hints, |
|
:id, |
|
:name, |
|
:description, |
|
legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> |
|
|
|
<% scheme_owning_organisation_options = owning_organisation_options(current_user) %> |
|
|
|
<% if scheme_owning_organisation_options.count == 1 %> |
|
<%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %> |
|
<% else %> |
|
<%= f.govuk_collection_select :owning_organisation_id, |
|
scheme_owning_organisation_options, |
|
:id, |
|
:name, |
|
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, |
|
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
|
<% end %> |
|
|
|
<% mantype_selection = Scheme.arrangement_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> |
|
|
|
<%= f.govuk_collection_radio_buttons :arrangement_type, |
|
mantype_selection, |
|
:id, |
|
lambda { |option| |
|
if Scheme::ARRANGEMENT_TYPE[option.id] == "D" && !current_user.support? |
|
"Your organisation" |
|
else |
|
option.name |
|
end |
|
}, |
|
legend: { text: "Who provides the support services used by this scheme?", size: "m" } %> |
|
|
|
<%= f.hidden_field :page, value: "details" %> |
|
<% if params[:referrer] == "check-answers" %> |
|
<%= f.hidden_field :check_answers, value: "true" %> |
|
<%= f.govuk_submit "Save changes" %> |
|
<% else %> |
|
<%= f.govuk_submit "Save and continue" %> |
|
<% end %> |
|
</div> |
|
</div> |
|
<% end %>
|
|
|