<div class="grid">
  <%= render Components::Backend::Card.new(title: "all verifications") do %>
    <%= render Components::Backend::Item.new(icon: "⭢", href: pending_backend_verifications_path) do %>
      <b>pending verifications</b>
      <p class="shortcode">&nbsp; [ PEND ]</p>
    <% end %>
    <hr>
    <% if @recent_verifications.any? %>
      <div class="table-container">
        <table>
          <thead>
            <tr>
              <th>identity</th>
              <th>type</th>
              <th>status</th>
              <th>date</th>
              <th>reason</th>
            </tr>
          </thead>
          <tbody>
            <% @recent_verifications.each do |verification| %>
              <tr>
                <td>
                  <%= link_to backend_verification_path(verification) do %>
                    <%= verification.identity.first_name %> <%= verification.identity.last_name %>
                  <% end %>
                  <br><small><%= verification.identity.primary_email %></small>
                </td>
                <td>
                  <%= verification.document_type %>
                  <% if verification.ignored_at.present? %>
                    <span class="badge warning">ignored</span>
                  <% end %>
                </td>
                <td>
                  <span class="badge <%= verification.approved? ? 'success' : 'danger' %>">
                    <%= verification.status %>
                  </span>
                </td>
                <td><%= verification.updated_at.strftime("%m/%d/%Y") %></td>
                <td>
                  <% if verification.ignored_at.present? %>
                    <%= verification.ignored_reason %>
                  <% else %>
                    <%= verification.rejection_reason_name %>
                  <% end %>
                </td>
              </tr>
            <% end %>
          </tbody>
        </table>
      </div>
      <%= paginate @recent_verifications %>
    <% else %>
      <div class="empty-state">no verifications found</div>
    <% end %>
  <% end %>
</div>
