<h4>{% trans %}Files{% endtrans %}</h4>
<table class='table'>
  <tr>
    <th>{% trans %}File name{% endtrans %}</th>
    <th>{% trans %}Uploaded{% endtrans %}</th>
    <th>{% trans %}Type{% endtrans %}</th>
    <th>{% if context.is_edit_ok() %}{% trans %}Edit{% endtrans %}{% else %}{% trans %}Details{% endtrans %}{% endif %}</th>
    {% if context.is_edit_ok() %}<th>{% trans %}Remove{% endtrans %}</th>{% endif %}
  </tr>
  {% for file in context.files %}
    <tr>
      <td>
        <a class="btn btn-sm btn-outline-primary" href='{{ file.download_url()|u|safe }}'>{{ file.name.plain()|u }}</a>
      </td>
      <td>{{ file.creator.plain()|u }}, {{ file.creation.plain()|u }}</td>
      <td>{{ file.type.plain()|u }}</td>
      <td>
        <a class="btn btn-sm btn-success" href='file{{ file.id }}'>
		  {% if file.is_edit_ok() %}
		  {% trans %}edit{% endtrans %}
		  {% else %}
		  {% trans %}view{% endtrans %}
		  {% endif %}
		</a>
      </td>
      {% if file.is_edit_ok() %}
        <td>
          <form method="POST" action='issue{{ context.id }}'>
            <input type="hidden" name="@remove@files" value='{{ file.id }}'>
            <input name="@csrf" type="hidden" value="{{ utils.anti_csrf_nonce() }}">
            <input type="hidden" name="@action" value="edit">
            <input class="btn btn-sm btn-danger" type="submit" value="{% trans %}remove{% endtrans %}">
          </form>
        </td>
      {% endif %}
    </tr>
  {% endfor %}
</table>
