{% load i18n ui %}{% comment %} The job's progress, polled by htmx (outerHTML swap) while the job is queued or running; polling stops once it has finished. Built from the progress, alert and disclosure components' classes. {% endcomment %}
{% if job.status == "queued" or job.status == "running" %}
{% if stage_label %}{{ stage_label }}{% 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 job.total %}{% blocktranslate with step=job.step total=job.total percent=job.percent %}Step {{ step }} of {{ total }} ({{ percent }}%){% endblocktranslate %}{% else %}{{ job.get_status_display }}{% 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 job 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" 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" %}
{% icon "check-circle" %}

{% translate "The calculation finished" %}

{% blocktranslate %}Finished in {{ elapsed }}.{% endblocktranslate %}

{% if zip_file %}

{% blocktranslate with size=zip_size|filesizeformat asvar zip_label %}Download all results (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 %} {% if files %}
{% icon "folder" %}{% blocktranslate count counter=files|length %}{{ counter }} file{% plural %}{{ counter }} files{% endblocktranslate %}{% icon "chevron-down" %}
    {% for f in files %}
  • {{ f.name }} {{ f.size|filesizeformat }}
  • {% endfor %}
{% endif %} {% endif %} {% if job.status == "failed" %} {% endif %} {% if job.status == "cancelled" %} {% translate "The calculation 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 job.is_finished %}

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

{% endif %}