<%= govuk_table do |table| %>
  <%= table.with_head do |head| %>
    <% head.with_row do |row| %>
      <% row.with_cell header: true, text: "Log ID" %>
      <% row.with_cell header: true, text: "Purchaser code" %>
      <% row.with_cell header: true, text: "Sale completion date" %>
      <% row.with_cell header: true, text: "Status" %>
      <% row.with_cell header: true, text: "Delete?" %>
    <% end %>
  <% end %>
  <%= table.with_body do |body| %>
    <% f.govuk_check_boxes_fieldset :selected_ids, small: true do %>
      <% delete_logs_form.logs.each do |log| %>
        <% body.with_row do |row| %>
          <% row.with_cell do %>
            <%= govuk_link_to log.id, url_for(log) %>
          <% end %>
          <% row.with_cell text: log.purchid %>
          <% row.with_cell text: log.saledate&.to_formatted_s(:govuk_date) %>
          <% row.with_cell text: status_tag(log.status) %>
          <% row.with_cell html_attributes: { class: "checkbox-cell" } do %>
            <% f.govuk_check_box :selected_ids, log.id,
              label: { text: log.id, hidden: true },
              checked: delete_logs_form.selected_ids.include?(log.id) %>
          <% end %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>