<% content_for :title, "Log #{@case_log.id}" %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
  "Logs" => "/logs",
  content_for(:title) => ""
}) %>

<%= turbo_frame_tag "case_log_form", target: "_top" do %>
  <div class="govuk-grid-row">
    <div class="govuk-grid-column-two-thirds-from-desktop">
      <h1 class="govuk-heading-xl">
        <%= content_for(:title) %>
      </h1>

      <h2 class="govuk-heading-s govuk-!-margin-bottom-2">
        This log is
        <%= @case_log.status.to_s.humanize.downcase %>
      </h2>

      <p class="govuk-body govuk-!-margin-bottom-7">You have completed <%= get_subsections_count(@case_log, :completed) %> of <%= get_subsections_count(@case_log, :all) %> sections.</p>
      <p class="govuk-body govuk-!-margin-bottom-2">
        <% next_incomplete_section = get_next_incomplete_section(@case_log) %>
      </p>
      <p>
        <% if next_incomplete_section.present? %>
          <a class="app-section-skip-link" href="#<%= next_incomplete_section.id %>"
            data-controller="tasklist"
            data-action="tasklist#addHighlight"
            data-info=<%= next_incomplete_section.id %>>
            Skip to next incomplete section: <%= next_incomplete_section.label %>
          </a>
        <% end %>
      </p>
      <%= render "tasklist" %>
    </div>
  </div>
<% end %>