{# One change report card (Bootstrap styled). Generic contract (also usable for snapshot-import reports): `report` is a dict with keys id, created_at, action, rule_id (optional), rule_label (optional), diff (list of {field, before, after}), summary (dict of counts), txn_changes (list of {transaction_id, description, link, old_category, new_category, old_tags, new_tags}). #}
{% if report.action == 'create' %} Created {% elif report.action == 'update' %} Updated {% elif report.action == 'delete' %} Deleted {% elif report.action == 'toggle' %} Toggled {% elif report.action in ['recategorize', 'recategorize-all'] %} Recategorized {% elif report.action == 'import' %} Imported {% else %} {{ report.action }} {% endif %} {% if report.rule_id %} Rule #{{ report.rule_id }} {% elif report.rule_label %} (Rule deleted) {% endif %} {% if report.rule_label %} {{ report.rule_label }} {% endif %}
{{ report.created_at.strftime('%Y-%m-%d %H:%M') if report.created_at else '' }}
{% if report.diff %}
{% for d in report.diff %} {% endfor %}
Field Before After
{{ d.field }} {{ d.before if d.before is not none else '—' }} {{ d.after if d.after is not none else '—' }}
{% endif %} {% if report.summary %}
{% for key, value in report.summary.items() %} {{ key }}: {{ value }} {% endfor %}
{% endif %} {# Show transfer rule badge if the rule's category contains "transfer" #} {% if report.rule_label and 'transfer' in report.rule_label.lower() %}
Affects: transfers
{% endif %} {% if report.txn_changes %}
Changed transactions ({{ report.txn_changes|length }})
{% for item in report.txn_changes %} {% endfor %}
Transaction Category Tags
{% if item.link %} {{ (item.description or item.transaction_id)[:60] }} {% else %} {{ (item.description or '')[:60] }} {% endif %}
{{ item.transaction_id }}
{{ item.old_category or '—' }} {{ item.new_category or '—' }} {{ item.old_tags or '—' }} {{ item.new_tags or '—' }}
{% else %}

No transactions changed.

{% endif %}