{# @var host \Ferienpass\CoreBundle\Entity\Host #}

{% set itemClasses = 'group flex items-center mx-1 my-0.5 border-0 rounded-md px-2 py-1.5 text-sm leading-5 font-normal text-gray-700 dark:text-gray-100/70 hover:bg-gray-100 dark:hover:bg-gray-900 hover:text-gray-900 dark:hover:text-gray-100' %}

{% set routeParams = app.request.attributes.get('_route_params')|default({})|merge({ filter: { host: host.alias } }) %}

<span {{ stimulus_controller('ferienpass/admin-chip-menu') }}
      data-action="click@window->ferienpass--admin-chip-menu#closeIfOutside keydown@window->ferienpass--admin-chip-menu#closeOnEscape"
      oncontextmenu="event.stopPropagation()"
      class="inline-block relative align-baseline">
    <button type="button"
            data-action="ferienpass--admin-chip-menu#toggle"
            class="cursor-pointer inline-flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-100 rounded-md px-1.5 py-0.5 -mx-1.5 -my-0.5 transition-colors">
        {{ host.name }}
    </button>
    <div {{ stimulus_target('ferienpass/admin-chip-menu', 'menu') }}
         hidden
         class="absolute left-0 mt-2 z-20 w-64 rounded-md bg-white dark:bg-gray-950 shadow-lg outline-1 outline-black/5 dark:outline-white/10 py-1">
        <a href="{{ path('admin_hosts_show', { uuid: host.uuid.toBase58 }) }}"
           data-turbo-frame="slideover"
           class="{{ itemClasses }}">
            <span class="mr-2 size-4 flex-shrink-0">{{ ux_icon('ph:eye') }}</span>
            <span class="text-left leading-tight">Veranstalter ansehen</span>
        </a>
        <a href="{{ path('admin_offers_index', routeParams) }}"
           class="{{ itemClasses }}">
            <span class="mr-2 size-4 flex-shrink-0">{{ ux_icon('ph:funnel') }}</span>
            <span class="text-left leading-tight">Nach Veranstalter filtern …</span>
        </a>
    </div>
</span>
