{# -*- engine:django -*- #}

{% extends 'core/base_print.html' %}

{% load i18n static %}

{% block extra_head %}
  <link rel="stylesheet" href="{% static 'css/chronos/timetable.css' %}">
{% endblock %}

{% block browser_title %}{% blocktrans %}Print: Substitutions{% endblocktrans %}{% endblock %}
{% block page_title %}{% blocktrans %}Substitutions{% endblocktrans %}{% endblock %}


{% block content %}
  {% for day, c in days.items %}
    <h4>{{ c.day|date:"l" }} {{ c.day|date:"SHORT_DATE_FORMAT" }}</h4>

    {% include "core/partials/announcements.html" with announcements=c.announcements show_recipients=1 %}

    {% include "chronos/partials/headerbox.html" with affected_teachers=c.affected_teachers affected_groups=c.affected_groups absent_teachers=c.absent_teachers absent_groups=c.absent_groups print=1 %}

    <table class="substitutions">
      <thead>
      <tr>
        <th><i class="material-icons iconify center" data-icon="mdi:account-multiple-outline"></i></th>
        <th><i class="material-icons iconify center" data-icon="mdi:clock-outline"></i></th>
        <th>{% blocktrans %}Teachers{% endblocktrans %}</th>
        <th>{% blocktrans %}Subject{% endblocktrans %}</th>
        <th>{% blocktrans %}Room{% endblocktrans %}</th>
        <th>{% blocktrans %}Notes{% endblocktrans %}</th>
        <th></th>
      </tr>
      </thead>

      {% if not c.substitutions %}
        <tbody>
        <tr class="striped">
          <td colspan="7">
            <p class="flow-text center">
              {% blocktrans %}No substitutions available.{% endblocktrans %}
            </p>
          </td>
        </tr>
        </tbody>
      {% endif %}

      <tbody>
      {% for item in c.substitutions %}
        {% ifchanged item.el.lesson_period.lesson.groups_to_show_names %}
          </tbody>
          <tbody class="{% cycle "striped" "not-striped" %}">
        {% endifchanged %}

        <tr class="{% include "chronos/partials/subs/colour.html" with item=item %}">
          <td>
            {% include "chronos/partials/subs/groups.html" with type=item.type el=item.el %}
          </td>
          <td>
            {% include "chronos/partials/subs/period.html" with type=item.type el=item.el item=item %}
          </td>
          <td>
            {% include "chronos/partials/subs/teachers.html" with type=item.type el=item.el %}
          </td>
          <td>
            {% include "chronos/partials/subs/subject.html" with type=item.type el=item.el %}
          </td>
          <td>
            {% include "chronos/partials/subs/room.html" with type=item.type el=item.el %}
          </td>
          <td>
            {% include "chronos/partials/subs/badge.html" with sub=item.el %}
            {% include "chronos/partials/subs/comment.html" with el=item.el %}
          </td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
  {% endfor %}
{% endblock %}
