diff --git a/biscuit/apps/alsijil/static/css/alsijil/full_register.css b/biscuit/apps/alsijil/static/css/alsijil/full_register.css index d538f3a79690fc993110b579162bf52c8e138b7f..c06fa37d6cb4827063b9e4dd1bbf87e680685ca5 100644 --- a/biscuit/apps/alsijil/static/css/alsijil/full_register.css +++ b/biscuit/apps/alsijil/static/css/alsijil/full_register.css @@ -53,7 +53,11 @@ body.legal.landscape .sheet { width: 357mm; height: 215mm } body { font-family: Arial, Helvetica, san-serif; - font-size: 11pt; + font-size: 10pt; +} + +section.sheet.smallprint { + font-size: 8pt; } #titlepage h1 { @@ -91,3 +95,19 @@ th, td { tr:nth-child(even) { background-color: #f2f2f2; } + +tr.lesson-substituted { + background-color: #ffc107; +} + +tr.lesson-cancelled { + background-color: #dc3545; +} + +tr.lesson-cancelled td { + text-decoration: line-through: +} + +tr.lesson-substituted td.lesson-subj { + text-decoration: line-through; +} diff --git a/biscuit/apps/alsijil/templates/alsijil/print/full_register.html b/biscuit/apps/alsijil/templates/alsijil/print/full_register.html index 9557c61a78605c4227753a6e864f9a165eeffdb7..1ca519d775d3aef50a150b5667a54d0402a0062b 100644 --- a/biscuit/apps/alsijil/templates/alsijil/print/full_register.html +++ b/biscuit/apps/alsijil/templates/alsijil/print/full_register.html @@ -80,12 +80,56 @@ </section> {% for week in weeks %} - <section class="sheet padding-10mm"> - <h2>{% trans 'Lesson documentation for week' %} {{ week }}</h2> + <section class="sheet padding-10mm smallprint"> + <h2>{% trans 'Lesson documentation for calendar week' %} {{ week.week }}</h2> {% for day in week %} - <h3>{{ day }}</h3> - {{ periods_by_day|get_dict:day }} + {% if periods_by_day|get_dict:day %} + <h3>{{ day }}</h3> + + <table> + <thead> + <tr> + <th>{% trans 'Pe.' %}</th> + <th>{% trans 'Subj.' %}</th> + <th>{% trans 'Subs.' %}</th> + <th>{% trans 'Lesson topic' %}</th> + <th>{% trans 'Homework' %}</th> + <th>{% trans 'Te.' %}</th> + </tr> + </thead> + <tbody> + {% for period, documentations, substitution in periods_by_day|get_dict:day %} + <tr class=" + {% if substitution %} + {% if substitution.cancelled %} + lesson-cancelled + {% else %} + lesson-substituted + {% endif %} + {% endif %} + "> + <td class="lesson-pe">{{ period.period.period }}</td> + <td class="lesson-subj">{{ period.lesson.subject.abbrev }}</td> + <td class="lesson-subs">{{ substitution.subject.abbrev }}</td> + <td class="lesson-topic"> + {% if substitution.cancelled %} + {% trans 'Lesson cancelled' %} + {% else %} + {{ documentations.0.topic }} + {% endif %} + </td> + <td class="lesson-homework">{{ documentations.0.homework }}</td> + <td class="lesson-te"> + {% if documentations.0.topic %} + {{ substitution.teachers.first.short_name|default:period.lesson.teachers.first.short_name }} + {% endif %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + {% endif %} {% endfor %} </section> {% endfor %} diff --git a/biscuit/apps/alsijil/views.py b/biscuit/apps/alsijil/views.py index 38bc9959ea332900198107db6ec5f436f4c93383..5ee3ceef9f4dbddd5eff64502ef159b65a319fa5 100644 --- a/biscuit/apps/alsijil/views.py +++ b/biscuit/apps/alsijil/views.py @@ -189,7 +189,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse: ).select_related( 'lesson', 'lesson__subject', 'period', 'room' ).prefetch_related( - 'lesson__groups', 'lesson__teachers', 'substitutions' + 'lesson__groups', 'lesson__teachers', 'substitutions', 'documentations' ).filter( Q(lesson__groups=group) | Q(lesson__groups__parent_groups=group) ).distinct() @@ -221,8 +221,12 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse: for lesson_period in lesson_periods: for week in weeks: day = week[lesson_period.period.weekday - 1] + if lesson_period.lesson.date_start <= day and lesson_period.lesson.date_end >= day: - periods_by_day.setdefault(day, []).append(lesson_period) + documentations = list(filter(lambda d: d.week == week.week, lesson_period.documentations.all())) + substitution = lesson_period.get_substitution(week.week) + + periods_by_day.setdefault(day, []).append((lesson_period, documentations, substitution)) context['group'] = group context['weeks'] = weeks