<div class="d-flex flex-row justify-content-between align-items-center mb-3">
  <% if policy(Directory).new_file? %>
    <%= link_to fa_icon("plus", text: "Add File"), [:new_file, @project, @directory], class: "btn btn-primary" %>
  <% end %>

  <%= bootstrap_form_with url: [@project, @directory], method: :get, remote: true, layout: :inline 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><%= Directory.human_attribute_name(:name) %></th>
        <th><%= Directory.human_attribute_name(:created_at) %></th>
        <th></th>
      </tr>
    </thead>
    <tbody id="files">
      <% if @files.any? %>
        <%= render partial: "file", collection: @files %>
      <% else %>
        <tr>
          <td colspan="3" class="py-4 text-center text-muted"><%= t(".empty") %></td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>

<div id="files_pagination" class="mt-3">
  <%= will_paginate @files %>
</div>
