{% set form = _args.form %}
{% form_theme form '@ui2022/forms/themes/filtering.html.twig' %}
<div class="table__filter">
{{ form_start(form, {
action: form.vars.action ?: path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')),
}) }}
<div class="row align-items-center">
<div class="col-12 col-sm-auto">
{% block filter %}
{% if form.filter is defined and form.filter %}
{{ form_widget(form.filter) }}
<script type="text/javascript">
(function (window, document, $, undefined) {
$(function () {
$('#{{ form.filter.vars.id }}').on('change', function (e) {
if ($(e.currentTarget).val()) {
$('#{{ form.vars.id }}').submit();
}
});
});
})(window, document, jQuery);
</script>
{% endif %}
{% endblock %}
</div>
<div class="col-12 col-sm-auto ml-sm-auto">
{{ form_rest(form) }}
</div>
</div>
{{ form_end(form) }}
</div>