<% content_for :title, 'Issues summary' %>

<% content_for :sidebar do %>
  <%= render 'sidebar'%>
<% end %>

<% content_for :breadcrumbs do %>
  <ol class="breadcrumb">
    <li class="breadcrumb-item">
      <%= link_to current_project.name, project_path(current_project) %>
    </li>
    <li class="breadcrumb-item active">
      Issues
    </li>
  </ol>
<% end %>

<!-- Main content -->
<div class="content-container" id="issue-viewer">
  <h4 class="header-underline">Issues
    <span class="actions pt-1">
      <div class="action">
        <div class="dropdown">
          <%= link_to 'javascript:void(0)', class: 'dropdown-toggle', data: { name: 'issues', bs_toggle: 'dropdown' } do %>
            <i class="fa-solid fa-plus me-1"></i>New Issue
          <% end %>
          <%= render 'shared/templates_dropdown',
            name: 'Issue',
            new_path: new_project_issue_path(current_project, @issue),
            category_id: nil
          %>
        </div>
      </div>
    </span>
  </h4>

  <div class="note-text-inner">
    <% if @issues.any? %>
      <div data-behavior="datatable-paths"
           data-table-destroy-url="<%= multiple_destroy_project_issues_path(current_project) %>"
           data-table-destroy-confirmation="Are you sure?&#10;&#10;Proceeding will delete the selected issue(s) and any associated evidence."
           data-table-close-console-url="<%= project_issues_path(current_project) %>"
           data-table-merge-url="<%= new_project_merge_path(current_project) %>"
           data-table-state-url="<%= multiple_update_project_qa_issues_path(current_project) %>" >
        <%= render partial: 'table', locals: { issues: @issues, local_storage_key: "project.ce.#{dom_id(current_project)}.issues_datatable", tags: @tags } %>
      </div>
    <% else %>
      <%= render 'shared/empty_state',
        actions_partial: 'issues/empty_state_actions',
        name: 'issue',
        docs_link: 'https://dradis.com/support/guides/projects/issues.html',
        text: 'Use issues to represent vulnerabilities or findings. Issues contain general information, such as: Title, Description, Recommendation, CVE\'s, etc. Issues are the findings you\'ll end up including in your report.'
      %>
    <% end %>
  </div>
</div>
