
{% import 'appbuilder/general/lib.html' as lib %}

<form action="" method="post" enctype="multipart/form-data">
	{{form.hidden_tag()}}
	
	{% if fieldsets %}
	{% for fieldset_item in fieldsets %}
		{% if fieldset_item[1].get('expanded') == None %}
			{% set expanded = True %}
		{% else %}
			{% set expanded = fieldset_item[1].get('expanded') %}
		{% endif %}
		{% call lib.accordion_tag(loop.index,fieldset_item[0], expanded) %}
			<div class="table-responsive">
				<table class="table table-bordered">
				{% for item in fieldset_item[1].get('fields') %}
						{% if item not in exclude_cols %}
							<tr>{{ lib.render_field(form[item]) }}</tr>
						{% endif %}
        		{% endfor %}
        		</table></div>
        {% endcall %}
	{% endfor %}
	{% else %}
	
	<div class="table-responsive">
		<table class="table table-bordered">
        		{% for field in form %}
        			{% if field.name not in exclude_cols %}
                			<tr>{{ lib.render_field(field) }}</tr>
                		{% endif %}
        		{% endfor %}
        	</table>
	</div>
	{% endif %}
	
	{{ lib.render_form_controls() }}
</form>
