{% extends 'base.html' %} {% load static format_tags %} {% block title %}Absences | FoxFitt{% endblock %} {% block content %} {% comment %} === ABSENCES LIST PAGE === Filtered, paginated table of absences. Each row links to edit and has an inline delete form. CSV export button only shows for admin. {% endcomment %}
{# === Page header — title + log/export action buttons === #}

Absences

{{ page.paginator.count }} record{{ page.paginator.count|pluralize }}
Log Absence {% if is_admin %} CSV {% endif %}
{# === Flash messages (e.g. "Absence deleted") === #} {% if messages %} {% for m in messages %}
{{ m }}
{% endfor %} {% endif %} {# === Filter bar — 7 fields stacked on mobile, wrapped on desktop === #} {# Lift the filter card above the table card so the multi-checkbox #} {# Reasons dropdown can overflow downward without being clipped by #} {# the next sibling .card (the table). Requires `position: relative` #} {# for z-index to apply. #}
{# === Reason filter — multi-checkbox dropdown (Fix A2, May 2026) === #} {# All checkboxes share name="reason" so Django gets multiple values #} {# in request.GET.getlist('reason') when the form submits. The wrapping #} {#
    keeps the dropdown open while #} {# the user is picking multiple boxes; submitting via the Apply button #} {# closes it normally. #}
Clear
{# === Table of absences === #}
{% for a in page %} {# Project column — shows the direct Absence.project FK, #} {# or an em-dash for non-project absences. #} {% empty %} {# Colspan bumped from 7 → 8 to cover the new Project column. #} {% endfor %}
Date Worker Project Reason Paid? Logged by Notes
{{ a.date|date:"d M Y" }} {{ a.worker.name }}{{ a.project.name|default:"—" }} {{ a.get_reason_display }} {% if a.is_paid %} {% if a.payroll_adjustment %}({{ a.payroll_adjustment.amount|money }}){% endif %} {% else %} {% endif %} {{ a.logged_by.username|default:"—" }} {{ a.notes|truncatechars:60 }}
{% csrf_token %}
No absences match the filters.
{# === Pagination — only shown when there's more than one page === #} {% if page.has_other_pages %} {% endif %}
{# Reason badge colours live in static/css/custom.css under #} {# "/* === Absence reason badges === */" — single source of truth shared #} {# between this list and the Absences tab on /workers//. #} {% endblock %}