<%= javascript "foreman_openscap/arf_reports" %>

<table class="<%= table_css_classes %>">
  <tr>
  <th class="ca" width="40px"><%= check_box_tag "check_all", "", false, { :onclick => "tfm.hosts.table.toggleCheck()", :'check-title' => _("Select all items in this page"), :'uncheck-title'=> _("items selected. Uncheck to Clear") } %></th>
    <th><%= sort :host %></th>
    <th><%= sort :reported, :as => _("Reported At") %></th>
    <th><%= sort :policy, :as => _("Policy") %></th>
    <th><%= sort :openscap_proxy, :as => _("Openscap Proxy") %></th>
    <th><%= sort :compliance_passed, :as => _("Passed") %></th>
    <th><%= sort :compliance_failed, :as => _("Failed") %></th>
    <th><%= sort :compliance_othered, :as => _("Other") %></th>
    <th><%= _("Actions") %></th>
  </tr>
  <% for arf_report in @arf_reports %>
    <tr>
    <td class="ca">
          <%= check_box_tag "host_ids[]",
                             nil,
                             false,
                             :id => "host_ids_#{arf_report.id}",
                             :disabled => !authorized_for(:controller => :arf_reports, :action => :destroy),
                             :class => 'host_select_boxes',
                             :onclick => 'tfm.hosts.table.hostChecked(this)' %>
        </td>
      <td class="elipsis"><%= name_column(arf_report.host) %></td>
      <td><%= display_link_if_authorized(date_time_relative_value(arf_report.reported_at), hash_for_arf_report_path(:id => arf_report.id)) %></td>
      <td class="ellipsis"><%= arf_report.policy.present? ? display_link_if_authorized(arf_report.policy.name, hash_for_edit_policy_path(:id => arf_report.policy.id)) : _('Deleted policy') %></th>
      <td class="ellipsis"><%= openscap_proxy_link arf_report %></th>
      <td><%= report_arf_column(arf_report.passed, "label-info") %></th>
      <td><%= report_arf_column(arf_report.failed, "label-danger") %></th>
      <td><%= report_arf_column(arf_report.othered, "label-warning") %></th>
      <td>
        <%= action_buttons(display_link_if_authorized(_("Full Report"), hash_for_show_html_arf_report_path(:id => arf_report.id
                          )),
                           display_delete_if_authorized(hash_for_arf_report_path(:id => arf_report.id),
                                                       :data => { :confirm => _("Delete compliance report for %s?") % arf_report.host}))
        %>
      </td>
    </tr>
  <% end %>
</table>
<div id="confirmation-modal" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title"><%= _('Please Confirm') %></h4>
      </div>
      <div class="modal-body">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
        <button type="button" class="btn btn-primary" onclick="submit_modal_form()"><%= _('Submit') %></button>
      </div>
    </div>
  </div>
</div>
<%= will_paginate_with_info @arf_reports %>