{% load i18n %}
<div id="formunculous-subform-container">
  <h3>{% trans "Sub-forms" %}</h3>
  <div class="fr" style="margin-top: -2em;">
	<span class="formunculous_subform_add">
	  {% trans "Add Sub-form" %}
	</span>
  </div>
  <div style="clear:both"></div>
  <table class="formunculous_table">
	<thead>
	  <tr>
		<th>{% trans "Name" %}</th>
		<th>{% trans "Min Entries" %}</th>
		<th>{% trans "Max Entries" %}</th>
		<th>{% trans "Extras" %}</th>
		<th colspan="3">{% trans "Actions" %}</th>
	  </tr>
	</thead>
	<tbody>
	  {% if ad.applicationdefinition_set.all %}
	  {% for subapp in ad.applicationdefinition_set.all %}
	  <tr id="{{ subapp.id }}">
		<td>{{ subapp.name }}</td>
		<td>
		  {{ subapp.subapplicationdefinition_set.get.min_entries }}
		</td>
		<td>
		  {{ subapp.subapplicationdefinition_set.get.max_entries }}
		</td>
		<td>
		  {{ subapp.subapplicationdefinition_set.get.extras }}
		</td>
		<td><a href="#" class="formunculous_changelink" onclick="javascript:show_change_dialog({{subapp.id}});">Change</a></td>
		<td><a href="{% url builder-edit-fields subapp.slug %}" class="formunculous_changelink">Edit Form</a></td>
		<td>
		  <a href="#" class="formunculous_deletelink"
			 onclick="javascript:show_delete_dialog({{subapp.id}});">
			Delete
		  </a>
		</td>
	  </tr>
	  {% endfor %}
	  {% endif %}
	</tbody>
  </table>
</div>
