<% content_for :before_content do %>
  <% content_for :title, "Are you sure you want to clear all?" %>
<% end %>

<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">You've selected <%= @questions_to_clear.count %> answers to clear</p>

    <%= govuk_warning_text(text: "Dependent answers related to this question may also get cleared. You will not be able to undo this action") %>
      <%= form_with model: @log, url: send("#{@log.model_name.param_key}_#{@page.id}_path", @log), method: "post", local: true do |f| %>

      <% @related_question_ids.each do |id| %>
        <%= f.hidden_field id, value: @log[id] %>
      <% end %>

      <%= f.hidden_field :clear_question_ids, value: @questions_to_clear %>
      <%= f.hidden_field :page, value: @page.id %>

      <div class="govuk-button-group">
        <%= f.govuk_submit "Confirm and continue", name: "check_errors" %>
        <%= govuk_button_link_to(
          "Cancel",
        "javascript:history.back()",
          secondary: true,
        ) %>
      </div>
    <% end %>
  </div>
</div>