{% extends "base.html" %}

{% load static %}
{% load extras %}

{% block title %}Colloscope{% endblock title %}

{% block head %}
<link href="{% static 'table.css' %}" rel="stylesheet" type="text/css">
{% endblock head %}

{% block header %}
<h1>Colloscope</h1>
{% endblock header %}


{% block main %}

    <p>
    Lycée : {{ periode.classe.lycee.libelle }}. Classe : {{ periode.classe.libelle }}. <a href="dashboard.html">Retour au tableau de bord</a>
    </p>

    <h2>Colloscope : {{ periode.libelle }}</h2>

    <a href="export.pdf" target="_blank">Exporter le colloscope</a>

    <div class="table-wrapper">
    <table>

    <colgroup>
        <col>
        <col>
        <col>
        <col>
        <col>
    </colgroup>
    <colgroup>
    {% for _ in semaines %}
        <col>
    {% endfor %}
    </colgroup>

    <tr>
        <th rowspan=2>Matière</th>
        <th rowspan=2>Jour</th>
        <th rowspan=2>Heure</th>
        <th rowspan=2>Colleur</th>
        <th rowspan=2>Salle</th>
    {% for n in semaines %}
    <th>{{ n }}</th>
    {% endfor %}
    </tr>

    <tr>
    {% for lundi in lundis %}
        <th>{{ lundi | strftime:"%d/%m/%y" }}</th>
    {% endfor %}
    </tr>


    {% for c, rs in rotations %}
        <tr>
            <td>{{ c.matiere.libelle }}</td>
            <td>{{ jours | getitem:c.jour }}</td>
            <td>{{ c.heure | strftime:"%H:%M" }}</td>
            <td>{{ c.colleur }}</td>
            <td>{{ c.salle }}</td>

            {% for sem, exists, r, est_modifiee, groupes in rs %}
                {% if exists %}
                    {% if est_modifiee %}
                        <td class="modif">{{ groupes | join:"," }}</td>
                    {% else %}
                        <td>{{ groupes | join:"," }}</td>
                    {% endif %}
                {% else %}
                    <td></td>
                {% endif %}
            {% endfor %}
        </tr>
    {% endfor %}

    </table>
    </div>
{% endblock main %}