{% form_theme form with admin_form_themes() only %}
<div {{ attributes }}>
  {% if searchType %}
    {% if form['submit'] is defined %}
      {{
        form_start(form, { attr: {
        'data-action': 'live#action:prevent',
        'data-live-action-param': 'debounce(300)|filter',
        'novalidate': 'true'
      }}
      ) }}
    {% else %}
      {{
        form_start(form, { attr: {
        'data-action': 'input->live#action:prevent change->live#action:prevent',
        'data-live-action-param': 'debounce(300)|filter',
        'novalidate': 'true'
      }}
      ) }}
    {% endif %}

    <div class="relative flex flex-col gap-3 rounded-md bg-transparent py-4 md:flex-row md:items-center">
      <div class="flex w-full flex-row gap-3">
        {{ form_row(form.query, { label : false }) }}
        <twig:SerenityAdmin:Modal:FormModal
          icon="{{ modalIcon ?? null }}"
          modalButton="{{ modalButton?? null }}"
          title="{{ modalTitle ?? 'Title' }}"
          closeButton="{{ modalCloseButton ?? false }}"
          modal:class="max-w-2xl"
          loading="lazy">
          <twig:block name="form_modal_button">
            {% if modalButton is defined %}
              <button
                type="button"
                class="inline-flex w-fit cursor-pointer items-center rounded border border-gray-300 px-4 py-2 text-black hover:bg-gray-400 dark:border-gray-400 dark:text-gray-300 dark:hover:bg-gray-700">
                <span>{{ modalButton }}</span>
              </button>
            {% endif %}
          </twig:block>
          <twig:block name="form_modal_content">{{ block(outerBlocks.form_modal_content) }}</twig:block>
        </twig:SerenityAdmin:Modal:FormModal>
      </div>

      <!-- Filter button + dropdown -->
      {% if form.sorter is defined %}
        {{ form_widget(form.sorter, { label : false, attr: { 'class' : 'w-full md:w-auto '} }) }}
      {% endif %}
      {% if form['submit'] is defined %}
        {#
        <button
          type="submit"
          class="bg-primary hover:bg-primary-hover focus-visible:outline-primary cursor-pointer rounded-md px-3 py-2 text-sm font-semibold text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"
          data-loading="addClass(opacity-50 disabled cursor-not-allowed)">
          {{ form.submit.vars.label }}
        </button>
        #}
        {{ form_widget(form.submit) }}
      {% endif %}
    </div>
    {{ form_end(form) }}
  {% endif %}
  <twig:block name="template"></twig:block>
  {% if items.totalItemCount > items.itemNumberPerPage %}
    <div class="flex justify-end p-6">
      {{ knp_pagination_render(items, '@extends/SerenityAdmin/pagination.html.twig') }}
    </div>
  {% endif %}
</div>
