<% class_name = @log.class.model_name.human.downcase %>
<% content_for :title, "Review #{class_name}" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
  "Logs" => url_for(@log.class),
  "Log #{@log.id}" => url_for(@log),
  "Review #{class_name}" => "",
}) %>

<div class="govuk-grid-row">
  <div class="govuk-grid-column-two-thirds-from-desktop">
    <h1 class="govuk-heading-xl">
      <%= content_for(:title) %>
    </h1>
    <p class="govuk-body">
      <%= review_log_text(@log) %>
    </p>
    <% @log.form.sections.map do |section| %>
      <h2 class="govuk-heading-m"><%= section.label %></h2>
      <% section.subsections.map do |subsection| %>
        <% if total_applicable_questions(subsection, @log, current_user).any? %>
          <div class="x-govuk-summary-card govuk-!-margin-bottom-6">
            <div class="x-govuk-summary-card__header">
              <h3 class="x-govuk-summary-card__title"><%= subsection.label %></h3>
            </div>
            <div class="x-govuk-summary-card__body">
              <%= render partial: "form/check_answers_summary_list", locals: { subsection:, questions: total_applicable_questions(subsection, @log, current_user), referrer: "check_answers" } %>
            </div>
          </div>
        <% end %>
      <% end %>
    <% end %>
  </div>
</div>