{% load djeuscan_helpers %}
{% load sub %}
{% load div %}
{% load mul %}
{% load djeuscan_helpers %}

{% load url from future %}

<table id="table" class="display">
  <thead>
    <tr>
      <th>Package</th>
      <th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Last version in Gentoo" /></th>
      <th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Last version in Overlays" /></th>
      <th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Last version Upstream" /></th>
      <th><img src="{{ STATIC_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
      <th><img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
      <th><img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
      <th><img src="{{ STATIC_URL }}img/freshness-icon.png" alt="freshness" title="Freshness" /></th>
    </tr>
  </thead>
  <tbody>
  {% for package in packages %}
  <tr>
    <td>
      <a href="{% url "package" package.category package.name %}">
        {{ package.category }}/{{ package.name }}
      </a>
      {% package_bar package %}
    </td>
    <td>
      {% with vtype=package.last_version_gentoo.version|version_type %}
        {% if not vtype|is_stable %}
          <img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ vtype }}" />
        {% endif %}
      {% endwith %}

      {{ package.last_version_gentoo.version|truncatechars:15 }}
    </td>
    <td>
      {% with vtype=package.last_version_overlay.version|version_type %}
        {% if not vtype|is_stable %}
          <img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ vtype }}" />
        {% endif %}
      {% endwith %}

      {{ package.last_version_overlay.version|truncatechars:15 }}
    </td>
    <td>
      {% with vtype=package.last_version_upstream.version|version_type %}
        {% if not vtype|is_stable %}
          <img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ vtype }}" />
        {% endif %}
      {% endwith %}

      {{ package.last_version_upstream.version|truncatechars:15 }}
    </td>
    {% package_cols package %}
  </tr>
  {% endfor %}
  </tbody>
</table>