<%= stylesheet_link_tag 'datatables' %>

<% if params[:preview_report_id] %>
  <%= hidden_field_tag :show_report_preview, nil, class: "file-preview-link", data: { preview_url: document_preview_report_path(params[:preview_report_id], report_type: params[:preview_type]) } %>
<% end %>

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

<div class="content-pane flexible reports-index">
  <%= render partial: 'reports/index_header' %>
  <div id="reportsTable" class="fixed-content-body">
    <reports-table
      actions-url="<%= actions_toolbar_reports_url %>"
      available-repositories-url="<%= reports_available_repositories_path %>"
      available-columns-url="<%= available_asset_type_columns_path %>"
      available-rows-url="<%= available_rows_repositories_path %>"
      data-source="<%= reports_path(format: :json) %>"
      search-value="<%= params[:search] %>"
      create-url="<%= new_report_path if can_create_reports?(current_team) %>"
    />
  </div>
  <%= javascript_include_tag 'vue_reports_table' %>
  <%= javascript_include_tag 'pdf_js' %>
  <%= stylesheet_link_tag 'pdf_js_styles' %>
</div>

<!-- Save report modal -->
<div class="modal" id="delete-reports-modal" tabindex="-1" role="dialog" aria-labelledby="delete-reports-modal-label">
  <%= form_with url: reports_destroy_path, method: :post, id: "delete-reports-form" do |f| %>
    <input type="hidden" name="report_ids" id="report-ids">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button>
          <h4 class="modal-title" id="delete-reports-modal-label"><%=t "projects.reports.index.modal_delete.head_title" %></h4>
        </div>
        <div class="modal-body">
          <%=t "projects.reports.index.modal_delete.message" %>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal"><%=t "general.cancel" %></button>
          <%= f.button t("projects.reports.index.modal_delete.delete"), class: "btn btn-danger", id: "confirm-delete-reports-btn", name: nil %>
        </div>
      </div>
    </div>
  <% end %>
</div>
