From c4a28656ca2ab85c6021d1e2bf88758dd64b5fa2 Mon Sep 17 00:00:00 2001 From: JG Date: Fri, 17 Jun 2022 14:35:50 +0100 Subject: [PATCH] SPIKE WIP --- app/views/schemes/check_answers.html.erb | 14 +++++ app/views/schemes/details.html.erb | 72 ++++++++++++++++++++++++ app/views/schemes/support.html.erb | 39 +++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 app/views/schemes/check_answers.html.erb create mode 100644 app/views/schemes/details.html.erb create mode 100644 app/views/schemes/support.html.erb diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb new file mode 100644 index 000000000..a8db834bf --- /dev/null +++ b/app/views/schemes/check_answers.html.erb @@ -0,0 +1,14 @@ +<% content_for :title, "Check your answers before creating this scheme" %> + +<% content_for :before_content do %> + <%= govuk_back_link( + text: "Back", + href: :back, + ) %> +<% end %> + +
+ +
diff --git a/app/views/schemes/details.html.erb b/app/views/schemes/details.html.erb new file mode 100644 index 000000000..774b14906 --- /dev/null +++ b/app/views/schemes/details.html.erb @@ -0,0 +1,72 @@ +<% content_for :title, "Create a new supported housing scheme" %> + +<% content_for :before_content do %> + <%= govuk_back_link( + text: "Back", + href: :back, + ) %> +<% end %> + +<%= form_for(@scheme, method: :patch, url: scheme_details_path(scheme_id: @scheme.id)) do |f| %> +
+
+ <%= f.govuk_error_summary %> + +

+ <%= content_for(:title) %> +

+ + <%= 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, + 0, + 1, + 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 %> + + <% 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_selection = Scheme.registered_under_care_acts.keys.reverse.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> + + <%= f.govuk_collection_radio_buttons :registered_under_care_act, + care_acts_selection, + :id, + :name, + legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> + + <%= f.govuk_number_field :total_units, + width: 2, + label: { text: "Total number of units", size: "m" }, + hint: { text: "For example, a unit can be a bedroom in a shared house or flat, or a house with 4 bedrooms. Do not include bedrooms used for wardens, managers, volunteers or sleep-in staff." } %> + + <%= f.govuk_submit "Save and continue" %> +
+
+<% end %> diff --git a/app/views/schemes/support.html.erb b/app/views/schemes/support.html.erb new file mode 100644 index 000000000..5f512cea4 --- /dev/null +++ b/app/views/schemes/support.html.erb @@ -0,0 +1,39 @@ +<% content_for :before_content do %> + <%= govuk_back_link( + text: "Back", + href: :back, + ) %> +<% end %> + +<%= render partial: "organisations/headings", locals: { main: "What support does this scheme provide?", sub: @scheme.service_name } %> + +<%= form_for(@scheme, method: :patch, url: scheme_support_path(scheme_id: @scheme.id)) do |f| %> +
+
+ <%= f.govuk_error_summary %> + +

+ <%= content_for(:title) %> +

+ + + + + <% support_type_selection = Scheme.support_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> + <%= f.govuk_collection_radio_buttons :support_type, + support_type_selection, + :id, + :name, + legend: { text: "Level of support given", size: "m" } %> + + <% intended_stay_selection = Scheme.intended_stays.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> + <%= f.govuk_collection_radio_buttons :intended_stay, + intended_stay_selection, + :id, + :name, + legend: { text: "Intended length of stay", size: "m" } %> + + <%= f.govuk_submit "Save and continue" %> +
+
+<% end %>