{% load i18n %}
{{ formset.management_form }}
{% for error in formset.non_form_errors %}
  <div class="alert alert-error error">{{ error }}</div>
{% endfor %}
<div class="row register-nodes-formset" id="formset-{{ formset.prefix }}">
  <div class="col-xs-5">
    <div class="clearfix register-nav-head">
      <a class="node-icon" data-toggle="collapse" href="#collapse-upload-form">
        <i class="fa fa-lg fa-upload"></i>
      </a>
      <a id="add-node-link" class="node-icon" href="#">
        <i class="fa fa-lg fa-plus"></i>
      </a>
      <h4>Nodes to register</h4>
    </div>
    <div id="collapse-upload-form" class="panel-collapse collapse">
      {% include 'infra_optim/nodes/_upload.html' with form=upload_form %}
    </div>
    <ul class="nav nav-pills nav-stacked">
      {% for form in formset %}
      <li {% if forloop.first %}class="active"{% endif %}>
        <a href="#tab-{{ form.prefix }}" data-toggle="tab">
          {{ form.get_name }}
        </a>
      </li>
      {% endfor %}
    </ul>
  </div>
  <div class="col-xs-7">
    <div class="tab-content">
      {% for form in formset %}
        {% include form_template with form=form active=forloop.first %}
      {% endfor %}
    </div>
  </div>
</div>
<script type="text/javascript">
(window.$ || window.addHorizonLoadEvent)(function () {
  var prefix = '{{ formset.prefix|escapejs }}';
  var empty_form_html = '{% filter escapejs %}{% include form_template with form=formset.empty_form %}{% endfilter %}';
  watcher.menu_formset.init(prefix, empty_form_html);
});
</script>
