templates/product/partials/_product-specifications.html.twig line 1

Open in your IDE?
  1. <section class="relative py-10 md:py-20">
  2.     <div class="absolute top-0 w-full h-40 bg-blue-200 -z-10">
  3.         <!-- empty -->
  4.     </div>
  5.     <div class="container grid grid-cols-12 gap-8">
  6.         <div class="order-2 col-span-12 md:order-1 md:col-span-6">
  7.             {% if product.schematics is defined %}
  8.                 {% for image in product.schematics %}
  9.                     {% if image is not null %}
  10.                         <div class="mb-8">
  11.                             {{ image.thumbnail('default').html({
  12.                                 pictureAttributes: {
  13.                                     class: 'block object-cover object-center overflow-hidden rounded-md',
  14.                                 }
  15.                             }) | raw }}
  16.                         </div>
  17.                         {# We only display 1 image according to design, even though the product can have multiple scematics #}
  18.                         {# TODO make it a swiper oid? #}
  19.                         {% break %}
  20.                     {% endif %}
  21.                 {% endfor %}
  22.             {% endif %}
  23.             {% if printmode is not defined %}
  24.                 <div class="text-white rounded-md md:p-10 bg-blue">
  25.                     <h3 class="p-4 text-xl md:text-2xl md:p-0 md:mb-8">{{ "Downloads"|trans }}</h3>
  26.                     <div class="border-t border-white border-opacity-30">
  27.                         {% if linkToSpecificationSheet is defined %}
  28.                             <div class="flex items-center px-4 py-3 border-b border-white md:px-0 border-opacity-30">
  29.                                 <span class="mr-4">
  30.                                     <svg xmlns="http://www.w3.org/2000/svg" width="16" height="17"><path fill="#FFF" fill-rule="evenodd" d="M16 12.5v3.2a.8.8 0 0 1-.8.8H.8a.8.8 0 0 1-.8-.8v-3.2h1.6v2.4h12.8v-2.4H16Zm-8 0a.797.797 0 0 0 .566-.234l3.2-3.2-1.132-1.132L8.8 9.77V.5H7.2v9.269L5.366 7.934 4.234 9.066l3.2 3.2c.15.15.354.234.566.234Z"/></svg>
  31.                                 </span>
  32.                                 <span class="font-bold md:text-lg grow">
  33.                                     {{ "Productsheet"|trans }}
  34.                                 </span>
  35.                                 <a href="{{ linkToSpecificationSheet | trimUrl }}" target="_blank" class="underline">
  36.                                     {{ "Downloaden"|trans }}
  37.                                 </a>
  38.                             </div>
  39.                         {% endif %}
  40.                     </div>
  41.                 </div>
  42.             {% endif %}
  43.         </div>
  44.         {% if product.specifications is defined %}
  45.             <div class="order-1 col-span-12 md:order-2 md:col-span-6">
  46.                 <div
  47.                     class="pt-6 pb-5 bg-gray-200 rounded-md md:pt-10 md:px-10"
  48.                     x-data="{ specificationsOpen: false }"
  49.                 >
  50.                     <h3 class="px-4 text-2xl font-bold md:px-0 md:text-4xl mb-9">
  51.                         {{ "Technische Specificaties"|trans }}
  52.                     </h3>
  53.                     {#
  54.                     Here we set the maxinum amount of specs that are shown on initial page load.
  55.                     If there are more then this amount then those will be hidden, a button will then be shown
  56.                     #}
  57.                     {% set shownSpecsOnInitialLoad = (printmode is defined) ? 8 : 9 %}
  58.                     {% set showReadMoreSpecsButton = false %}
  59.                     {% for spec in product.specifications|filter(s => s.specification_property.data.publicly_visible) %}
  60.                         {% set specificationObject = spec.specification_property.data %}
  61.                             {% if (loop.index < shownSpecsOnInitialLoad) %}
  62.                                 <div
  63.                                     class="flex justify-between px-4 md:px-8 py-4 md:rounded-md {{ cycle(['', 'bg-white'], loop.index) }}">
  64.                                         <span>{{ specificationObject.title }}</span>
  65.                                         <span>{{ spec.specification_value.data }} {{ specificationObject.unit }}</span>
  66.                                 </div>
  67.                             {% else %}
  68.                                 <div
  69.                                     class="justify-between px-4 md:px-8 py-4 md:rounded-md {{ cycle(['', 'bg-white'], loop.index) }} "
  70.                                     :class="specificationsOpen ? 'flex' : 'hidden'"
  71.                                     >
  72.                                         <span>{{ specificationObject.title }}</span>
  73.                                         <span>{{ spec.specification_value.data }} {{ specificationObject.unit }}</span>
  74.                                 </div>
  75.                             {% endif %}
  76.                         {% set showReadMoreSpecsButton = loop.index > shownSpecsOnInitialLoad %}
  77.                     {% endfor %}
  78.                     {# never show this button when printing (printmode), even though there could be more specs. #}
  79.                     {% if showReadMoreSpecsButton and printmode is not defined %}
  80.                         <div class="flex justify-center w-full mt-6">
  81.                             <button class="button button__secondary group"
  82.                                 @click="specificationsOpen = !specificationsOpen"
  83.                                 >
  84.                                     <span class="flex w-6 h-6 mr-3 transition-all bg-white rounded-full shadow-md text-blue group-hover:bg-blue group-hover:text-white ">
  85.                                         <span class="flex items-center justify-center w-full h-full ">
  86.                                             <svg
  87.                                                 x-show="!specificationsOpen"
  88.                                                 class="w-3.5 shrink-0"
  89.                                                 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path fill="currentColor" fill-rule="nonzero" d="M6.68 0h.024a.929.929 0 0 1 .916.915l.07 4.994 4.994.07a.93.93 0 0 1 .916.916.878.878 0 0 1-.866.89h-.024l-4.995-.07.07 4.995a.878.878 0 0 1-.89.89.93.93 0 0 1-.915-.916L5.91 7.69.914 7.62A.93.93 0 0 1 0 6.704a.878.878 0 0 1 .89-.89l4.994.07L5.814.89A.878.878 0 0 1 6.68 0Z"/>
  90.                                             </svg>
  91.                                             <svg
  92.                                                 x-show="specificationsOpen"
  93.                                                 class="w-3.5 shrink-0"
  94.                                                 xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 3"><path fill="currentColor" fill-rule="nonzero" d="M12.684.979a.929.929 0 0 1 .916.916.878.878 0 0 1-.866.89h-.024L.915 2.62A.929.929 0 0 1 0 1.704a.878.878 0 0 1 .89-.89l11.794.165Z"/>
  95.                                             </svg>
  96.                                         </span>
  97.                                     </span>
  98.                                     <span x-show="!specificationsOpen">{{ "Alle technische specificaties tonen"|trans }}</span>
  99.                                     <span x-show="specificationsOpen">{{ "Minder specificaties tonen"|trans }}</span>
  100.                             </button>
  101.                         </div>
  102.                     {% endif %}
  103.                 </div>
  104.             </div>
  105.         {% endif %}
  106.     </div>
  107. </section>