diff --git a/biscuit/apps/chronos/templates/timetable/hintsinsubprint.html b/biscuit/apps/chronos/templates/timetable/hintsinsubprint.html new file mode 100644 index 0000000000000000000000000000000000000000..b7d5f4c9348212e844940e225fb2c518622fcb46 --- /dev/null +++ b/biscuit/apps/chronos/templates/timetable/hintsinsubprint.html @@ -0,0 +1,16 @@ +{% load martortags %} +{% if hints %} + {% for hint in hints %} + <div class="alert primary"> + <div> + <strong> + {{ hint.classes_formatted }}{% if hint.teachers and hint.classes.all %}, Lehrkräfte{% endif %}: + </strong> + + <i class="material-icons left">announcement</i> + + {{ hint.text|safe_markdown }} + </div> + </div> + {% endfor %} +{% endif %} diff --git a/biscuit/apps/chronos/templates/timetable/substitutionprint.html b/biscuit/apps/chronos/templates/timetable/substitutionprint.html new file mode 100755 index 0000000000000000000000000000000000000000..d3b82b033ce8f21c26d6db98a450be9c203160b3 --- /dev/null +++ b/biscuit/apps/chronos/templates/timetable/substitutionprint.html @@ -0,0 +1,111 @@ +{% load common %} +{% include 'partials/paper/header.html' %} + +<script type="text/javascript"> + var dest = "/timetable/substitutions/"; +</script> + +<style> + table.substitutions td, table.substitutions th { + padding: 0 2px; + } + + span.badge.new { + font-size: 0.9rem; + line-height: 20px; + height: 20px; + margin: 2px; + letter-spacing: 0.3pt; + } +</style> + +<h4>Vertretungen {{ date|date:"l, j. F Y" }}</h4> + + +{% include "timetable/hintsinsubprint.html" %} + +<div class="row no-print"> + <div class="col"> + {% if header_info.is_box_needed %} + + {% for row in header_info.rows %} + <div class="row no-margin"> + <div class="col s3"> + <strong>{{ row.0 }}</strong> + </div> + <div class="col s9"> + {{ row.1 }} + </div> + </div> + {% endfor %} + + {% endif %} + </div> +</div> + +<table class="substitutions"> + <thead> + <tr> + <th><i class="material-icons">people</i></th> + <th><i class="material-icons">access_time</i></th> + <th>Lehrer</th> + <th>Fach</th> + <th>Raum</th> + <th>Hinweis</th> + <th></th> + </tr> + </thead> + <tbody> + {% if not sub_table %} + <td colspan="7"> + <p class="flow-text center"> + Keine Vertretungen vorhanden + </p> + </td> + {% endif %} + + {% set color_background = 1 %} + {% set last_classes = "" %} + + {% for sub in sub_table %} + + {# Color groups of classes in grey/white #} + {% if last_classes != sub.classes %} + {% if color_background %}{% set color_background = 0 %} + {% else %}{% set color_background = 1 %} + {% endif %} + {% endif %} + {% set last_classes = sub.classes %} + + + <tr class="{{ sub.color }}-text {% if color_background %}striped{% endif %}"> + <td> + {{ sub.classes }} + </td> + <td> + <strong> + {{ sub.lesson }} + </strong> + </td> + <td> + {% include "timetable/subs/teacher.html" %} + </td> + <td> + {% include "timetable/subs/subject.html" %} + </td> + <td> + {% include "timetable/subs/room.html" %} + </td> + <td> + {% if sub.badge %} + <span class="badge new green">{{ sub.badge }}</span> + {% endif %} + <em>{{ sub.text|default:"" }}</em> + </td> + </tr> + {% endfor %} + </tbody> +</table> + + +{% include 'partials/paper/footer.html' %} diff --git a/biscuit/apps/chronos/urls.py b/biscuit/apps/chronos/urls.py index 1a8f979a2854425a642fe53b460ef7db7dd60d99..4810627972f780638416d298ec99c503085be065 100755 --- a/biscuit/apps/chronos/urls.py +++ b/biscuit/apps/chronos/urls.py @@ -23,6 +23,10 @@ try: path('substitutions/', views.substitutions, name='timetable_substitutions'), path('substitutions/<int:year>/<int:month>/<int:day>/', views.substitutions, name='timetable_substitutions_date'), + path('substitutions/<int:year>/<int:month>/<int:day>/<str:print_view>/', views.substitutions, + name='timetable_substitutions_date_print'), + path('substitutions/<str:print_view>/', views.substitutions, + name='timetable_substitutions_print'), path('aktuell.pdf', views.sub_pdf, name="timetable_substitutions_pdf"), path('<str:plan_date>-aktuell.pdf', views.sub_pdf, name="timetable_substitutions_pdf_date") ] @@ -46,5 +50,10 @@ except (Terms.DoesNotExist, Schoolyear.DoesNotExist, ProgrammingError, Operation path('substitutions/', fallback_view.fallback, name='timetable_substitutions'), path('substitutions/<int:year>/<int:month>/<int:day>/', fallback_view.fallback, name='timetable_substitutions_date'), - path('aktuell.pdf', fallback_view.fallback, name="timetable_substitutions_pdf") + path('substitutions/<int:year>/<int:month>/<int:day>/<str:print_view>/', fallback_view.fallback, + name='timetable_substitutions_date_print'), + path('substitutions/<str:print_view>/', fallback_view.fallback, + name='timetable_substitutions_print'), + path('aktuell.pdf', fallback_view.fallback, name="timetable_substitutions_pdf"), + path('<str:plan_date>-aktuell.pdf', fallback_view.fallback, name="timetable_substitutions_pdf_date") ] diff --git a/biscuit/apps/chronos/views.py b/biscuit/apps/chronos/views.py index c716d63dc3f0ed51e93e273ffc3c5d501b6d0c57..1973b77cefe7908ab41ff54b0eba4a3c8f6eae99 100755 --- a/biscuit/apps/chronos/views.py +++ b/biscuit/apps/chronos/views.py @@ -331,9 +331,11 @@ def sub_pdf(request, plan_date=None): @login_required @permission_required("timetable.show_plan") @cache_page(SUBS_VIEW_CACHE.expiration_time) -def substitutions(request, year=None, month=None, day=None): +def substitutions(request, year=None, month=None, day=None, print_view: str = False): """Show substitutions in a classic view""" + print_view = print_view == "print" + date, time = find_out_what_is_today(year, month, day) # Get next weekday if it is a weekend @@ -363,7 +365,12 @@ def substitutions(request, year=None, month=None, day=None): "hints": hints, } - return render(request, 'timetable/substitution.html', context) + if not print_view: + template_name = 'timetable/substitution.html' + else: + template_name = 'timetable/substitutionprint.html' + + return render(request, template_name, context) ###################