|
|
|
<% title = @location.name %>
|
|
|
|
<% content_for :title, title %>
|
|
|
|
|
|
|
|
<% content_for :before_content do %>
|
|
|
|
<%= govuk_back_link(
|
|
|
|
href: case params[:route]
|
|
|
|
when "locations"
|
|
|
|
scheme_locations_path(@scheme)
|
|
|
|
else
|
|
|
|
:back
|
|
|
|
end,
|
|
|
|
) %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= render partial: "organisations/headings", locals: { main: "Check your answers", sub: "Add a location to #{@scheme.service_name}" } %>
|
|
|
|
|
|
|
|
<div class="govuk-grid-row">
|
|
|
|
<div class="govuk-grid-column-two-thirds-from-desktop">
|
|
|
|
<%= govuk_summary_list do |summary_list| %>
|
|
|
|
<% display_location_attributes_for_check_answers(@location).each do |attr| %>
|
|
|
|
<% unless attr[:attribute].eql?("local_authority") && @location.is_la_inferred %>
|
|
|
|
<%= summary_list.with_row do |row| %>
|
|
|
|
<% row.with_key { attr[:name] } %>
|
|
|
|
<% if attr[:attribute].eql?("postcode") && @location.is_la_inferred %>
|
|
|
|
<% row.with_value do %>
|
|
|
|
<%= details_html(attr, @location) %>
|
|
|
|
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= formatted_local_authority_timeline(@location) %></span>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<% row.with_value { details_html(attr, @location) if user_can_edit_scheme?(current_user, @scheme) } %>
|
|
|
|
<% end %>
|
|
|
|
<% if LocationPolicy.new(current_user, @location).update? && attr[:value] %>
|
|
|
|
<% row.with_action(text: location_action_text(attr, @location), href: location_edit_path(@location, attr[:attribute])) %>
|
|
|
|
<% else %>
|
|
|
|
<% row.with_action %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if LocationPolicy.new(current_user, @location).create? %>
|
|
|
|
<div class="govuk-button-group">
|
|
|
|
<%= govuk_button_to "Save and return to locations", scheme_location_confirm_path(@scheme, @location, route: params[:route]), method: :patch %>
|
|
|
|
<% if LocationPolicy.new(current_user, @location).delete? %>
|
|
|
|
<%= delete_location_link(@location) %>
|
|
|
|
<% end %>
|
|
|
|
<%= govuk_button_link_to "Cancel", scheme_locations_path(@scheme), secondary: true %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|