{% extends "base.html" %} {% block title %}Schichtplan {{ year }}-{{ '%02d'|format(month) }}{% endblock %} {% block heading %}Schichtplan — {{ ['','Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'][month] }} {{ year }}{% endblock %} {% block topbar_actions %} {% set prev_y = year if month > 1 else year - 1 %} {% set prev_m = month - 1 if month > 1 else 12 %} {% set next_y = year if month < 12 else year + 1 %} {% set next_m = month + 1 if month < 12 else 1 %} ← {{ prev_m }}/{{ prev_y }} {{ next_m }}/{{ next_y }} → {% endblock %} {% block content %}

Belegungsplan

Klick auf eine Zelle wechselt die Schicht: Früh → Spät → Nacht → Frei → Urlaub → Krank → leer. Rechtsklick öffnet Auswahl. Erfordert Berechtigung „manage_users" oder „manage_hr".

{% for d in days %} {% set wd = d.weekday() %} {% set is_weekend = wd >= 5 %} {% endfor %} {% for u in users %} {% for d in days %} {% set wd = d.weekday() %} {% set ds = d.isoformat() %} {% set st = (shift_map.get(u.id, {})).get(ds) %} {% endfor %} {% endfor %} {# Balance-Zeile: pro Tag wie viele MA pro Schicht #} {% for d in days %} {% set ds = d.isoformat() %} {% set b = balance.get(ds, {}) %} {% endfor %}
Mitarbeiter {{ d.day }}
{{ ['Mo','Di','Mi','Do','Fr','Sa','So'][wd] }}
{{ u.first_name }} {{ u.last_name }} {% if u.position %}
{{ u.position }}
{% endif %}
{% if st == 'early' %}F {% elif st == 'late' %}S {% elif st == 'night' %}N {% elif st == 'free' %}– {% elif st == 'vacation' %}U {% elif st == 'sick' %}K {% endif %}
Belegung {% set total = (b.get('early',0) + b.get('late',0) + b.get('night',0)) %} {% if total %}{{ total }}{% endif %}
F = Frühschicht
S = Spätschicht
N = Nachtschicht
– = Frei
U = Urlaub
K = Krank
{% endblock %}