{% extends "wcs/backoffice/base.html" %}
{% load i18n %}

{% block appbar %}
<div id="appbar">
<h2>{% trans "Import CSV" %}</h2>
</div>
{% endblock %}

{% block content %}
{% if job %}

{% if unsupported_fields %}
{% for field in unsupported_fields %}
<div class="warningnotice">
  {% blocktrans with label=field.label description=field.description %}
  Column {{ label }} will be ignored: type {{ description }} not supported.
  {% endblocktrans %}
</div>
{% endfor %}
{% endif %}

<dl class="job-status">
  <dt>{{ job.label }}</dt>
  {% if warnings %}
  <dt>
    {% for warning in warnings %}
    <div class="warningnotice">{{ warning }}</div>
    {% endfor %}
  </dt>
  {% endif %}
  <dd><span class="afterjob" id="{{ job.id }}">{% trans job.status %}</span></dd>
</dl>
<div class="done">
  <a data-redirect-auto="true" href=".">{% trans "Back to Listing" %}</a>
</div>
{% else %}

{% if required_fields %}
<div class="errornotice">
  <p>
  {% blocktrans count fields=required_fields|length with labels=required_fields|join:", " %}
  {{ labels }} is required but cannot be filled from CSV.
  {% plural %}
  {{ labels }} are required but cannot be filled from CSV.
  {% endblocktrans %}
  </p>
</div>
{% else %}
<p>{% trans "You can add data to this card by uploading a file." %}</p>
<p><a href="data-sample-csv">{% trans "Download sample file for this card" %}</a></p>
{{ form.render|safe }}
{% endif %}
{% endif %}
{% endblock %}
