<% content_for :title, @page.header.presence || @page.questions.first.header.html_safe %> <% if accessed_from_duplicate_logs?(request.query_parameters["referrer"]) %> <% content_for :before_content do %> <%= govuk_back_link(href: duplicate_log_set_path(@log, request.query_parameters["original_log_id"])) %> <% end %> <% else %> <% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { "Home" => root_path, breadcrumb_logs_title(@log, current_user) => breadcrumb_logs_link(@log, current_user), "Log #{@log.id}" => url_for(@log), @subsection.label => relevant_check_answers_path(@log, @subsection), }) %> <% end %>
<%= form_with model: @log, url: request.original_url, method: "post", local: true do |f| %>
<% all_questions_with_errors = all_questions_affected_by_errors(@log) %> <% remove_other_page_errors(@log, @page) %> <%= f.govuk_error_summary %> <% if @page.header.present? || @page.header_partial.present? %>

<% if !@page.hide_subsection_label %> <%= @subsection.label %> <% end %> <% if @page.header_partial.present? %> <%= render partial: "form/headers/#{@page.header_partial}", locals: { log: @log } %> <% else %> <%= @page.header %> <% end %>

<% end %> <% if @page.description.present? %>

<%= @page.description.html_safe %>

<% end %> <% @page.non_conditional_questions.map do |question| %>
> <% if question.read_only? %> <%= govuk_section_break(visible: true, size: "m") %> <% end %> <% if question.type == "interruption_screen" %> <%= render partial: "form/#{question.type}_question", locals: { question:, caption_text: @subsection.label, page_header: @page.header, lettings_log: @log, title_text: @page.title_text, informative_text: @page.informative_text, form: @form, f:, conditional: false, } %> <% else %> <%= render partial: "form/#{question.type}_question", locals: { question:, caption_text: @page.header_partial.present? ? nil : @subsection.label, page_header: @page.header, lettings_log: @log, f:, conditional: false, } %> <% end %>
<% end %> <%= f.hidden_field :page, value: @page.id %> <%= f.hidden_field :interruption_page_id, value: @interruption_page_id %> <%= f.hidden_field :interruption_page_referrer_type, value: @interruption_page_referrer_type %> <%= f.hidden_field :related_question_ids, value: @related_question_ids %> <%= f.hidden_field :original_page_id, value: @original_page_id %> <% if @check_errors %> <%= f.hidden_field :check_errors, value: @check_errors %> <% end %> <% if all_questions_with_errors.count > 1 %>
<%= f.submit "See all related answers", name: "check_errors", class: "govuk-body govuk-link submit-button-link" %>
<% end %>
<% if !@page.interruption_screen? %> <%= f.govuk_submit submit_button_text(@page, request.query_parameters["referrer"]) %> <%= govuk_link_to cancel_button_text(@page, request.query_parameters["referrer"]), cancel_button_link(@page, request.query_parameters["referrer"], request.query_parameters["original_log_id"], @log) %> <% end %>
<% end %>