{% load humanize %}
<table class="table is-bordered is-striped is-hoverable is-fullwidth">
  {% include 'scanpipe/includes/list_view_thead.html' %}
  <tbody>
  {% for project in projects %}
    <tr>
      <th class="break-all">
        <a href="{{ project.get_absolute_url }}">{{ project }}</a>
        <div>
          {% include 'scanpipe/includes/project_labels.html' with labels=project.labels.all only %}
        </div>
        <span class="has-text-grey is-size-7 is-block" title="{{ project.created_date|date:'N j, Y, P T' }}">Created {{ project.created_date|naturaltime }}</span>
      </th>
      <td>
        {% if project.discoveredpackages_count %}
          <a href="{% url 'project_packages' project.slug %}">
            {{ project.discoveredpackages_count|intcomma }}
          </a>
        {% else %}
          <span>0</span>
        {% endif %}
      </td>
      <td>
        {% if project.discovereddependencies_count %}
          <a href="{% url 'project_dependencies' project.slug %}">
            {{ project.discovereddependencies_count|intcomma }}
          </a>
        {% else %}
          <span>0</span>
        {% endif %}
      </td>
      <td>
        {% if project.codebaseresources_count %}
          <a href="{% url 'project_resources' project.slug %}">
            {{ project.codebaseresources_count|intcomma }}
          </a>
        {% else %}
          <span>0</span>
        {% endif %}
      </td>
      <td>
        {% if project.projectmessages_count %}
          <a href="{% url 'project_messages' project.slug %}">
            {{ project.projectmessages_count|intcomma }}
          </a>
        {% else %}
          <span>0</span>
        {% endif %}
      </td>
      <td>
        {% for run in project.runs.all %}
          <div class="is-flex is-justify-content-space-between {% if not forloop.first %}mt-1{% endif %}">
            <span class="mr-1">{{ run.pipeline_name }}</span>
            <a class="modal-button" data-target="run-detail-modal" data-uuid="{{ run.uuid }}" aria-haspopup="true">
              {% include "scanpipe/includes/run_status_tag.html" with run=run only %}
            </a>
          </div>
        {% endfor %}
      </td>
      <td>
        {% if project.codebaseresources_count or project.discoveredpackages_count %}
          {% include "scanpipe/dropdowns/project_download_dropdown.html" with project=project only %}
        {% endif %}
      </td>
    </tr>
  {% endfor %}
  </tbody>
</table>