{% extends 'base.html' %}
{% block body %}
<h1>Packages</h1>
<table class="table">
  <thead>
    <tr>
      <th>#</th>
      <th>package</th>
      <th>summary</th>
      <th>last update</th>
      <th>actions</th>
    </tr>
  </thead>
  <tbody>
    {% for package in packages %}
    <tr>
      <td>{{package.id}}</td>
      <td><a href="{{url_for('dashboard.package', package=package.name)}}">{{package.name}}</a></td>
      <td>{{package.summary}}</td>
      <td>
        {% if package.updated_at %}
        {{package.updated_at}}
        {% else %}
        {{package.created_at.strftime("%Y-%m-%d")}}
        {% endif %}
      </td>
      <td>
        {% if current_user.is_admin %}
          <a href="{{url_for('dashboard.delete_package', package_id=package.id)}}" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this package and all its releases ?');">delete</a>
        {% endif %}
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% endblock %}
