{% extends "base.html" %} {% import "_bank.html" as bank with context %} {% block title %}{{ t('statements.title') }} — painfree{% endblock %} {% block body %}

{{ t('statements.heading') }}

{{ t('statements.lede') }}

{# Two halves rather than two pages: they arrive from the same schedules and an operator looking for "did anything come back" wants one place to look. The columns are different because the questions are. #} {% set filters = ('&connection_id=' ~ selected_connection if selected_connection else '') ~ ('&message_type=' ~ selected_type if selected_type else '') %}

{{ t('statements.tab_accounts') }} {{ counts.get('account') | count }} {{ t('statements.tab_responses') }} {{ counts.get('response') | count }}

{% if not statements %}

{{ t('statements.empty') }}

{% elif family == 'response' %} {# What the bank said, and about which order. No amount and no counterparty: the index is held to the rule the webhook envelope is, and the money is one click away on the report itself. #} {% for row in statements %} {% set code = status_codes.get(row.outcome.status or '') %} {% endfor %}
{{ t('statements.reports_on') }}{{ t('order.status') }} {{ t('order.accepted_count') }} {{ t('order.rejected_count') }} {{ t('order.reason') }}{{ t('response.received') }}
{% if row.order_id %}{{ row.order_id }} {% else %}{{ t('response.unmatched_heading') }}{% endif %}
{{ row.statement_id }}
{% if row.outcome.status %} {{ row.outcome.status }}
{{ code.name if code else t('response.unknown_status') }} {% else %}{{ t('response.not_reported') }}{% endif %}
{{ row.outcome.accepted | count }} {{ row.outcome.rejected | count }} {% if row.outcome.reason_code %}{{ row.outcome.reason_code }} {% endif %} {{ bank.quiet(row.outcome.reason_text) }} {{ row.ingested_at | moment }}
{% else %} {# An account and its balances. The statement id is how the service names the row and matters once you already have the right one, so it is not what the eye lands on. #} {% for row in statements %} {% endfor %}
{{ t('statements.account') }}{{ t('statement.period') }} {{ t('statements.closing_balance') }} {{ t('statements.entries') }} {{ t('statements.type') }}{{ t('order.ingested') }}
{{ row.iban or '—' }} {% if row.currency %}{{ row.currency }}{% endif %}
{{ row.connection_id }} {{ row.statement_id }}
{% if row.from_datetime %}{{ row.from_datetime | day }} → {{ row.to_datetime | day }} {% else %}{{ row.ingested_at | day }}{% endif %} {% if row.sequence_number %}
{{ t('statement.sequence') }} {{ row.sequence_number }}{% endif %}
{% if row.closing_balance is not none %}{{ row.closing_balance | amount(row.currency) }}{% else %}—{% endif %} {{ row.entry_count | count }} {{ row.message_type }} {{ row.ingested_at | moment }}
{% endif %}
{% endblock %}