<div class="repository-table">
  <div class="repository-table-error"></div>
  <table id="repository-table-<%= repository.id %>" class="table table--reorderable-columns repository-dataTable"
    data-current-uri="<%= request.original_url %>"
    data-repository-id="<%= repository.id %>"
    data-source="<%= repository_index_link %>"
    data-toolbar-url="<%= repository_table_toolbar_path(@repository) %>"
    data-num-columns="<%= repository.default_columns_count + repository.repository_columns.count %>"
    data-create-record="<%= repository_repository_rows_path(repository) %>"
    data-delete-record="<%= repository_delete_records_path(repository) %>"
    data-copy-records="<%= repository_copy_records_path(repository) %>"
    data-archive-records="<%= repository_archive_records_path(repository) %>"
    data-restore-records="<%= repository_restore_records_path(repository) %>"
    data-direct-upload-url="<%= rails_direct_uploads_url %>"
    data-max-dropdown-length="<%= Constants::MODAL_TEXT_MAX_LENGTH %>"
    data-repository-columns-ids="<%= repository.repository_columns.pluck(:id) %>"
    data-save-text="<%= I18n.t('general.save') %>"
    data-edit-text="<%= I18n.t('general.edit') %>"
    data-cancel-text="<%= I18n.t('general.cancel') %>"
    data-columns-visibility-text="<%= I18n.t('repositories.columns_visibility') %>"
    data-columns-delete-text="<%= I18n.t('repositories.columns_delete') %>"
    data-available-columns="<%= repository_available_columns_path(repository) %>"
    data-columns-changed="<%= I18n.t('repositories.columns_changed') %>"
    data-default-order="<%= @repository.default_table_order_as_js_array %>"
    data-default-table-columns="<%= @repository.default_table_columns %>"
    data-editable="<%= can_manage_repository_rows?(repository) %>"
    data-snapshot-provisioning="<%= @snapshot_provisioning %>"
    data-status-url="<%= repository_status_path(@repository) %>">
    <thead>
      <tr class="repository-table-head-<%= repository.id %> hidden" data-e2e="e2e-TR-invInventory-headRow-<%= repository.id %>">
        <th id="checkbox" data-unmanageable="true">
          <div class="sci-checkbox-container">
            <input name="select_all" value="1" type="checkbox" class="sci-checkbox">
            <span class="sci-checkbox-label"></span>
          </div>
        </th>
        <th id="assigned" data-unmanageable="true"><%= t("repositories.table.assigned") %></th>
        <th id="row-id"><%= t("repositories.table.id") %></th>
        <th id="row-name"><%= t("repositories.table.row_name") %></th>
        <th id="relationship" data-disabled="<%= !Repository.repository_row_connections_enabled? %>"
            title="<%= t("repositories.table.relationships") %>"><%= t("repositories.table.relationships") %></th>
        <th id="added-on" ><%= t("repositories.table.added_on") %></th>
        <th id="added-by" ><%= t("repositories.table.added_by") %></th>
        <th id="updated-on" ><%= t("repositories.table.updated_on") %></th>
        <th id="updated-by" ><%= t("repositories.table.updated_by") %></th>
        <th id="archived-on"><%= t("repositories.table.archived_on") %></th>
        <th id="archived-by"><%= t("repositories.table.archived_by") %></th>
        <% if @repository.is_a?(LinkedRepository) %>
          <th id="row-external-id"><%= t('repositories.table.external_id') %></th>
        <% end %>
        <% columns_editable = can_manage_repository_columns?(@repository) %>
        <% repository.repository_columns.order(:id).each do |column| %>
          <th
            class="repository-column <%= 'row-stock item-stock' if column.data_type == 'RepositoryStockValue' %>"
            id="<%= column.id %>"
            data-type="<%= column.data_type %>"
            data-edit-column-url="<%= edit_repository_repository_column_path(repository, column) %>"
            data-destroy-column-url="<%= repository_columns_destroy_html_path(repository, column) %>"
            data-editable-row="<%= columns_editable %>"
            <% column.metadata.each do |k, v| %>
              <%= "data-metadata-#{k}=#{v}" %>
            <% end %>
            <%= "data-items-url=#{items_repository_repository_columns_checklist_column_path(repository, column)}" if column.repository_checklist_value? %>
            <%= "data-items-url=#{items_repository_repository_columns_list_column_path(repository, column)}" if column.repository_list_value? %>
            <%= "data-items-url=#{items_repository_repository_columns_status_column_path(repository, column)}" if column.repository_status_value? %>
          >
            <span class="truncate" title="<%= column.name %>">
              <%= column.name %>
            </span>
          </th>
        <% end %>
      </tr>
    </thead>
    <tbody></tbody>
  </table>
  <div class="repository-edit-overlay repository-edit-overlay--pagination">
    <span><%= t('repositories.pagination_edit_overlay_html') %></span>
    <hr>
  </div>
</div>
