{% extends 'layout/app.html.twig' %}
{% block PAGE_CSS %}
{% endblock %}
{% block CONTENT_MID %}
<div x-data="{ showMobileFilter: false }">
<div x-cloak x-show="showMobileFilter" class="relative z-40 lg:hidden" role="dialog" aria-modal="true">
<div x-transition:enter="transition-opacity ease-linear duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="transition-opacity ease-linear duration-300"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
class="fixed inset-0 bg-black bg-opacity-25"></div>
<div class="fixed inset-0 z-40 flex">
<div x-transition:enter="transition ease-in-out duration-300 transform"
x-transition:enter-start="translate-x-full"
x-transition:enter-end="translate-x-0"
x-transition:leave="transition ease-in-out duration-300 transform"
x-transition:leave-start="translate-x-0"
x-transition:leave-end="translate-x-full"
class="relative ml-auto flex h-full w-full max-w-xs flex-col overflow-y-auto bg-white py-4 pb-6 shadow-xl">
<div class="flex items-center justify-between px-4">
<h2 class="text-lg font-medium text-gray-900">Filters</h2>
<button @click="showMobileFilter = false" type="button" class="-mr-2 flex h-10 w-10 items-center justify-center p-2 text-gray-400 hover:text-gray-500">
<span class="sr-only">Close menu</span>
<!-- Heroicon name: outline/x-mark -->
<svg class="h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<!-- Filters -->
<form id="mobileFilters" class="mt-4">
<div class="space-y-2 px-4">
{% if(currentFilter|length > 0) %}
{% for key,filter in currentFilter %}
{% if(filter is not null and filter is not empty) %}
{% if filter is iterable %}
{% for f in filter %}
<button data-filter="{{ (key ~ f)|replace({' ': ''}) }}" type="button" class="removeMobileFilter w-full inline-flex items-center py-2 px-3 bg-gray-100 hover:bg-brand-50 text-sm font-medium text-gray-600 hover:text-brand-600 border border-transparent hover:border-brand-600 rounded-md space-x-2 cursor-pointer select-none transition ease duration-300 group text-left">
<span class="flex-shrink-0">
<svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
<path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
</svg>
</span>
<span>
{{ ('general.filter.' ~ key)|lower|trans }}: {{ (f)|lower|trans }}
</span>
</button>
{% endfor %}
{% else %}
<button data-filter="{{ (key ~ filter)|replace({' ': ''}) }}" type="button" class="removeMobileFilter w-full inline-flex items-center py-2 px-3 bg-gray-100 hover:bg-brand-50 text-sm font-medium text-gray-600 hover:text-brand-600 border border-transparent hover:border-brand-600 rounded-md space-x-2 cursor-pointer select-none transition ease duration-300 group text-left">
<span class="flex-shrink-0">
<svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
<path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
</svg>
</span>
<span>
{{ ('general.filter.' ~ key)|lower|trans }}: {{ (filter)|lower|trans }}
</span>
</button>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div>
<div class="mt-4">
<div class="divide-y divide-gray-200">
{% if(filterDefinition.filters|length > 0) %}
{% for filter in filterDefinition.filters %}
{% set filterMarkup = filterService.filterFrontend(filter, productListing, currentFilter) %}
{{ filterMarkup | raw }}
{% endfor %}
{% endif %}
</div>
</div>
</form>
</div>
</div>
</div>
<nav aria-label="Breadcrumb" class="pt-4">
<ol role="list" class="mx-auto flex max-w-2xl items-center space-x-2 px-4 sm:px-6 lg:max-w-7xl lg:px-8">
<li>
<div class="flex items-center">
<a href="/" class="mr-2 text-sm font-medium text-gray-900">Home</a>
<svg width="16" height="20" viewBox="0 0 16 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" class="h-5 w-4 text-gray-300">
<path d="M5.697 4.34L8.98 16.532h1.327L7.025 4.341H5.697z" />
</svg>
</div>
</li>
<li class="text-sm">
<a href="{{ navStartNode }}" aria-current="page" class="font-medium text-brand-600 hover:text-gray-600">{{ 'Produkte' | trans }}</a>
</li>
</ol>
</nav>
<main class="mx-auto max-w-2xl px-4 lg:max-w-7xl lg:px-8">
<form id="filters">
<div class="pt-12 pb-24 lg:grid lg:grid-cols-3 lg:gap-x-8 xl:grid-cols-4">
<aside>
<div class="flex items-baseline justify-between hidden lg:block">
<h3 class="text-2xl mb-4 font-bold tracking-tight text-gray-900">Filter</h3>
</div>
<div class="space-y-2 hidden lg:block">
{% if(currentFilter|length > 0) %}
{% for key,filter in currentFilter %}
{% if(filter is not null and filter is not empty and key not in ["productGroup", "parentCategoryIds", "materialThickness"]) %}
{% if filter is iterable %}
{% for f in filter %}
<button data-filter="{{ (key ~ f)|replace({' ': ''}) }}" type="button" class="removeFilter w-full inline-flex items-center py-2 px-3 bg-gray-100 hover:bg-brand-50 text-sm font-medium text-gray-600 hover:text-brand-600 border border-transparent hover:border-brand-600 rounded-md space-x-2 cursor-pointer select-none transition ease duration-300 group text-left">
<span class="flex-shrink-0">
<svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
<path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
</svg>
</span>
<span>
{{ ('general.filter.' ~ key)|lower|trans }}: {{ (f)|lower|trans }}
</span>
</button>
{% endfor %}
{% else %}
<button data-filter="{{ (key ~ filter)|replace({' ': ''}) }}" type="button" class="removeFilter w-full inline-flex items-center py-2 px-3 bg-gray-100 hover:bg-brand-50 text-sm font-medium text-gray-600 hover:text-brand-600 border border-transparent hover:border-brand-600 rounded-md space-x-2 cursor-pointer select-none transition ease duration-300 group text-left">
<span class="flex-shrink-0">
<svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
<path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
</svg>
</span>
<span>
{{ ('general.filter.' ~ key)|lower|trans }}: {{ (filter)|lower|trans }}
</span>
</button>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div>
<div class="mt-4 hidden lg:block">
<div class="divide-y divide-gray-200">
{% if(filterDefinition.filters|length > 0) %}
{% for filter in filterDefinition.filters %}
{% set filterMarkup = filterService.filterFrontend(filter, productListing, currentFilter) %}
{{ filterMarkup | raw }}
{% endfor %}
{% endif %}
</div>
</div>
</aside>
<section aria-labelledby="product-heading" class="mt-6 lg:col-span-2 lg:mt-0 xl:col-span-3">
<div class="flex justify-between mb-4 items-center">
<h3 class="text-2xl font-bold tracking-tight text-gray-900">{{ 'Produkte' | trans }}</h3>
<div class="flex items-center">
<button @click="showMobileFilter = true" type="button" class="mr-4 p-2 text-gray-400 hover:text-gray-500 sm:ml-6 lg:hidden">
<span class="sr-only">Filters</span>
<svg class="h-5 w-5" aria-hidden="true" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z" clip-rule="evenodd" />
</svg>
</button>
<div class="relative inline-block text-left" x-data="{ isOpen: false }">
<div>
<button type="button" x-on:click="isOpen = ! isOpen" class="inline-flex w-full justify-center py-2 px-3 bg-gray-100 text-sm font-semibold text-gray-900 space-x-1.5 rounded-md focus:outline-none" id="menu-button" aria-expanded="true" aria-haspopup="true">
<span>{{ 'Sortieren nach' | trans }}</span>
<svg class="-mr-1 h-5 w-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd" />
</svg>
</button>
</div>
<!--
Dropdown menu, show/hide based on menu state.
Entering: "transition ease-out duration-100"
From: "transform opacity-0 scale-95"
To: "transform opacity-100 scale-100"
Leaving: "transition ease-in duration-75"
From: "transform opacity-100 scale-100"
To: "transform opacity-0 scale-95"
-->
<div
x-cloak x-show="isOpen"
@click.outside="isOpen = false"
x-transition:enter="transition ease-out duration-100"
x-transition:enter-start="transform opacity-0 scale-95"
x-transition:enter-end="transform opacity-0 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="transform opacity-100 scale-100"
x-transition:leave-end="transform opacity-0 scale-95"
class="absolute right-0 z-10 mt-2 w-56 origin-top-right rounded-md bg-gray-50 shadow-lg focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="menu-button" tabindex="-1">
<div class="py-1" role="none">
<!--<button name="sort" value="name-asc" class="w-full block py-2 px-4 hover:bg-gray-100 text-sm text-gray-700 hover:text-gray-900 text-left" role="menuitem" tabindex="-1" id="menu-item-0">{{ 'Artikelname' | trans }}</button>-->
<button name="sort" value="code-asc" class="w-full block py-2 px-4 hover:bg-gray-100 text-sm text-gray-700 hover:text-gray-900 text-left" role="menuitem" tabindex="-1" id="menu-item-1">{{ 'Produktcode (aufsteigend)' | trans }}</button>
<button name="sort" value="code-desc" class="w-full block py-2 px-4 hover:bg-gray-100 text-sm text-gray-700 hover:text-gray-900 text-left" role="menuitem" tabindex="-1" id="menu-item-1">{{ 'Produktcode (absteigend)' | trans }}</button>
<button name="sort" value="materialThickness-asc" class="w-full block py-2 px-4 hover:bg-gray-100 text-sm text-gray-700 hover:text-gray-900 text-left" role="menuitem" tabindex="-1" id="menu-item-1">{{ 'Materialstärke (aufsteigend)' | trans }}</button>
<button name="sort" value="materialThickness-desc" class="w-full block py-2 px-4 hover:bg-gray-100 text-sm text-gray-700 hover:text-gray-900 text-left" role="menuitem" tabindex="-1" id="menu-item-1">{{ 'Materialstärke (absteigend)' | trans }}</button>
</div>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 gap-y-4 sm:grid-cols-3 sm:gap-x-6 sm:gap-y-10 lg:gap-x-8 xl:grid-cols-4">
{% for item in results %}
{% include 'product/product_teaser.html.twig' with {'product': item} %}
{% else %}
<div class="p-4 my-4 text-sm text-brand-600 rounded-lg bg-brand-50 col-span-4" role="alert">
{{ 'Leider wurden keine Ergebnisse gefunden' }}
</div>
{% endfor %}
</div>
<div class="mt-10">
{% include '_partials/pagination.html.twig' %}
</div>
</section>
</div>
</form>
</main>
</div>
{% endblock %}
{% block PAGE_JS %}
{% endblock %}