{% extends "shared/base.html" %}

{% block title %}
  <title>MediaFiles List</title>
{% endblock %}

{% block content %}
  {% with msg=msg %}
    {% include "components/alerts.html" %}
  {% endwith %}
  <div class="container">
    <div class="row">
      <form class="d-flex" action="/media/files/">
        <input class="form-control me-2" name="query" id="autocomplete" type="search" placeholder="Search" aria-label="Search">
        Review<input type="checkbox" name="review" aria-label="Review">
        Download<input type="checkbox" name="download" aria-label="Download">
        <button class="btn btn-outline-success" type="submit">Search</button>
      </form>
    </div>
    <div class="row">
      <table class="table table-hover">
        <thead><tr>
          <th scope="col">Titel</th>
          <th scope="col">Review</th>
          <th scope="col">Download</th>
        </tr></thead>
        <tbody>
          {% for mediafile in mediafiles %}
          <tr>
            <th scope="row"><a href="/media/files/{{mediafile.id}}">{{mediafile.title}}</a></th>
            <td>{% with check=mediafile.review %}{% include "components/check.html" %}{% endwith %}</td>
            <td>{% with check=mediafile.should_download %}{% include "components/check.html" %}{% endwith %}</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
{% endblock %}
