{% extends 'assets/base.html' %}
{% load bob %}
{% load icons %}
{% load i18n %}

{% block content %}
<div id="float_toolbar">
  <a id="fill_all_rows" href="#" title="Fill all rows">
    {% icon 'fugue-pencil--plus' %}
  </a>
</div>
<div class="row">
  <hgroup>
    <h3>{% trans "Add attachment:" %}</h3>
  </hgroup>
</div>

<ul class='markerless-list'>
{% for parent in selected_parents %}
  <li>{{parent}}</li>
{% endfor %}
</ul>

<form method="POST" class="form form-inline form-split" enctype="multipart/form-data">
  {% csrf_token %}
  {{ formset.management_form }}
  <div class="row">
    <table class="table table-striped table-bordered table-condensed">
      <thead><tr>
        <th></th>
        <th>{% trans "File" %}</th>
      </tr></thead>
      <tbody>
        {% for form in formset %}
          <tr>
            <td style="vertical-align:middle" class="ordinal" data-no="{{ forloop.counter }}">
              {{ forloop.counter }}
            </td>
            {% for field in form.visible_fields %}
              <td class="control-group{% if "-support_period" in field.html_name %} small{% endif %}{% if field.errors %} error{% endif %}" style="vertical-align:middle">
                {% if field.errors %}
                  <span class="help-inline">{% for error in field.errors %}{{ error }} {% endfor %}</span>
                {% endif %}
                {{ field }}
              </td>
            {% endfor %}
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
    <div class="row" style="margin-top:10px;">
      <a href="#" class="btn btn-success add_row">+</a>
    </div>
  <div class="row">
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
    </div>
  </div>
</form>
{% endblock %}
