{% load i18n forms %}

<fieldset class="inline responsive-inline {{ class_names|join:' ' }}">
	{% block inline-title %}{% if title %}<legend>{{ title }}</legend>{% endif %}{% endblock %}
	{{ formset.management_form }}
	<div class="form">
		{% if formset.all_forms %}
			{% for form in formset.all_forms %}
				{% if forloop.first %}
					{% block inline-thead %}
						<div class="inline-header form-inline">
							{% for field_name in fieldset %}
								{% get_field form field_name as field %}
								{% if not field.is_hidden %}
									<div class="form-group col-{{ forloop.counter }} {{ field_name }}">
										{{ field.label|capfirst }}
										{% if field.field.required %}
											<span class="required">*</span>
										{% endif %}
									</div>
								{% endif %}
							{% endfor %}
						</div>
					{% endblock %}
				{% endif %}
				<div class="inline-line form-inline {% cycle 'odd' 'even' %} {{ form.class_names|join:' ' }}">
					{% get_visible_fields form fieldset as visible_fields %}
					{% for field in visible_fields %}
						<div class="col-{{ forloop.counter }} form-group field {{ field.name }}{% if field.errors %} error{% endif %}">
							{# Include the hidden fields in the form #}
							{% if forloop.first %}
								{% for hidden in form.hidden_fields %}
									{{ hidden }}
								{% endfor %}
								{{ form.non_field_errors }}
							{% endif %}
							{{ field }}
							{{ field.errors.as_ul }}
						</div>
					{% endfor %}
				</div>
			{% endfor %}
		{% elif not formset.can_add %}
			<div class="no-inline-items alert alert-info">
				{{ no_items_text }}
			</div>
		{% endif %}
	</div>
	{% if formset.can_add %}<button type="button" class="dynamic btn btn-default">{{ button_value|capfirst }}</button>{% endif %}
</fieldset>
