From b7baf88cfc877d28b66d8708ad55c677e0682927 Mon Sep 17 00:00:00 2001 From: Konrad du Plessis Date: Tue, 24 Feb 2026 19:21:56 +0200 Subject: [PATCH] Add worker name pills on history page + per-worker payroll chart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Work History: - Worker names now display as rounded pill badges instead of comma- separated text, making them easier to scan (both server-rendered list view and JS calendar detail view) Payroll Dashboard: - New "By Worker" toggle on the Monthly Payroll chart card - Dropdown to select an active worker with payment history - Stacked bar chart shows monthly breakdown: base pay, overtime, bonuses (positive), deductions, loan repayments, advances (negative) - All data pre-computed server-side with 2 aggregate queries and embedded as JSON — switching workers is instant, no AJAX needed - Only workers with actual payment history appear in the dropdown - Legend items auto-hide when a component has no data for that worker Co-Authored-By: Claude Opus 4.6 --- core/templates/core/payroll_dashboard.html | 237 ++++++++++++++++++++- core/templates/core/work_history.html | 15 +- core/views.py | 93 ++++++++ 3 files changed, 338 insertions(+), 7 deletions(-) diff --git a/core/templates/core/payroll_dashboard.html b/core/templates/core/payroll_dashboard.html index 7873043..a616062 100644 --- a/core/templates/core/payroll_dashboard.html +++ b/core/templates/core/payroll_dashboard.html @@ -114,10 +114,43 @@
-
Monthly Payroll Totals
+ {# === CHART TOGGLE: Overall vs By Worker === #} + {# Two small buttons to switch between the total line chart #} + {# and a per-worker stacked bar chart breakdown. #} +
+
Monthly Payroll
+
+ + +
+
- + {# --- Overall view (default): the existing line chart --- #} +
+ +
+ + {# --- By Worker view (hidden): worker dropdown + stacked bar --- #} +
@@ -641,6 +674,7 @@ {{ chart_labels_json|json_script:"chartLabelsJson" }} {{ chart_totals_json|json_script:"chartTotalsJson" }} {{ project_chart_json|json_script:"projectChartJson" }} +{{ worker_chart_json|json_script:"workerChartJson" }}