4 changed files with 69 additions and 2 deletions
@ -0,0 +1,59 @@
|
||||
<% content_for :title, "Create a new supported housing scheme" %> |
||||
|
||||
<% content_for :before_content do %> |
||||
<%= govuk_back_link( |
||||
text: "Back", |
||||
href: :back, |
||||
) %> |
||||
<% end %> |
||||
|
||||
<%= form_for(@resource, as: :scheme, html: { method: :post }) do |f| %> |
||||
<div class="govuk-grid-row"> |
||||
<div class="govuk-grid-column-two-thirds"> |
||||
<%= f.govuk_error_summary %> |
||||
|
||||
<h1 class="govuk-heading-l"> |
||||
<%= content_for(:title) %> |
||||
</h1> |
||||
|
||||
<%= f.govuk_text_field :service_name, |
||||
label: { text: "Scheme name", size: "m" }, |
||||
hint: { text: "This is how you’ll 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_box :sensitive, |
||||
1, |
||||
0, |
||||
multiple: false, |
||||
label: { text: "This scheme contains confidential information" } %> |
||||
|
||||
<% if current_user.support? %> |
||||
<% null_option = [OpenStruct.new(id: "", name: "Select an option")] %> |
||||
<% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> |
||||
<% answer_options = null_option + organisations %> |
||||
<% if @organisation_id %> |
||||
<% organisation = Organisation.find(@organisation_id) %> |
||||
<% answer_options = [OpenStruct.new(id: organisation.id, name: organisation.name)] %> |
||||
<% end %> |
||||
|
||||
<%= f.govuk_collection_select :organisation_id, |
||||
answer_options, |
||||
:id, |
||||
:name, |
||||
label: { text: "Which organisation manages this scheme", size: "m" }, |
||||
hint: { text: "Enter organisation name" }, |
||||
options: { disabled: [""], selected: selected_option(answer_options) }, |
||||
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
||||
<% end %> |
||||
|
||||
<% roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> |
||||
|
||||
<%= f.govuk_collection_radio_buttons :scheme_type, |
||||
roles, |
||||
:id, |
||||
:name, |
||||
legend: { text: "Role", size: "m" } %> |
||||
|
||||
<%= f.govuk_submit "Save and continue" %> |
||||
</div> |
||||
</div> |
||||
<% end %> |
Loading…
Reference in new issue