|
|
@ -10,120 +10,60 @@ |
|
|
|
|
|
|
|
|
|
|
|
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> |
|
|
|
<%= render partial: "organisations/headings", locals: { main: @scheme.service_name, sub: nil } %> |
|
|
|
|
|
|
|
|
|
|
|
<% if FeatureToggle.location_toggle_enabled? %> |
|
|
|
<div class="govuk-grid-row"> |
|
|
|
<div class="govuk-grid-row"> |
|
|
|
<div class="govuk-grid-column-two-thirds-from-desktop"> |
|
|
|
<div class="govuk-grid-column-two-thirds-from-desktop"> |
|
|
|
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %> |
|
|
|
<% end %> |
|
|
|
|
|
|
|
<%= render SubNavigationComponent.new(items: scheme_items(request.path, @scheme.id, "Locations")) %> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h2 class="govuk-visually-hidden">Locations</h2> |
|
|
|
<h2 class="govuk-visually-hidden">Locations</h2> |
|
|
|
|
|
|
|
|
|
|
|
<%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %> |
|
|
|
<%= render SearchComponent.new(current_user:, search_label: "Search by location name or postcode", value: @searched) %> |
|
|
|
|
|
|
|
|
|
|
|
<%= govuk_section_break(visible: true, size: "m") %> |
|
|
|
<%= govuk_section_break(visible: true, size: "m") %> |
|
|
|
<% if FeatureToggle.location_toggle_enabled? %> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<% end %> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<% if FeatureToggle.location_toggle_enabled? %> |
|
|
|
|
|
|
|
<div class="govuk-grid-row"> |
|
|
|
|
|
|
|
<div class="govuk-grid-column-two-thirds-from-desktop"> |
|
|
|
|
|
|
|
<%= govuk_table do |table| %> |
|
|
|
|
|
|
|
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> |
|
|
|
|
|
|
|
<%= render(SearchResultCaptionComponent.new(searched: @searched, count: @pagy.count, item_label:, total_count: @total_count, item: "locations", path: request.path)) %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
<%= table.head do |head| %> |
|
|
|
|
|
|
|
<%= head.row do |row| %> |
|
|
|
|
|
|
|
<% row.cell(header: true, text: "Postcode", html_attributes: { |
|
|
|
|
|
|
|
scope: "col", |
|
|
|
|
|
|
|
}) %> |
|
|
|
|
|
|
|
<% row.cell(header: true, text: "Name", html_attributes: { |
|
|
|
|
|
|
|
scope: "col", |
|
|
|
|
|
|
|
}) %> |
|
|
|
|
|
|
|
<% row.cell(header: true, text: "Location code", html_attributes: { |
|
|
|
|
|
|
|
scope: "col", |
|
|
|
|
|
|
|
}) %> |
|
|
|
|
|
|
|
<% row.cell(header: true, text: "Status", html_attributes: { |
|
|
|
|
|
|
|
scope: "col", |
|
|
|
|
|
|
|
}) %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% @locations.each do |location| %> |
|
|
|
|
|
|
|
<%= table.body do |body| %> |
|
|
|
|
|
|
|
<%= body.row do |row| %> |
|
|
|
|
|
|
|
<% row.cell(text: simple_format(location_cell_postcode(location, if location.confirmed |
|
|
|
|
|
|
|
scheme_location_path(@scheme, location) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location) |
|
|
|
|
|
|
|
end), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> |
|
|
|
|
|
|
|
<% row.cell(text: location.name) %> |
|
|
|
|
|
|
|
<% row.cell(text: location.id) %> |
|
|
|
|
|
|
|
<% row.cell(text: status_tag(location.status)) %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% if LocationPolicy.new(current_user, @scheme.locations.new).create? %> |
|
|
|
<div class="govuk-grid-row"> |
|
|
|
<%= govuk_button_to "Add a location", scheme_locations_path(@scheme), method: "post", secondary: true %> |
|
|
|
<div class="govuk-grid-column-two-thirds-from-desktop"> |
|
|
|
|
|
|
|
<%= govuk_table do |table| %> |
|
|
|
|
|
|
|
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> |
|
|
|
|
|
|
|
<%= render(SearchResultCaptionComponent.new(searched: @searched, count: @pagy.count, item_label:, total_count: @total_count, item: "locations", path: request.path)) %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
</div> |
|
|
|
<%= table.head do |head| %> |
|
|
|
</div> |
|
|
|
<%= head.row do |row| %> |
|
|
|
<% else %> |
|
|
|
<% row.cell(header: true, text: "Postcode", html_attributes: { |
|
|
|
<%= govuk_table do |table| %> |
|
|
|
scope: "col", |
|
|
|
<%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> |
|
|
|
}) %> |
|
|
|
<%= render(SearchResultCaptionComponent.new(searched: @searched, count: @pagy.count, item_label:, total_count: @total_count, item: "locations", path: request.path)) %> |
|
|
|
<% row.cell(header: true, text: "Name", html_attributes: { |
|
|
|
<% end %> |
|
|
|
scope: "col", |
|
|
|
<%= table.head do |head| %> |
|
|
|
}) %> |
|
|
|
<%= head.row do |row| %> |
|
|
|
<% row.cell(header: true, text: "Location code", html_attributes: { |
|
|
|
<% row.cell(header: true, text: "Code", html_attributes: { |
|
|
|
scope: "col", |
|
|
|
scope: "col", |
|
|
|
}) %> |
|
|
|
}) %> |
|
|
|
<% row.cell(header: true, text: "Status", html_attributes: { |
|
|
|
<% row.cell(header: true, text: "Postcode", html_attributes: { |
|
|
|
scope: "col", |
|
|
|
scope: "col", |
|
|
|
}) %> |
|
|
|
}) %> |
|
|
|
<% end %> |
|
|
|
<% 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: "Mobility type", html_attributes: { |
|
|
|
|
|
|
|
scope: "col", |
|
|
|
|
|
|
|
}) %> |
|
|
|
|
|
|
|
<% row.cell(header: true, text: "Local authority", html_attributes: { |
|
|
|
|
|
|
|
scope: "col", |
|
|
|
|
|
|
|
}) %> |
|
|
|
|
|
|
|
<% row.cell(header: true, text: "Available from", html_attributes: { |
|
|
|
|
|
|
|
scope: "col", |
|
|
|
|
|
|
|
}) %> |
|
|
|
|
|
|
|
<% 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: simple_format(location_cell_postcode(location, if location.confirmed |
|
|
|
<% row.cell(text: location.id) %> |
|
|
|
scheme_location_path(@scheme, location) |
|
|
|
<% row.cell(text: simple_format(location_cell_postcode(location, if location.confirmed |
|
|
|
else |
|
|
|
scheme_location_path(@scheme, location) |
|
|
|
location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location) |
|
|
|
else |
|
|
|
end), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> |
|
|
|
location.postcode.present? ? scheme_location_check_answers_path(@scheme, location, route: "locations") : scheme_location_postcode_path(@scheme, location) |
|
|
|
<% row.cell(text: location.name) %> |
|
|
|
end), { class: "govuk-!-font-weight-bold" }, wrapper_tag: "div")) %> |
|
|
|
<% row.cell(text: location.id) %> |
|
|
|
<% row.cell(text: location.units) %> |
|
|
|
<% row.cell(text: status_tag(location.status)) %> |
|
|
|
<% row.cell do %> |
|
|
|
|
|
|
|
<span><%= simple_format(location.type_of_unit) %></span> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% row.cell(text: location.mobility_type) %> |
|
|
|
|
|
|
|
<% row.cell(text: location.location_admin_district) %> |
|
|
|
|
|
|
|
<% row.cell(text: location.startdate&.to_formatted_s(:govuk_date)) %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
<% end %> |
|
|
|
|
|
|
|
<% if user_can_edit_scheme?(current_user, @scheme) %> |
|
|
|
|
|
|
|
<%= govuk_button_to "Add a location", scheme_locations_path(@scheme), method: "post", secondary: true %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<% end %> |
|
|
|
<% if LocationPolicy.new(current_user, @scheme.locations.new).create? %> |
|
|
|
|
|
|
|
<%= govuk_button_to "Add a location", scheme_locations_path(@scheme), method: "post", secondary: true %> |
|
|
|
|
|
|
|
<% end %> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "locations" } %> |
|
|
|
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "locations" } %> |
|
|
|