{% import "macros.html.j2" as macros %}
<h2>Files</h2>
{% with files = ctx.db.list_files(uid=ctx.uid) %}
{% if files %}
{% for file in files %}
<div class="file row u-flex">
  <div class="details six columns">
    <span class="file-name">{{ file.filename }}</span>
    <span class="file-owner">{{ ctx.db.fetch_user(uid=file.user_id).name }}</span>
    <span class="file-sucesses">{{ file.print_successes }}</span> successes
    <span class="file-failures">{{ file.print_failures }}</span> errors
  </div>
  <div class="controls u-flex u-ml-auto">
    {{ macros.delete_file(file.id, endpoint="/admin/files") }}
  </div>
</div>
{% endfor %}
{% else %}
  You don't have any files. Upload something!
{% endif %}
{% endwith %}
