<template id="repositoryToolbar">
  <div class="repository-edit-overlay repository-edit-overlay--toolbar">
    <%= t('repositories.toolbar_edit_overlay_html') %>
  </div>
  <!-- LEFT TOOLBAR BLOCK -->
  <div class="toolbar-left-block">
    <% if @repository.active? %>
      <% if @repository.repository_snapshots.provisioning.any? %>
        <div class='repository-provisioning-notice auto-shrink-button'>
          <i class="sn-icon sn-icon-info"></i>
          <span class="button-text"><%= t('repositories.index.snapshot_provisioning_in_progress') %></span>
        </div>
      <% end %>
      <% if can_create_repository_rows?(@repository) %>
        <button type="button" data-toggle="tooltip" data-placement="bottom" title="<%= t('repositories.show.button_tooltip.new') %>"
                class="btn btn-primary editAdd auto-shrink-button"
                id="addRepositoryRecord" data-view-mode="active">
          <span class="sn-icon sn-icon-new-task"></span>
          <span class="button-text"><%= t("repositories.add_new_record") %></span>
        </button>
        <button type="button" data-toggle="tooltip" data-placement="bottom" title="<%= t('repositories.show.button_tooltip.import') %>"
                class="btn btn-light editImport auto-shrink-button" data-e2e="e2e-BT-topToolbar-importInventoryItems"
                id="importRecordsButton" data-view-mode="active">
          <span class="sn-icon sn-icon-import"></span>
          <span class="button-text"><%= t('repositories.import_records.update_inventory') %></span>
        </button>
      <% end %>

      <span id="saveCancel" class="flex items-center gap-2" data-toggle="buttons" style="display:none">
        <button type="button" class="btn btn-primary prevent-shrink" id="saveRecord" data-view-mode="active">
          <span class="fas fa-save"></span>
          <%= t("repositories.save_record") %>
        </button>
        <button type="button" class="btn btn-light prevent-shrink" id="cancelSave" data-view-mode="active">
          <span class="sn-icon sn-icon-close"></span>
          <%= t("repositories.cancel_save") %>
        </button>
      </span>
    <% end %>
    <% if @repository.has_reminders? && @repository.repository_rows.with_active_reminders(@repository, current_user).any? %>
      <button type="button" data-toggle="tooltip" data-placement="bottom" title="<%= t("repositories.hide_reminders") %>"
              class="btn btn-light auto-shrink-button"
              id="hideRepositoryReminders"
              data-view-mode="active"
              data-hide-reminders-url="<%= team_repository_hide_reminders_url(@current_team, @repository) %>">
        <span class="fas fa-bell-slash"></span>
        <span class="button-text"><%= t("repositories.hide_reminders") %></span>
      </button>
    <% end %>
    <% if can_manage_repository_filters?(@repository) %>
      <div class="toolbar-save-filters">
        <%= render partial: 'repositories/toolbar/save_filters' %>
      </div>
    <% end %>
  </div>

  <div class="toolbar-middle-block">
    <div id='repositoryStateMenu' data-behaviour="vue">
      <repository-state-menu
        view-mode="<%= params[:archived] ? 'archived' : 'active' %>"
        disabled="<%= @repository.archived? %>"
        active-url="<%= repository_url(@repository) %>"
        archived-url="<%= repository_url(@repository, params: { archived: true }) %>">
      </repository-state-menu>
    </div>
  </div>

  <!-- RIGHT TOOLBAR BLOCK -->
  <div class="toolbar-right-block">
    <div class="toolbar-search"></div>
    <% if RepositoryBase.stock_management_enabled? %>
      <div class="active-reminders-filter"
          title="<%= t('repositories.index.active_reminders.description') %>"
          data-checked-title="<%= t('repositories.index.active_reminders.checked_description')  =%>"
          data-unchecked-title="<%= t('repositories.index.active_reminders.description')  =%>"
      >
        <div class="sci-checkbox-container">
          <input id="only_reminders" type="checkbox" class="sci-checkbox" value="1">
          <span class="sci-checkbox-label"></span>
        </div>
        <span data-click-target="#only_reminders">
          <span class="active-reminders-label"><%= t('repositories.index.active_reminders.label') %></span>
          <span class="active-reminders-short-label"><%= t('repositories.index.active_reminders.short_label') %></span>
        </span>
      </div>
    <% end %>
    <div class="toolbar-filters"></div>
    <div class="repo-datatables-buttons">
      <button class="btn btn-light btn-black icon-btn manage-repo-column-index" title="<%= t("libraries.manange_modal_column.button_tooltip") %>"
              data-modal-url="<%= repository_repository_columns_path(@repository) %>"
              data-action="new">
        <span class="sn-icon sn-icon-manage-columns" data-e2e="e2e-BT-invInventoryRT-manageColumns">
      </button>
    </div>
  </div>
</template>

<%= javascript_include_tag('vue_legacy_repository_menu_dropdown') %>
