<% provide(:head_title, t("protocols.index.head_title")) %>

<% if current_team %>
  <% provide(:sidebar_title, t('sidebar.templates.sidebar_title')) %>
  <%= content_for :sidebar do %>
   <%= render partial: "/shared/sidebar/templates_sidebar", locals: {active: :protocol} %>
  <% end %>
  <% provide(:container_class, 'no-second-nav-container') %>

  <% content_for :head do %>
    <meta id="cache-directive" name="turbolinks-cache-control" content="no-cache">
  <% end %>

  <div class="content-pane flexible protocols-index <%= @type %>">
    <div class="content-header sticky-header">
      <div class="title-row" data-e2e="e2e-TX-protocolTemplates-title">
        <h1>
          <% if params[:view_mode] == 'archived' %>
            <%= t('labels.archived')%>
            <%= t('protocols.index.head_title_archived') %>
          <% else %>
            <%= t('protocols.index.head_title') %>
          <% end %>
        </h1>
      </div>
    </div>
    <div class="protocols-container" data-e2e="e2e-CO-protocolTemplates">
      <div id="ProtocolsTable" class="fixed-content-body">
        <protocols-table
          ref="table"
          :actions-url="'<%= actions_toolbar_protocols_url %>'"
          :data-source="'<%= protocols_path(format: :json) %>'"
          :active-page-url="'<%= protocols_path %>'"
          :archived-page-url="'<%= protocols_path(view_mode: :archived) %>'"
          current-view-mode="<%= params[:view_mode] || :active %>"
          :docx-parser-enabled="<%= Protocol.docx_parser_enabled? %>"
          :create-url="'<%= protocols_path if can_create_protocols_in_repository?(current_team) %>'"
          users-filter-url="<%= users_filter_projects_path %>"
        />
      </div>
    </div>
  </div>
<% end %>

<%= javascript_include_tag 'vue_protocols_list' %>

<!-- Legacy code -->
<a class="btn-open-file tw-hidden" data-action='import' >
  <input type="file" ref="importFileBtn" value="" id="importFileInput" accept=".eln" data-role="import-file-input"
         data-team-id="<%= current_team.id %>" data-import-url="<%= import_protocols_path %>">
</a>
<a class="btn-open-file tw-hidden" data-action='import' >
  <input type="file" value="" id="importDocx"  accept=".docx" data-role="import-file-input"
  data-team-id="<%= @current_team.id %>" data-import-url="<%= import_protocols_path %>">
</a>
<%= link_to t("protocols.index.import_protocols_io"), '',
            id: "importProtocolsIo",
            class: 'tw-hidden',
            data: { target: '#protocolsioModal', toggle: 'modal' } %>

<%= render partial: "protocols/index/protocol_preview_modal" %>
<%= render partial: "protocols/index/protocolsio_modal" %>
<div id="protocolsio-preview-modal-target"></div>
<%= javascript_include_tag "protocols/index" %>
<%= javascript_include_tag "handsontable.full" %>
<%= render partial: "shared/formulas_libraries" %>

<div id="protocolFileImportModal">
  <protocol-file-import-modal
    import-url="<%= import_docx_protocols_path %>"
    protocol-template-table-url="<%= protocols_path %>"
  />
</div>

<%= render partial: "protocols/import_export/import_elements" %>
<%= javascript_include_tag 'vue_protocol_file_import_modal' %>
<%= javascript_include_tag "assets/wopi/create_wopi_file" %>
<%= javascript_include_tag 'pdf_js' %>
<%= stylesheet_link_tag 'pdf_js_styles' %>
