{% extends app.request.xmlHttpRequest ? 'form.html.twig' : 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}

{% block page_title %}{{ 'menu.export'|trans }}{% endblock %}

{% block main %}
    {% if stats.count > 1000 %}
        {{ widgets.alert('warning', ('export.warn_result_amount'|trans({'%count%': stats.count})), null, 'warning') }}
    {% endif %}
    {% set formEditTemplate = app.request.xmlHttpRequest ? 'default/_form_modal.html.twig' : 'default/_form.html.twig' %}
    {% set formOptions = {
        'title': 'menu.export'|trans,
        'form': form,
        'back': path(route_back),
        'formStartOptions': {'attr': {'class': 'form-narrow searchform', 'target': '_blank'}},
    } %}
    {% embed formEditTemplate with formOptions %}
        {% form_theme form 'form/search-form.html.twig' %}
        {% block modal_size %}{% endblock %}
        {% block form_body %}
            {{ form_widget(form) }}
        {% endblock %}
        {% block submit_button %}
            <div class="btn-group pull-left" role="group">
            {% for exp in exporter %}
                <button id="export-btn-{{ exp.id }}" formtarget="_blank" type="submit" name="exporter" value="{{ exp.id }}" class="btn btn-primary" data-loading-text="{{ ('button.' ~ exp.id)|trans }}…">{{ ('button.' ~ exp.id)|trans }}</button>
            {% endfor %}
            </div>
        {% endblock %}
    {% endembed %}
{% endblock %}
