{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "All Quizzes" %}{% endblock %}

{% block content %}

<!-- vérif user is logged == admin -->
{% if user.is_superuser %}

<h2>{% trans "List of complete exams" %}</h2>
    {% if sitting_list %}

		<table class="table table-bordered table-striped">

		  <thead>
			<tr>
			  <th>{% trans "User" %}</th>
			  <th>{% trans "Quiz" %}</th>
			  <th>{% trans "Completed" %}</th>
			  <th>{% trans "Duration(in minutes)" %}</th>
			  <th>{% trans "Score" %}(%)</th>
			  <th></th>
			</tr>
		  </thead>

		  <tbody>
			<tr>
			  <form action="" method="GET">
				<td><input type="text" name="user_filter" /></td>
				<td><input type="text" name="quiz_filter" /></td>
				<td></td>
				<td></td>
				<td><button type="submit" class="btn btn-default">{% trans "Filter"%}</button></td>
			  </form>
			</tr>


        {% for sitting in sitting_list %}

			<tr>
			  <td>{{ sitting.user }}</td>
			  <td>{{ sitting.quiz }}</td>
			  <td>{{ sitting.end|date }}</td>
			  <td>{{ sitting.get_duration }}</td>
			  <td>{{ sitting.get_percent_correct }}</td>
			  <td>
				<a href="{% url 'quiz_marking_detail' pk=sitting.id %}">
				  {% trans "View details" %}
				</a>
			</tr>

        {% endfor %}

		  </tbody>

		</table>
    {% else %}
        <p>{% trans "There are no matching quizzes" %}.</p>
    {% endif %}

{% else %}
		<p>{% trans "You don't have access to this page" %}</p>
{% endif %} 
{% endblock %}
