{% load django_listing i18n %}
{% get_uniq_id as uniq_id %}
{% listing_has_permission_for_action listing "export" as has_export_perm %}
{% if has_export_perm %}
    <div class="btn-group me-2 toolbar_item {{ item.css_class }}" role="group">
        <form method="POST" id="toolbar-item-{{ uniq_id }}-form-id" class="form-inline">
            {% csrf_token %}
            {% gethiddens_listing listing without=item.select_name %}
            {% if item.label %}
                <label class="visually-hidden" for="toolbar-item-{{ uniq_id }}-select-id">{{ item.label }}</label>
            {% endif %}
            <div class="input-group input-group-sm me-sm-2">
            {% if item.label %}
                <span class="input-group-text">{{ item.label }}</span>
            {% endif %}
                <select id="toolbar-item-{{ uniq_id }}-select-id"
                        name="{{ item.select_name}}{{ listing.suffix }}"
                        class="custom-select form-select pr-4"
                        {% if not listing.accept_ajax and not item.has_submit_button %}
                        onchange="document.getElementById('toolbar-item-{{ uniq_id }}-form-id').submit()"
                        {% endif %}
                >
                    {% for key,label,selected in item.selected_choices %}
                        <option value="{{ key }}" class="listing-icon-up-open"{% if selected %} selected{% endif %}>{{ label }}</option>
                    {% endfor %}
                </select>
                {% if item.has_submit_button %}
                    <button type="submit" class="btn btn-secondary btn-sm ms-1 file-generation-button" data-empty-select-msg="{% trans "Please select a file format !" %}">{{ item.button_label }}</button>
                {% endif %}
            </div>
        </form>
    </div>
{% endif %}