- @pagetitle = 'Maintenance Incidents'

.card.mb-3
  = render partial: 'webui/project/tabs', locals: { project: @project }
  .card-body
    %h3
      Maintenance incidents
      %span.badge.text-bg-primary
        = @incidents.count
    -# haml-lint:disable MultilinePipe
    %table.w-100.responsive.table.table-sm.table-bordered.table-hover#incident-table{ data: { |
    source: project_maintenance_incidents_path(project_name: @project.name) } } |
      -# haml-lint:enable MultilinePipe
      %thead
        %tr
          %th
            Summary
          %th
            Category
          %th
            Packages
          %th
            Info
          %th
            Release Targets
      %tbody
    - if policy(@project).create?
      .pt-4
        = link_to(project_maintenance_incidents_path(@project.name), method: :post) do
          %i.fas.fa-plus-circle.text-primary
          Create Maintenance Incident

- content_for :ready_function do
  :plain
    initializeRemoteDatatable('#incident-table', {
      lengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
      responsive: true,
      searching: false,
      columns: [
        { data: 'summary', orderable: true },
        { data: 'category', orderable: false },
        { data: 'packages', orderable: false },
        { data: 'info', orderable: false },
        { data: 'release_targets', orderable: false }
      ]
    });
