{% extends template_base %}
{% load i18n qommon %}

{% block body %}

{% block form-side %}
{{ form_side|default:"" }}
{{ publisher.get_request.session.display_message|safe }}
{% endblock %}

{% block form-main %}
{% block drafts-recall %}
{% if view.initial_hit and user.is_authenticated and not request.quixote_request.is_in_backoffice %}
{% with formdef.objects.current_user.drafts|order_by:"receipt_time" as drafts %}
  {% with drafts|length as drafts_length %}
   {% if drafts_length > 0 %}
    <div class="drafts-recall">
     <p>
       {% blocktrans %}
       You already started to fill this form. You can continue it or submit a new
       one.
       {% endblocktrans %}
     </p>
     {% if drafts_length == 1 %}
       <p><a class="pk-button" href="{{drafts.0.internal_id}}">{% trans "Continue with draft" %}</a></p>
     {% elif drafts_length > 1 %}
     <ul>
     {% for draft in drafts %}
     <li><a href="{{draft.internal_id}}">{% trans "continue with draft from " %} {{draft.receipt_date}}
                     {{draft.receipt_time}}</a>, {% blocktrans with page_no=draft.page_no|add:1 %}on page {{page_no}}{% endblocktrans %}</li>
     {% endfor %}
     </ul>
     {% endif %}
    </div>
   {% endif %}
  {% endwith %}
{% endwith %}
{% endif %}
{% endblock %}
{{ form.render|safe }}
{% endblock %}

{% endblock %}
