diff --git a/app/helpers/tab_nav_helper.rb b/app/helpers/tab_nav_helper.rb
index f316d5ab2..2c24c7b6e 100644
--- a/app/helpers/tab_nav_helper.rb
+++ b/app/helpers/tab_nav_helper.rb
@@ -6,6 +6,11 @@ module TabNavHelper
[govuk_link_to(link_text, user), "User #{user.email}"].join("\n")
end
+ def location_cell(location)
+ link_text = location.postcode
+ [govuk_link_to(link_text, "locations"), "Location #{location.scheme.service_name}"].join("\n")
+ end
+
def scheme_cell(scheme)
link_text = scheme.service_name
[govuk_link_to(link_text, scheme), "Scheme #{scheme.primary_client_group}"].join("\n")
diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb
index a35028d64..c44fd169d 100644
--- a/app/views/schemes/check_answers.html.erb
+++ b/app/views/schemes/check_answers.html.erb
@@ -2,64 +2,110 @@
<%= render partial: "organisations/headings", locals: { main: "Check your changes before creating this scheme", sub: @scheme.service_name } %>
-<%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %>
- <% component.tab(label: "Scheme") do %>
- <%= govuk_summary_list do |summary_list| %>
- <% @scheme.check_details_attributes.each do |attr| %>
- <% next if current_user.data_coordinator? && attr[:name] == ("Managed by") %>
- <%= summary_list.row do |row| %>
- <% row.key { attr[:name].to_s } %>
- <% row.value { details_html(attr) } %>
- <% row.action(
- text: "Change",
- href: scheme_details_path(scheme_id: @scheme.id, check_answers: true),
- ) %>
- <% end %>
- <% end %>
- <% @scheme.check_primary_client_attributes.each do |attr| %>
- <%= summary_list.row do |row| %>
- <% row.key { attr[:name].to_s } %>
- <% row.value { details_html(attr) } %>
- <% row.action(
- text: "Change",
- href: scheme_primary_client_group_path(scheme_id: @scheme.id, check_answers: true),
- ) %>
- <% end %>
- <% end %>
- <% @scheme.check_secondary_client_confirmation_attributes.each do |attr| %>
- <%= summary_list.row do |row| %>
- <% row.key { attr[:name].to_s } %>
- <% row.value { details_html(attr) } %>
- <% row.action(
- text: "Change",
- href: scheme_confirm_secondary_client_group_path(scheme_id: @scheme.id, check_answers: true),
- ) %>
- <% end %>
- <% end %>
- <% if @scheme.has_other_client_group == "Yes" %>
- <% @scheme.check_secondary_client_attributes.each do |attr| %>
- <%= summary_list.row do |row| %>
- <% row.key { attr[:name].to_s } %>
- <% row.value { details_html(attr) } %>
- <% row.action(
- text: "Change",
- href: scheme_secondary_client_group_path(scheme_id: @scheme.id, check_answers: true),
- ) %>
+<% location_caption = @scheme.locations.count.eql?(1) ? "1 location" : "#{@scheme.locations.count} locations" %>
+
+
+
+ <%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %>
+ <% component.tab(label: "Scheme") do %>
+ <%= govuk_summary_list do |summary_list| %>
+ <% @scheme.check_details_attributes.each do |attr| %>
+ <% next if current_user.data_coordinator? && attr[:name] == ("Managed by") %>
+ <%= summary_list.row do |row| %>
+ <% row.key { attr[:name].to_s } %>
+ <% row.value { details_html(attr) } %>
+ <% row.action(
+ text: "Change",
+ href: scheme_details_path(scheme_id: @scheme.id, check_answers: true),
+ ) %>
+ <% end %>
+ <% end %>
+ <% @scheme.check_primary_client_attributes.each do |attr| %>
+ <%= summary_list.row do |row| %>
+ <% row.key { attr[:name].to_s } %>
+ <% row.value { details_html(attr) } %>
+ <% row.action(
+ text: "Change",
+ href: scheme_primary_client_group_path(scheme_id: @scheme.id, check_answers: true),
+ ) %>
+ <% end %>
+ <% end %>
+ <% @scheme.check_secondary_client_confirmation_attributes.each do |attr| %>
+ <%= summary_list.row do |row| %>
+ <% row.key { attr[:name].to_s } %>
+ <% row.value { details_html(attr) } %>
+ <% row.action(
+ text: "Change",
+ href: scheme_confirm_secondary_client_group_path(scheme_id: @scheme.id, check_answers: true),
+ ) %>
+ <% end %>
+ <% end %>
+ <% if @scheme.has_other_client_group == "Yes" %>
+ <% @scheme.check_secondary_client_attributes.each do |attr| %>
+ <%= summary_list.row do |row| %>
+ <% row.key { attr[:name].to_s } %>
+ <% row.value { details_html(attr) } %>
+ <% row.action(
+ text: "Change",
+ href: scheme_secondary_client_group_path(scheme_id: @scheme.id, check_answers: true),
+ ) %>
+ <% end %>
+ <% end %>
+ <% end %>
+ <% @scheme.check_support_attributes.each do |attr| %>
+ <%= summary_list.row do |row| %>
+ <% row.key { attr[:name].to_s } %>
+ <% row.value { details_html(attr) } %>
+ <% row.action(
+ text: "Change",
+ href: scheme_support_path(scheme_id: @scheme.id, check_answers: true),
+ ) %>
+ <% end %>
<% end %>
<% end %>
<% end %>
- <% @scheme.check_support_attributes.each do |attr| %>
- <%= summary_list.row do |row| %>
- <% row.key { attr[:name].to_s } %>
- <% row.value { details_html(attr) } %>
- <% row.action(
- text: "Change",
- href: scheme_support_path(scheme_id: @scheme.id, check_answers: true),
- ) %>
+ <% component.tab(label: "Locations") do %>
+ <%= govuk_table do |table| %>
+ <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
+ <%= location_caption %>
+ <% end %>
+ <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
+ <%= render(SearchResultCaptionComponent.new(searched:, count: pagy.count, item_label:, total_count:, item: "schemes", path: request.path)) %>
+ <% end %>
+ <%= table.head do |head| %>
+ <%= head.row do |row| %>
+ <% row.cell(header: true, text: "Code", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Postcode", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Units", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Common unit type", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Actions", html_attributes: {
+ scope: "col",
+ }) %>
+ <% end %>
+ <% end %>
+ <% @scheme.locations.each do |location| %>
+ <%= table.body do |body| %>
+ <%= body.row do |row| %>
+ <% row.cell(text: location.id) %>
+ <% row.cell(text: simple_format(location_cell(location), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %>
+ <% row.cell(text: location.total_units) %>
+ <% row.cell(text: location.type_of_unit) %>
+ <% row.cell(text: "Delete") %>
+ <% end %>
+ <% end %>
+ <% end %>
<% end %>
<% end %>
<% end %>
- <% end %>
-<% end %>
+
+
<%= govuk_button_link_to "Create scheme", schemes_path(scheme_id: @scheme.id), html: { method: :get } %>
diff --git a/app/views/schemes/locations.html.erb b/app/views/schemes/locations.html.erb
index 0b29024c7..485b49031 100644
--- a/app/views/schemes/locations.html.erb
+++ b/app/views/schemes/locations.html.erb
@@ -1,44 +1,51 @@
<% title = @scheme.service_name %>
<% content_for :title, title %>
-
<% content_for :before_content do %>
<%= govuk_back_link(
- text: "Back",
- href: "/schemes/#{@scheme.id}",
- ) %>
+ text: "Back",
+ href: "/schemes/#{@scheme.id}",
+ ) %>
<% end %>
-
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %>
-
-<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, @scheme.locations.count.eql?(1) ? "1 location" : "#{@scheme.locations.count} locations")) %>
+<% 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)) %>
- <% @locations.each do |location| %>
-
-
-
-
- <% location.display_attributes.each do |attribute| %>
-
-
-
- <%= attribute[:name] %>
-
- -
- <%= attribute[:value] %>
- <% if attribute[:suffix] %>
- <%= attribute[:suffix] %>
- <% end %>
-
-
- <% end %>
-
-
-
+ <%= govuk_table do |table| %>
+ <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %>
+
<%= @scheme.locations.count %> <%= @scheme.locations.count.eql?(1) ? "location" : "locations" %>.
+ <% end %>
+ <%= table.head do |head| %>
+ <%= head.row do |row| %>
+ <% row.cell(header: true, text: "Code", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Postcode", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Units", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Common unit type", html_attributes: {
+ scope: "col",
+ }) %>
+ <% row.cell(header: true, text: "Actions", html_attributes: {
+ scope: "col",
+ }) %>
+ <% end %>
+ <% end %>
+ <% @locations.each do |location| %>
+ <%= table.body do |body| %>
+ <%= body.row do |row| %>
+ <% row.cell(text: location.id) %>
+ <% row.cell(text: location.postcode) %>
+ <% row.cell(text: location.total_units) %>
+ <% row.cell(text: simple_format("
#{location.type_of_unit}#{location.wheelchair_adaptation == "Yes" ? "\n
With wheelchair adaptations" : ""}")) %>
+ <% row.cell(text: "Delete") %>
+ <% end %>
+ <% end %>
+ <% end %>
<% end %>