<%= render partial: "shared/table_filter_bar.html.erb", locals: { users: false } %>

<div class="row">
  <div class="col-sm-12">
    <table id="target-table-<%= @table.downcase %>" class="data-table data-table-main table" data-table-name='<%= current_table %>' data-database-name='<%= @database.friendly_name %>' data-nested-table='<%= table_settings.nested_table %>' data-can-export="<%= current_admin_user.export_abilities? %>" data-nested-table-columns="<%= @nested_column_names.to_json %>" data-primary-keys="<%= table_settings.primary_keys['primary_keys'] %>">
      <thead>
        <tr>
          <% unless @nested_column_names.empty? %>
            <th></th>
          <% end %>
          <% @headers.each do |header|%>
            <th class='column-<%= header %>'><%= header.humanize %></th>
          <% end %>
        </tr>
      </thead>
    </table>
    <% if current_admin_user.permission?(:create, @table, @database.id) %>
      <div class="target-table--add-record">
        <a data-remote='true' href='/table/add_record?table=<%= @table.downcase %>&database_id=<%= @database.id %>' class="btn btn-default">
          <span><img src="/assets/images/icons/plus.png" alt="plus" class="table--add-record-button">Add Record</span>
        </a>
      </div>
    <% end %>
  </div>
</div>
