Paul Robert Lloyd
2 years ago
committed by
GitHub
16 changed files with 169 additions and 190 deletions
@ -1,49 +1,47 @@ |
|||||||
<% title = @scheme.service_name %> |
<% title = @scheme.service_name %> |
||||||
<% content_for :title, title %> |
<% content_for :title, title %> |
||||||
|
|
||||||
<% content_for :before_content do %> |
<% content_for :before_content do %> |
||||||
<%= govuk_back_link( |
<%= govuk_back_link( |
||||||
text: "Back", |
text: "Back", |
||||||
href: "/schemes/#{@scheme.id}", |
href: "/schemes/#{@scheme.id}", |
||||||
) %> |
) %> |
||||||
<% end %> |
<% end %> |
||||||
|
|
||||||
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> |
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> |
||||||
<% location_caption = @scheme.locations.count.eql?(1) ? "1 location" : "#{@scheme.locations.count} locations" %> |
|
||||||
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, location_caption)) %> |
|
||||||
|
|
||||||
<div class="govuk-grid-row"> |
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %> |
||||||
<div class="govuk-grid-column-three-quarters"> |
|
||||||
<%= govuk_table do |table| %> |
<%= govuk_table do |table| %> |
||||||
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> |
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> |
||||||
<strong><%= @scheme.locations.count %></strong> <%= @scheme.locations.count.eql?(1) ? "location" : "locations" %>. |
<strong><%= @scheme.locations.count %></strong> <%= @scheme.locations.count.eql?(1) ? "location" : "locations" %> |
||||||
<% end %> |
<% end %> |
||||||
<%= table.head do |head| %> |
<%= table.head do |head| %> |
||||||
<%= head.row do |row| %> |
<%= head.row do |row| %> |
||||||
<% row.cell(header: true, text: "Code", html_attributes: { |
<% row.cell(header: true, text: "Code", html_attributes: { |
||||||
scope: "col", |
scope: "col", |
||||||
}) %> |
}) %> |
||||||
<% row.cell(header: true, text: "Postcode", html_attributes: { |
<% row.cell(header: true, text: "Postcode", html_attributes: { |
||||||
scope: "col", |
scope: "col", |
||||||
}) %> |
}) %> |
||||||
<% row.cell(header: true, text: "Units", html_attributes: { |
<% row.cell(header: true, text: "Units", html_attributes: { |
||||||
scope: "col", |
scope: "col", |
||||||
}) %> |
}) %> |
||||||
<% row.cell(header: true, text: "Common unit type", html_attributes: { |
<% row.cell(header: true, text: "Common unit type", html_attributes: { |
||||||
scope: "col", |
scope: "col", |
||||||
}) %> |
}) %> |
||||||
<% end %> |
<% end %> |
||||||
<% end %> |
<% end %> |
||||||
<% @locations.each do |location| %> |
<% @locations.each do |location| %> |
||||||
<%= table.body do |body| %> |
<%= table.body do |body| %> |
||||||
<%= body.row do |row| %> |
<%= body.row do |row| %> |
||||||
<% row.cell(text: location.id) %> |
<% row.cell(text: location.id) %> |
||||||
<% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit-name"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> |
<% row.cell(text: simple_format(location_cell(location, "/schemes/#{@scheme.id}/locations/#{location.id}/edit-name"), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> |
||||||
<% row.cell(text: location.total_units) %> |
<% row.cell(text: location.total_units) %> |
||||||
<% row.cell(text: simple_format("<span>#{location.type_of_unit}</span>#{location.wheelchair_adaptation == 'Yes' ? "\n<span class=\"govuk-!-font-weight-regular app-!-colour-muted\">With wheelchair adaptations</span>" : ''}")) %> |
<% row.cell(text: simple_format("<span>#{location.type_of_unit}</span>#{location.wheelchair_adaptation == 'Yes' ? "\n<span class=\"govuk-!-font-weight-regular app-!-colour-muted\">With wheelchair adaptations</span>" : ''}")) %> |
||||||
<% end %> |
|
||||||
<% end %> |
|
||||||
<% end %> |
<% end %> |
||||||
<% end %> |
<% end %> |
||||||
</div> |
<% end %> |
||||||
</div> |
<% end %> |
||||||
|
|
||||||
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "locations" } %> |
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "locations" } %> |
||||||
|
@ -1,79 +1,79 @@ |
|||||||
<% content_for :title, "Create a new supported housing scheme" %> |
<% content_for :title, "Create a new supported housing scheme" %> |
||||||
|
|
||||||
<% content_for :before_content do %> |
<% content_for :before_content do %> |
||||||
<%= govuk_back_link( |
<%= govuk_back_link( |
||||||
text: "Back", |
text: "Back", |
||||||
href: :back, |
href: :back, |
||||||
) %> |
) %> |
||||||
<% end %> |
<% end %> |
||||||
|
|
||||||
<%= render partial: "organisations/headings", locals: { main: "Create a new supported housing scheme", sub: nil } %> |
<%= render partial: "organisations/headings", locals: { main: "Create a new supported housing scheme", sub: nil } %> |
||||||
|
|
||||||
<%= form_for(@scheme, method: :patch) do |f| %> |
<%= form_for(@scheme, method: :patch) do |f| %> |
||||||
<div class="govuk-grid-row"> |
<div class="govuk-grid-row"> |
||||||
<div class="govuk-grid-column-two-thirds"> |
<div class="govuk-grid-column-two-thirds"> |
||||||
<%= f.govuk_error_summary %> |
<%= f.govuk_error_summary %> |
||||||
|
|
||||||
<%= f.govuk_text_field :service_name, |
<%= f.govuk_text_field :service_name, |
||||||
label: { text: "Scheme name", size: "m" }, |
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." } %> |
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, |
<%= f.govuk_check_boxes_fieldset :sensitive, |
||||||
legend: nil do %> |
legend: nil do %> |
||||||
<%= f.govuk_check_box :sensitive, |
<%= f.govuk_check_box :sensitive, |
||||||
1, |
1, |
||||||
0, |
0, |
||||||
multiple: false, |
multiple: false, |
||||||
checked: @scheme.sensitive == "Yes", |
checked: @scheme.sensitive == "Yes", |
||||||
label: { text: "This scheme contains confidential information" } %> |
label: { text: "This scheme contains confidential information" } %> |
||||||
<% end %> |
<% end %> |
||||||
|
|
||||||
<% null_option = [OpenStruct.new(id: "", name: "Select an option")] %> |
<% null_option = [OpenStruct.new(id: "", name: "Select an option")] %> |
||||||
<% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> |
<% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> |
||||||
<% managing_org_answer_options = null_option + organisations %> |
<% managing_org_answer_options = null_option + organisations %> |
||||||
|
|
||||||
<%= f.govuk_collection_select :managing_organisation_id, |
<%= f.govuk_collection_select :managing_organisation_id, |
||||||
managing_org_answer_options, |
managing_org_answer_options, |
||||||
:id, |
:id, |
||||||
:name, |
:name, |
||||||
label: { text: "Which organisation manages this scheme?", size: "m" }, |
label: { text: "Which organisation manages this scheme?", size: "m" }, |
||||||
options: { required: true }, |
options: { required: true }, |
||||||
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
||||||
|
|
||||||
<% if current_user.support? %> |
<% if current_user.support? %> |
||||||
<%= f.govuk_collection_select :owning_organisation_id, |
<%= f.govuk_collection_select :owning_organisation_id, |
||||||
organisations, |
organisations, |
||||||
:id, |
:id, |
||||||
:name, |
:name, |
||||||
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, |
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, |
||||||
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
||||||
<% end %> |
<% end %> |
||||||
|
|
||||||
<% if current_user.data_coordinator? %> |
<% if current_user.data_coordinator? %> |
||||||
<%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %> |
<%= f.hidden_field :owning_organisation_id, value: current_user.organisation.id %> |
||||||
<% end %> |
<% end %> |
||||||
|
|
||||||
<% scheme_types_selection = Scheme.scheme_types.keys.excluding("Missing").map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> |
<% 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, |
<%= f.govuk_collection_radio_buttons :scheme_type, |
||||||
scheme_types_selection, |
scheme_types_selection, |
||||||
:id, |
:id, |
||||||
:name, |
:name, |
||||||
legend: { text: "What is this type of scheme?", size: "m" } %> |
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) } %> |
<% 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, |
<%= f.govuk_collection_radio_buttons :registered_under_care_act, |
||||||
care_acts_selection, |
care_acts_selection, |
||||||
:id, |
:id, |
||||||
:name, |
:name, |
||||||
legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> |
legend: { text: "Is this scheme registered under the Care Standards Act 2000?", size: "m" } %> |
||||||
|
|
||||||
<%= f.hidden_field :page, value: "details" %> |
<%= f.hidden_field :page, value: "details" %> |
||||||
<% if request.query_parameters["check_answers"] %> |
<% if request.query_parameters["check_answers"] %> |
||||||
<%= f.hidden_field :check_answers, value: "true" %> |
<%= f.hidden_field :check_answers, value: "true" %> |
||||||
<% end %> |
<% end %> |
||||||
<%= f.govuk_submit "Save and continue" %> |
<%= f.govuk_submit "Save and continue" %> |
||||||
</div> |
</div> |
||||||
</div> |
</div> |
||||||
<% end %> |
<% end %> |
||||||
|
@ -1,47 +1,46 @@ |
|||||||
<% content_for :title, "Scheme details" %> |
<% content_for :title, "Scheme details" %> |
||||||
|
|
||||||
<% content_for :before_content do %> |
<% content_for :before_content do %> |
||||||
<%= govuk_back_link( |
<%= govuk_back_link( |
||||||
text: "Back", |
text: "Back", |
||||||
href: :back, |
href: :back, |
||||||
) %> |
) %> |
||||||
<% end %> |
<% end %> |
||||||
|
|
||||||
<%= render partial: "organisations/headings", locals: { main: "Scheme details", sub: @scheme.service_name } %> |
<%= render partial: "organisations/headings", locals: { main: "Scheme details", sub: @scheme.service_name } %> |
||||||
|
|
||||||
<%= form_for(@scheme, method: :patch) do |f| %> |
<%= form_for(@scheme, method: :patch) do |f| %> |
||||||
<div class="govuk-grid-row"> |
<div class="govuk-grid-row"> |
||||||
<div class="govuk-grid-column-two-thirds"> |
<div class="govuk-grid-column-two-thirds"> |
||||||
<%= f.govuk_error_summary %> |
<%= f.govuk_error_summary %> |
||||||
|
|
||||||
<%= f.govuk_text_field :service_name, |
<%= f.govuk_text_field :service_name, |
||||||
label: { text: "Scheme name", size: "m" }, |
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." } %> |
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, |
<%= f.govuk_check_boxes_fieldset :sensitive, |
||||||
legend: nil do %> |
legend: nil do %> |
||||||
<%= f.govuk_check_box :sensitive, |
<%= f.govuk_check_box :sensitive, |
||||||
1, |
1, |
||||||
0, |
0, |
||||||
multiple: false, |
multiple: false, |
||||||
checked: @scheme.sensitive == "Yes", |
checked: @scheme.sensitive == "Yes", |
||||||
label: { text: "This scheme contains confidential information" } %> |
label: { text: "This scheme contains confidential information" } %> |
||||||
<% end %> |
<% end %> |
||||||
|
|
||||||
<% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> |
<% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> |
||||||
|
<% if current_user.support? %> |
||||||
<% if current_user.support? %> |
<%= f.govuk_collection_select :owning_organisation_id, |
||||||
<%= f.govuk_collection_select :owning_organisation_id, |
organisations, |
||||||
organisations, |
:id, |
||||||
:id, |
:name, |
||||||
:name, |
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, |
||||||
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, |
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
||||||
"data-controller": %w[accessible-autocomplete conditional-filter] %> |
<% end %> |
||||||
<% end %> |
|
||||||
|
<%= f.hidden_field :page, value: "edit-name" %> |
||||||
<%= f.hidden_field :page, value: "edit-name" %> |
|
||||||
|
<%= f.govuk_submit "Save changes" %> |
||||||
<%= f.govuk_submit "Save changes" %> |
</div> |
||||||
</div> |
</div> |
||||||
</div> |
<% end %> |
||||||
<% end %> |
|
||||||
|
Loading…
Reference in new issue