{% extends "base.html" %}
{% load i18n inline_formset %}
{% load url from future %}
{% block content %}
<h2>{{page_name}}</h2>
<div class='form'>
{% if not object_list %}
<p>{% trans "No pending imports." %}</p>
{% else %}
<form action="." method="post">{% csrf_token %}
<table>
<tr>
  <th>{% trans "Type" %}</th>
  <th>{% trans "File" context "file" %}</th>
  <th>{% trans "Creation" %}</th>
  <th>{% trans "Status" %}</th>
  <th>{% trans "Action" %}</th>
</tr>
{% for import in object_list %}
<tr>
  <td>
    {{import.importer_type}}
  </td>
  <td>
    <a href='{{MEDIA_URL}}{{import.imported_file}}'>{% trans "Source file" %}</a>
  </td>
  <td>
    {{import.creation_date}}
  </td>
  <td>
    {{import.status}}
  </td>
  <td>
    <select name='import-action-{{import.pk}}'>
        <option value=''>--------</option>
        {% for action, lbl in import.get_actions %}
        <option value='{{action}}'>{{lbl}}</option>
        {% endfor%}
    </select>
  </td>
  <td>
    {% if import.need_matching %}
    <a href='{% url "import_link_unmatched" import.pk %}'>{% trans "Link unmatched items" %}</a>
    {% endif %}
  </td>
  <td>{% if import.error_file %}
    <a href='{{MEDIA_URL}}{{import.error_file}}'>{% trans "Error file" %}</a>
  {% endif %}</td>
  <td>{% if import.result_file %}
    <a href='{{MEDIA_URL}}{{import.result_file}}'>{% trans "Control file" %}</a>
  {% endif %}</td>
  <td>{% if import.match_file %}
    <a href='{{MEDIA_URL}}{{import.match_file}}'>{% trans "Match file" %}</a>
  {% endif %}</td>
</tr>
{% endfor %}
</table>
    <input type="submit" value="{% trans "Validate" %}"/>
</form>
{% endif %}
</div>
{% endblock %}

