diff --git a/core/templates/core/payroll_dashboard.html b/core/templates/core/payroll_dashboard.html index 011fbe8..f224fae 100644 --- a/core/templates/core/payroll_dashboard.html +++ b/core/templates/core/payroll_dashboard.html @@ -342,7 +342,7 @@ Overdue {% endif %} {% if wd.has_loan %} - Loan + Loan {% endif %} {% endif %} @@ -353,11 +353,9 @@ {# Show each pending adjustment as a badge #} {% for adj in wd.adjustments %} - {# Badge colour logic: #} - {# GREEN = earned money (Bonus, Overtime) or debt recovery (Loan/Advance Repayment) #} - {# YELLOW = loan-related outflow (New Loan, Advance Payment) — matches the Loan tag #} - {# RED = deductions (Deduction) #} - - {% if adj.type == 'Bonus' or adj.type == 'Overtime' or adj.type == 'New Loan' or adj.type == 'Advance Payment' %}+{% else %}-{% endif %}R{{ adj.amount|floatformat:2 }} + {% if adj.type in additive_types %}+{% else %}-{% endif %}R{{ adj.amount|floatformat:2 }} {{ adj.get_type_display }} {% if adj.project %}({{ adj.project.name }}){% endif %} @@ -450,7 +448,7 @@ {% for adj in record.adjustments.all %} - + {{ adj.get_type_display }}: R {{ adj.amount|floatformat:2 }} {% empty %} diff --git a/core/views.py b/core/views.py index 86bacbb..19b87c0 100644 --- a/core/views.py +++ b/core/views.py @@ -3080,6 +3080,10 @@ def payroll_dashboard(request): 'all_teams': all_teams, 'team_workers_map_json': team_workers_map, 'adjustment_types': PayrollAdjustment.TYPE_CHOICES, + # List of type labels that ADD to a worker's pay (Bonus, Overtime, + # New Loan, Advance Payment). Used by the Pending and History tabs' + # adjustment badges to show a + or - sign next to the amount. + 'additive_types': list(ADDITIVE_TYPES), 'active_projects': active_projects, 'loans': loans, 'loan_filter': loan_filter, diff --git a/static/css/custom.css b/static/css/custom.css index 9651820..829d5b3 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1940,6 +1940,16 @@ body, .card, .modal-content, .form-control, .form-select, .badge-type-advance-payment { background: var(--badge-advance-bg); color: var(--badge-advance-fg); } .badge-type-advance-repayment { background: var(--badge-advance-rep-bg); color: var(--badge-advance-rep-fg); } +/* --- Status flags that borrow a type's colour for semantic consistency. + "Has an active loan or advance" -> Loan-type amber/yellow, so the + worker flag on the Pending tab visually matches the Adjustments + type badge for Loan. Keeps the Loan colour family unified across + the app regardless of which tab you're looking at. --- */ +.loan-flag-badge { + background: var(--badge-loan-bg); + color: var(--badge-loan-fg); +} + /* --- Sticky filter bar (keeps filters visible as the table scrolls) --- */ .adjustments-filter-bar { position: sticky;