<div class="d-flex flex-row justify-content-between align-items-center mb-3">
  <% if policy(User).new? %>
    <%= link_to fa_icon("plus", text: t(".actions.new")), [:new, :admin, :user], class: "btn btn-primary mb-3" %>
  <% end %>

  <%= bootstrap_form_with url: admin_users_path, method: :get, remote: true, layout: :inline, id: "search" do |form| %>
    <%= form.search_field :query, hide_label: true, placeholder: t(".actions.search"), class: "rounded-pill-right", value: params[:query], prepend: form.button(fa_icon("search"), class: "btn btn-light border rounded-pill-left") %>
  <% end %>
</div>

<div class="border bg-white rounded shadow-sm pb-3 table-responsive">
  <table class="table table-striped tr-px-4 align-all-middle">
    <thead class="thead-light">
      <tr>
        <th>Email</th>
        <th>First Name</th>
        <th>Last Name</th>
        <th>Role</th>
        <th>Account Name</th>
        <th>Created At</th>
        <th></th>
      </tr>
    </thead>
    <tbody id="users">
      <% if @users.any? %>
        <%= render @users %>
      <% else %>
        <tr>
          <td colspan="5" class="py-4 text-center text-muted"><%= t(".empty") %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>
