{% extends 'base.html.twig' %} {% block title %}Debts{% endblock %} {% block content %} {# ── Stat cards ── #}
📉 Joint Debt Remaining
£{{ jointTotal|number_format(2) }} {% if periodPayments > 0 %} ▼ £{{ periodPayments|number_format(2) }} {% endif %}
{% if periodPayments > 0 %} Reduced by £{{ periodPayments|number_format(2) }} this period {% else %} No payments logged this period yet {% endif %}
💳 Active Joint Debts
{{ jointDebts|length }}
across all types
🏦 Net Worth Tracker
incl. savings & equity
{% macro debtSection(sectionTitle, sectionIcon, sectionDebts, recentExpenses) %} {% if sectionDebts|length > 0 %}

{{ sectionIcon }} {{ sectionTitle }}

{{ sectionDebts|length }} debt{{ sectionDebts|length != 1 ? 's' : '' }}
{% for debt in sectionDebts %}

{{ debt.label }}

{% if debt.creditor %}

{{ debt.creditor }}

{% endif %}
{% if debt.isPersonal %}🔒 Personal{% endif %} Edit
{# Credit card: show utilization bar; others: show paid% bar #} {% if debt.type == 'credit_card' and debt.utilizationPercent is not null %} {% set util = debt.utilizationPercent %}
£{{ debt.remainingAmount|number_format(2) }} of £{{ debt.creditLimit|number_format(2) }} limit
{{ util }}% utilised
{% else %}
£{{ debt.remainingAmount|number_format(2) }} remaining of £{{ debt.totalAmount|number_format(2) }}
{{ debt.paidPercent }}% paid
{% endif %}
{% if debt.interestRate %}{{ debt.interestRate }}% APR{% endif %} {% if debt.monthlyPayment %}£{{ debt.monthlyPayment|number_format(2) }}/mo{% endif %} {% if debt.monthsRemaining is not null %} {{ debt.monthsRemaining }} month{{ debt.monthsRemaining != 1 ? 's' : '' }} left {% endif %} {% if debt.dueDate %} Settled {{ debt.dueDate|date("M Y") }} {% elseif debt.estimatedPayoffDate %} Paid off {{ debt.estimatedPayoffDate|date("M Y") }} {% endif %} {% if debt.linkedExpenseDescription %} 🔗 {{ debt.linkedExpenseDescription }} {% endif %}
{# Payment form #}
{% if recentExpenses|length > 0 %}
{% endif %}
{% if debt.payments|length > 0 %}
Payment history ({{ debt.payments|length }})
    {% for p in debt.payments|slice(0, 10) %}
  • {{ p.date|date("d M") }} {{ p.user.name }} -£{{ p.amount|number_format(2) }} {% if p.linkedExpense %}🔗 {{ p.linkedExpense.description }}{% endif %} {% if p.note %}{{ p.note }}{% endif %}
  • {% endfor %}
{% endif %}
{% endfor %}
{% endif %} {% endmacro %} {# ── Joint Debts ── #} {% if jointDebts|length > 0 %} {{ _self.debtSection('Loans', '🏦', debtsByType.loan, recentExpenses) }} {{ _self.debtSection('Credit Cards', '💳', debtsByType.credit_card, recentExpenses) }} {{ _self.debtSection('Buy Now Pay Later', '🛍️', debtsByType.bnpl, recentExpenses) }} {% else %}

No joint debts tracked. 🎉

Track a debt
{% endif %} {# ── Personal Debts ── #} {% if personalDebts|length > 0 %}

🔒 My Personal Debts

£{{ personalTotal|number_format(2) }} — not in joint total

These debts are private to you. Full details also visible in Personal →

{{ _self.debtSection('Loans', '🏦', personalByType.loan, recentExpenses) }} {{ _self.debtSection('Credit Cards', '💳', personalByType.credit_card, recentExpenses) }} {{ _self.debtSection('Buy Now Pay Later', '🛍️', personalByType.bnpl, recentExpenses) }} {% endif %} {% endblock %}