used by BOTH the flat Adjustments view and (later) the grouped view.
Context:
- `adj` — a PayrollAdjustment instance
- `additive_types` — list of type labels that are additive (used to decide
whether the amount should be prefixed with + or - in the display)
Row actions differ based on whether the adjustment has already been paid:
- Paid -> single [View Payslip] icon button
- Unpaid -> three buttons: [Preview][Edit][x]
(these reuse the existing modals on the dashboard — no new JS)
#}
{% load format_tags %}
{# --- Bulk-select checkbox --- #}
{# Paid rows show a disabled checkbox so the column stays aligned; #}
{# only unpaid rows can be bulk-selected for deletion (feature comes in Task 6). #}
{% if adj.payroll_record %}
{% else %}
{% endif %}
{# --- Date --- #}
{{ adj.date|date:"d M Y" }}
{# --- Worker name (clickable link to the worker profile page) --- #}
{# --- Team (worker's first team, if any — many workers are unteamed) --- #}
{# Uses `teams.all` (NOT `teams.first`) because the view's #}
{# .prefetch_related('worker__teams') populates `_prefetched_objects_cache` #}
{# for `.all()` calls — `.first()` would ignore the cache and fire a #}
{# fresh `ORDER BY ... LIMIT 1` SQL query per row (up to ~50 per page). #}
{% with teams=adj.worker.teams.all %}
{% if teams %}{{ teams.0.name }}{% else %}—{% endif %}
{% endwith %}
{# --- Description (truncated; full text shown in a hover tooltip) --- #}
{# --- Row actions (eye + pen + x for unpaid; eye only for paid) --- #}
{% if adj.payroll_record %}
{# PAID: view payslip only #}
{% else %}
{# UNPAID: preview + edit + delete #}
{# Preview button — class .preview-payslip-btn is already wired up in the
main dashboard JS (opens the preview modal for this worker). #}
{# Edit button — class .adjustment-badge is already wired up in the
main dashboard JS (populates + opens #editAdjustmentModal). We reuse
it here so no new JS is needed for editing. #}
{# Delete button — opens the existing #deleteConfirmModal directly
(short-circuits the edit modal's usual two-step flow). #}
{% endif %}