{% load i18n ui %}{% comment %} The batch's progress and, once it has finished, its results: polled by htmx (outerHTML swap) while the job is queued or running, as the job page's fragment is. Parameters: run, job, rows (each station: name, state, step, total, stage_label, percent, error_text, skip_lines, zip, zip_size, report, report_size, folder, error_file), counts, total_stations, stage_label, elapsed, remaining, delay, worker_missing, zip_file, zip_size; opened_url for a station already opened as a single station. {% endcomment %}
{% if job.status == "queued" or job.status == "running" %}
{% if job.status == "running" %}{% blocktranslate count counter=total_stations with done=counts.done|add:counts.failed trimmed %}{{ done }} of {{ counter }} station finished{% plural %}{{ done }} of {{ counter }} stations finished{% endblocktranslate %}{% else %}{{ job.get_status_display }}{% endif %} {% if job.total %}{% blocktranslate with percent=job.percent %}{{ percent }}%{% endblocktranslate %}{% endif %}
{% blocktranslate with percent=job.percent %}{{ percent }}%{% endblocktranslate %}

{% if stage_label %}{% blocktranslate with stage=stage_label %}{{ stage }}.{% endblocktranslate %}{% endif %} {% if elapsed %}{% blocktranslate %}Time so far: {{ elapsed }}.{% endblocktranslate %}{% endif %} {% if remaining %}{% blocktranslate %}About {{ remaining }} left.{% endblocktranslate %}{% endif %}

{% if job.cancel_requested %}

{% translate "Cancelling…" %}

{% endif %} {% if worker_missing %} {% translate "No calculation worker is running, so this batch cannot start yet. If you run Climpact yourself, restart it with the climpact-web command." as worker_message %} {% include "components/alert.html" with kind="warning" message=worker_message title="" %} {% endif %} {% if job.can_cancel %}
{% csrf_token %} {% translate "Cancel the batch" as cancel_label %} {% include "components/button.html" with label=cancel_label type="submit" variant="secondary" size="sm" icon="close" %}
{% endif %} {% endif %} {% if job.status == "succeeded" %}
{% if counts.failed or counts.skipped %}{% icon "warning" %}{% else %}{% icon "check-circle" %}{% endif %}

{% blocktranslate count counter=total_stations with done=counts.done trimmed %}{{ done }} of {{ counter }} station calculated{% plural %}{{ done }} of {{ counter }} stations calculated{% endblocktranslate %}

{% blocktranslate %}Finished in {{ elapsed }}.{% endblocktranslate %} {% if counts.failed %}{% blocktranslate count counter=counts.failed trimmed %}{{ counter }} station failed; its error is below.{% plural %}{{ counter }} stations failed; their errors are below.{% endblocktranslate %}{% endif %} {% if counts.skipped %}{% blocktranslate count counter=counts.skipped trimmed %}{{ counter }} station was left out before the run.{% plural %}{{ counter }} stations were left out before the run.{% endblocktranslate %}{% endif %}

{% if zip_file %}

{% blocktranslate with size=zip_size|filesizeformat asvar zip_label %}Download all (zip, {{ size }}){% endblocktranslate %}{% url 'jobs:file' job.pk zip_file as zip_url %}{% include "components/button.html" with label=zip_label href=zip_url icon="download" size="lg" %}

{% endif %} {% endif %} {% if job.status == "failed" %} {% endif %} {% if job.status == "cancelled" %} {% translate "The batch was cancelled." as cancelled_message %} {% include "components/alert.html" with kind="info" message=cancelled_message live="polite" title="" %} {% endif %} {% if job.can_retry %}
{% csrf_token %} {% translate "Try again" as retry_label %} {% include "components/button.html" with label=retry_label type="submit" icon="refresh" %}
{% endif %} {% if rows %}

{% translate "Stations" %}

{% endif %} {% if job.is_finished %}

{% icon "clock" %}{% blocktranslate with date=job.expires_at|date:"j F Y, H:i e" %}The results are deleted on {{ date }}.{% endblocktranslate %}

{% endif %}