templates/product/index.html.twig line 1

Open in your IDE?
  1. {% extends 'layout/app.html.twig' %}
  2. {% block PAGE_CSS %}
  3. {% endblock %}
  4. {% block CONTENT_MID %}
  5.     <div x-data="{ showMobileFilter: false }">
  6.         <div x-cloak x-show="showMobileFilter" class="relative z-40 lg:hidden" role="dialog" aria-modal="true">
  7.             <div x-transition:enter="transition-opacity ease-linear duration-300"
  8.                  x-transition:enter-start="opacity-0"
  9.                  x-transition:enter-end="opacity-100"
  10.                  x-transition:leave="transition-opacity ease-linear duration-300"
  11.                  x-transition:leave-start="opacity-100"
  12.                  x-transition:leave-end="opacity-0"
  13.                  class="fixed inset-0 bg-black bg-opacity-25"></div>
  14.             <div class="fixed inset-0 z-40 flex">
  15.                 <div x-transition:enter="transition ease-in-out duration-300 transform"
  16.                      x-transition:enter-start="translate-x-full"
  17.                      x-transition:enter-end="translate-x-0"
  18.                      x-transition:leave="transition ease-in-out duration-300 transform"
  19.                      x-transition:leave-start="translate-x-0"
  20.                      x-transition:leave-end="translate-x-full"
  21.                     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">
  22.                     <div class="flex items-center justify-between px-4">
  23.                         <h2 class="text-lg font-medium text-gray-900">Filters</h2>
  24.                         <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">
  25.                             <span class="sr-only">Close menu</span>
  26.                             <!-- Heroicon name: outline/x-mark -->
  27.                             <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">
  28.                                 <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
  29.                             </svg>
  30.                         </button>
  31.                     </div>
  32.                     <!-- Filters -->
  33.                     <form id="mobileFilters" class="mt-4">
  34.                         <div class="space-y-2 px-4">
  35.                             {% if(currentFilter|length > 0) %}
  36.                                 {% for key,filter in currentFilter %}
  37.                                     {% if(filter is not null and filter is not empty) %}
  38.                                         {% if filter is iterable %}
  39.                                             {% for f in filter %}
  40.                                                 <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">
  41.                                                     <span class="flex-shrink-0">
  42.                                                         <svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
  43.                                                             <path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
  44.                                                         </svg>
  45.                                                     </span>
  46.                                                     <span>
  47.                                                         {{ ('general.filter.' ~ key)|lower|trans }}: {{ (f)|lower|trans }}
  48.                                                     </span>
  49.                                                 </button>
  50.                                             {% endfor %}
  51.                                         {% else %}
  52.                                             <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">
  53.                                                 <span class="flex-shrink-0">
  54.                                                     <svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
  55.                                                         <path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
  56.                                                     </svg>
  57.                                                 </span>
  58.                                                 <span>
  59.                                                     {{ ('general.filter.' ~ key)|lower|trans }}: {{ (filter)|lower|trans }}
  60.                                                 </span>
  61.                                             </button>
  62.                                         {% endif %}
  63.                                     {% endif %}
  64.                                 {% endfor %}
  65.                             {% endif %}
  66.                         </div>
  67.                         <div class="mt-4">
  68.                             <div class="divide-y divide-gray-200">
  69.                                 {% if(filterDefinition.filters|length > 0) %}
  70.                                     {% for filter in filterDefinition.filters %}
  71.                                         {% set filterMarkup = filterService.filterFrontend(filter, productListing, currentFilter) %}
  72.                                         {{ filterMarkup | raw  }}
  73.                                     {% endfor %}
  74.                                 {% endif %}
  75.                             </div>
  76.                         </div>
  77.                     </form>
  78.                 </div>
  79.             </div>
  80.         </div>
  81.         <nav aria-label="Breadcrumb" class="pt-4">
  82.             <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">
  83.                 <li>
  84.                     <div class="flex items-center">
  85.                         <a href="/" class="mr-2 text-sm font-medium text-gray-900">Home</a>
  86.                         <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">
  87.                             <path d="M5.697 4.34L8.98 16.532h1.327L7.025 4.341H5.697z" />
  88.                         </svg>
  89.                     </div>
  90.                 </li>
  91.                 <li class="text-sm">
  92.                     <a href="{{ navStartNode }}" aria-current="page" class="font-medium text-brand-600 hover:text-gray-600">{{ 'Produkte' | trans }}</a>
  93.                 </li>
  94.             </ol>
  95.         </nav>
  96.         <main class="mx-auto max-w-2xl px-4 lg:max-w-7xl lg:px-8">
  97.             <form id="filters">
  98.                 <div class="pt-12 pb-24 lg:grid lg:grid-cols-3 lg:gap-x-8 xl:grid-cols-4">
  99.                     <aside>
  100.                         <div class="flex items-baseline justify-between hidden lg:block">
  101.                             <h3 class="text-2xl mb-4 font-bold tracking-tight text-gray-900">Filter</h3>
  102.                         </div>
  103.                         <div class="space-y-2 hidden lg:block">
  104.                             {% if(currentFilter|length > 0) %}
  105.                                 {% for key,filter in currentFilter %}
  106.                                     {% if(filter is not null and filter is not empty and key not in ["productGroup", "parentCategoryIds", "materialThickness"]) %}
  107.                                         {% if filter is iterable %}
  108.                                             {% for f in filter %}
  109.                                                 <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">
  110.                                                     <span class="flex-shrink-0">
  111.                                                         <svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
  112.                                                             <path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
  113.                                                         </svg>
  114.                                                     </span>
  115.                                                     <span>
  116.                                                         {{ ('general.filter.' ~ key)|lower|trans }}: {{ (f)|lower|trans }}
  117.                                                     </span>
  118.                                                 </button>
  119.                                             {% endfor %}
  120.                                         {% else %}
  121.                                             <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">
  122.                                                 <span class="flex-shrink-0">
  123.                                                     <svg class="h-2 w-2" stroke="currentColor" fill="none" viewBox="0 0 8 8">
  124.                                                         <path stroke-linecap="round" stroke-width="1.5" d="M1 1l6 6m0-6L1 7" />
  125.                                                     </svg>
  126.                                                 </span>
  127.                                                 <span>
  128.                                                     {{ ('general.filter.' ~ key)|lower|trans }}: {{ (filter)|lower|trans }}
  129.                                                 </span>
  130.                                             </button>
  131.                                         {% endif %}
  132.                                     {% endif %}
  133.                                 {% endfor %}
  134.                             {% endif %}
  135.                         </div>
  136.                         <div class="mt-4 hidden lg:block">
  137.                             <div class="divide-y divide-gray-200">
  138.                                 {% if(filterDefinition.filters|length > 0) %}
  139.                                     {% for filter in filterDefinition.filters %}
  140.                                         {% set filterMarkup = filterService.filterFrontend(filter, productListing, currentFilter) %}
  141.                                         {{ filterMarkup | raw  }}
  142.                                     {% endfor %}
  143.                                 {% endif %}
  144.                             </div>
  145.                         </div>
  146.                     </aside>
  147.                     <section aria-labelledby="product-heading" class="mt-6 lg:col-span-2 lg:mt-0 xl:col-span-3">
  148.                         <div class="flex justify-between mb-4 items-center">
  149.                             <h3 class="text-2xl font-bold tracking-tight text-gray-900">{{ 'Produkte' | trans }}</h3>
  150.                             <div class="flex items-center">
  151.                                 <button @click="showMobileFilter = true" type="button" class="mr-4 p-2 text-gray-400 hover:text-gray-500 sm:ml-6 lg:hidden">
  152.                                     <span class="sr-only">Filters</span>
  153.                                     <svg class="h-5 w-5" aria-hidden="true" viewBox="0 0 20 20" fill="currentColor">
  154.                                         <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" />
  155.                                     </svg>
  156.                                 </button>
  157.                                 <div class="relative inline-block text-left" x-data="{ isOpen: false }">
  158.                                     <div>
  159.                                         <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">
  160.                                             <span>{{ 'Sortieren nach' | trans }}</span>
  161.                                             <svg class="-mr-1 h-5 w-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
  162.                                                 <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" />
  163.                                             </svg>
  164.                                         </button>
  165.                                     </div>
  166.                                     <!--
  167.                                       Dropdown menu, show/hide based on menu state.
  168.                                       Entering: "transition ease-out duration-100"
  169.                                         From: "transform opacity-0 scale-95"
  170.                                         To: "transform opacity-100 scale-100"
  171.                                       Leaving: "transition ease-in duration-75"
  172.                                         From: "transform opacity-100 scale-100"
  173.                                         To: "transform opacity-0 scale-95"
  174.                                     -->
  175.                                     <div
  176.                                         x-cloak x-show="isOpen"
  177.                                         @click.outside="isOpen = false"
  178.                                         x-transition:enter="transition ease-out duration-100"
  179.                                         x-transition:enter-start="transform opacity-0 scale-95"
  180.                                         x-transition:enter-end="transform opacity-0 scale-100"
  181.                                         x-transition:leave="transition ease-in duration-75"
  182.                                         x-transition:leave-start="transform opacity-100 scale-100"
  183.                                         x-transition:leave-end="transform opacity-0 scale-95"
  184.                                         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">
  185.                                         <div class="py-1" role="none">
  186.                                             <!--<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>-->
  187.                                             <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>
  188.                                             <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>
  189.                                             <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>
  190.                                             <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>
  191.                                         </div>
  192.                                     </div>
  193.                                 </div>
  194.                             </div>
  195.                         </div>
  196.                         <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">
  197.                             {%  for item in results %}
  198.                                 {% include 'product/product_teaser.html.twig' with {'product': item} %}
  199.                             {% else %}
  200.                                 <div class="p-4 my-4 text-sm text-brand-600 rounded-lg bg-brand-50 col-span-4" role="alert">
  201.                                     {{ 'Leider wurden keine Ergebnisse gefunden' }}
  202.                                 </div>
  203.                             {% endfor %}
  204.                         </div>
  205.                         <div class="mt-10">
  206.                             {% include '_partials/pagination.html.twig' %}
  207.                         </div>
  208.                     </section>
  209.                 </div>
  210.             </form>
  211.         </main>
  212.     </div>
  213. {% endblock %}
  214. {% block PAGE_JS %}
  215. {% endblock %}