{# The health card — crate::pages::admin::ecb::ui::StatusFragment, and what ecb.html embeds on first load. It carries its own poll trigger rather than the page carrying it, so the trigger travels with each swap: while a batch is running the card asks for itself every few seconds, and the card that comes back after the batch finishes has no trigger, which is what stops the polling. #}

{{ page.headline() }} {% if page.import_running %}import running{% endif %}

{{ page.explanation() }}

{# The question a reader came with. Coverage is a publication date, and turning it into "which transaction dates will post" means applying the rule the backend applies -- so the backend applies it and sends both bounds, rather than the page inviting the reader to do it in their head. #}

What can be posted right now

{% if let Some(through) = page.transactions_postable_through %}
Ordinary transactions
dated up to and including {{ through }}
Converted at the rate published the business day before the transaction.
Statements & decisive dates
dated up to and including {{ page.statements_postable_through.as_deref().unwrap_or("—") }}
Converted at the rate published on that day, or the last business day before it.

A foreign-currency amount dated after its limit is refused outright until the importer catches up — it is not converted at a stale rate.

{% else %}

Nothing. No publication has ever been verified, so every foreign-currency amount is refused whatever its date.

{% endif %}
{# Coverage first and on its own line: the two dates and the gap between them are the whole answer, and burying them in a four-column grid made them read as trivia. #}
Verified through {%- if let Some(date) = page.verified_through_date %}{{ date }} {%- else %}never{% endif -%}
{%- if page.healthy %}up to date {%- else if page.days_behind > 0 %}{{ page.days_behind }} publication day{% if page.days_behind != 1 %}s{% endif %} behind {%- else %}no coverage{% endif -%}
Should reach {{ page.latest_verifiable_date }}
Last attempt
{% if let Some(when) = page.last_attempt() %}{{ when }}{% else %}none recorded{% endif %}
Last success
{% if let Some(when) = page.last_success() %}{{ when }}{% else %}none{% endif %}
Next import
{{ page.next_import() }}
Currencies on {% if let Some(date) = page.verified_through_date %}{{ date }}{% else %}the covered day{% endif %}
{%- if page.covered_currencies.is_empty() %}none {%- else %}{{ page.covered_currencies.len() }}{% endif -%}
{% if !page.covered_currencies.is_empty() %}
{% for currency in page.currencies() %}{{ currency }}{% endfor %}
{% endif %} {% if let Some(failure) = page.last_failure() %}

Most recent failure — batch {{ failure.batch_id }}, started {{ failure.started() }}: {% if let Some(message) = failure.error_message %}{{ message }}{% else %}no reason was recorded.{% endif %}

{% endif %}