<%= render "shared/filter_subnav", i18n_namespace: "admin.users.index" %>

<% if @users.any? %>
  <h3><%= page_entries_info @users %></h3>

  <table>
    <thead>
      <tr>
        <% if @current_filter == "erased" %>
          <th scope="col"><%= t("admin.users.columns.id") %></th>
          <th scope="col"><%= t("admin.users.columns.erase_reason") %></th>
        <% else %>
          <th scope="col"><%= t("admin.users.columns.name") %></th>
          <th scope="col"><%= t("admin.users.columns.email") %></th>
          <th scope="col"><%= t("admin.users.columns.document_number") %></th>
          <th scope="col"><%= t("admin.users.columns.roles") %></th>
          <th scope="col"><%= t("admin.users.columns.verification_level") %></th>
          <th scope="col"><%= t("admin.users.columns.activation_status") %></th>
        <% end %>
      </tr>
    </thead>
    <tbody>
      <% @users.each do |user| %>
        <tr>
          <% if @current_filter == "erased" %>
            <td><%= link_to user.id, user_path(user) %></td>
            <td><%= user.erase_reason %></td>
          <% else %>
            <td><%= link_to user.name, user_path(user) %></td>
            <td><%= user.email %></td>
            <td><%= user.document_number %></td>
            <td><%= display_user_roles(user) %></td>
            <td><%= user.user_type %></td>
            <td><%= user.confirmed_at? ? t("admin.users.account.active_status") : t("admin.users.account.inactive_status") %></td>
          <% end %>
        </tr>
      <% end %>
    </tbody>
  </table>

  <%= paginate @users %>
<% else %>
  <div class="callout primary">
    <%= t("admin.users.index.no_users") %>
  </div>
<% end %>
