% content_for :title, "Scheme details" %>
<% content_for :before_content do %>
<%= govuk_back_link(href: :back) %>
<% end %>
<%= form_for(@scheme, method: :patch) do |f| %>
<%= f.govuk_error_summary %>
<%= render partial: "organisations/headings", locals: { main: "Scheme details", sub: @scheme.service_name } %>
<%= 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 %>
<% if current_user.data_coordinator? && current_user.organisation.stock_owners.count.zero? && !current_user.organisation.has_recent_absorbed_organisations? %>
<%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %>
<% else %>
<%= f.govuk_collection_select :owning_organisation_id,
owning_organisation_options(current_user),
:id,
:name,
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" },
"data-controller": %w[accessible-autocomplete conditional-filter] %>
<% end %>
<%= f.hidden_field :page, value: "edit-name" %>
<% if request.query_parameters["check_answers"] %>
<%= f.hidden_field :check_answers, value: "true" %>
<% end %>
<%= f.govuk_submit "Save changes" %>
<% end %>