custom/static-plugins/NdVoorwindenTheme/src/Resources/views/storefront/page/product-detail/configurator/select.html.twig line 1

Open in your IDE?
  1. {% set dropdown = type === 'dropdown' %}
  2. {% set radio = type === 'radio' %}
  3. {% set getParameter = app.request.query.get('size') %}
  4. {% set buttonText = "tapBar.selectSizeLabel"|trans %}
  5. {% if getParameter %}
  6.     {% set buttonText = getParameter %}
  7. {% endif %}
  8. {% if options is null %}
  9.     {% set options = page.product.children %}
  10. {% endif %}
  11. {% block custom_select_container %}
  12.     <section class="custom-select-container relative"
  13.              x-data="{show: false, value: null}"
  14.             {% if shopTheLook %} data-custom-variation-switch="false" {% else %}data-custom-variation-switch="true" {% endif %}>
  15.         {% if label %}
  16.             {% block custom_select_label %}
  17.                 <div class="custom-select-label-container flex items-center mb-2">
  18.                     <div class="flex items-center">
  19.                         <label class="custom-select-label font-medium text-grey-600" for="{{ group.id }}">
  20.                             {{ "tapBar.sizeLabel"|trans }}
  21.                         </label>
  22.                         <span x-text="value" class="font-accent font-bold  text-sm ml-2 w-12"></span>
  23.                     </div>
  24. {#                    {% if sizeGuide %}#}
  25. {#                        <a class="nav-link block ml-4 underline text-xs uppercase font-accent opacity-50 product-detail-tab-navigation-link"#}
  26. {#                           id="size-guide-tab" data-toggle="tab" data-offcanvas-tabs="true" href="#size-guide-tab-pane"#}
  27. {#                           role="tab"#}
  28. {#                           aria-controls="size-guide-tab-pane" aria-selected="true">#}
  29. {#                            {{ "tapBar.sizeGuideLabel"|trans }}#}
  30. {#                        </a>#}
  31. {#                    {% endif %}#}
  32.                 </div>
  33.             {% endblock %}
  34.         {% endif %}
  35.         {% block custom_select_size_advise %}
  36.             {% if tapBar !== true %}
  37.                 {% for properties in page.product.properties.elements %}
  38.                     {% if properties.groupId == 'b511785c24a84c68b73e2a5b4846e479' %}
  39.                         <div class="size-advice mt-3">
  40.                             <i>{{ properties.name }}</i>
  41.                         </div>
  42.                     {% endif %}
  43.                 {% endfor %}
  44.             {% endif %}
  45.         {% endblock %}
  46.         {% if dropdown %}
  47.             {% block custom_select_button %}
  48.                 <button class="custom-select-button capitalize custom-select transition {% if product %}bg-white text-grey-600 border-grey-300{% endif %} {% if tapBar %}{% endif %} {% if shopTheLook %} pr-12 w-full lg:w-full {% endif %}"
  49.                         type="button"
  50.                         data-error-classes="border border-red-500 italic text-red-500"
  51.                         @click="show = !show; $el.classList.remove('border', 'border-red-500', 'italic', 'text-red-500')"
  52.                         :class="show ? 'active' : ''">
  53.                 <span x-text="value == null ? '{{ buttonText }}' : value"
  54.                       class="{% if shopTheLook %}shop-the-look-select-placeholder-text capitalize{% else %}custom-select-placeholder-text{% endif %}">
  55.                     {% block custom_select_button_text %}
  56.                         {{ buttonText }}
  57.                     {% endblock %}
  58.                 </span>
  59.                 </button>
  60.             {% endblock %}
  61.         {% endif %}
  62.         {% block custom_select_options %}
  63.             <div {% if dropdown %}x-show="show"{% endif %}
  64.                  @click.outside="show = false"
  65.                  id="{{ group.id }}"
  66.                  class="custom-select-options {% if radio %}flex flex-wrap gap-2{% endif %}{% if dropdown %}absolute left-0 right-0 bg-white shadow-md py-1 z-10 max-h-80 overflow-y-scroll bg-grey-200 {% if position == 'top' %}bottom-100{% else %}top-100{% endif %}{% endif %}">
  67.                 {% for key, option in options %}
  68.                     {% set name = option.options.elements|first.name %}
  69.                     {% set outOfStock = option.stock <= 0 %}
  70.                     {% set selected = false %}
  71.                     {% if getParameter == name %}
  72.                         {% set selected = true %}
  73.                     {% elseif option.id in page.product.optionIds %}
  74.                         {% set selected = true %}
  75.                     {% endif %}
  76.                     {% if outOfStock %}
  77.                         {% continue %}
  78.                     {% endif %}
  79.                     {% block custom_select_option %}
  80.                         <div class="custom-select-option">
  81.                             <input type="radio"
  82.                                    class="{% if shopTheLook %}shop-the-look-select-option-radio{% else %}custom-select-option-radio{% endif %} hidden peer"
  83.                                    value="{{ key }}"
  84.                                    id="{{ name }}_{{ product.id }}"
  85.                                    data-friendlyname="{{ name }}"
  86.                                    @change="value = $el.dataset.friendlyname"
  87.                                    {% if selected %}checked="checked"{% endif %}
  88.                                     {% if outOfStock %}disabled{% endif %}
  89.                                    name="custom_select">
  90.                             <label for="{{ name }}_{{ product.id }}"
  91.                                    @click="show = false"
  92.                                    title="{% if outOfStock %}{{ "tapBar.soldOutLabel"|trans }}{% else %}{{ name }}{% endif %}"
  93.                                    class="custom-select-option-label transition font-accent font-bold relative {% if not outOfStock %}cursor-pointer {% endif %}
  94.                                     {% if radio %}flex items-center justify-center w-12 h-12 bg-grey-50 border border-transparent rounded-sm peer-checked:border-grey-900{% if not outOfStock %} hover:border-grey-900{% endif %}{% endif %}
  95.                                     {% if dropdown %}block py-2 px-3 hover:bg-grey-200 peer-checked:bg-grey-200 {% endif %}
  96.                                     {% if selected %}bg-grey-200{% endif %}
  97.                                     {% if outOfStock %}text-grey-500 cursor-default {% if radio %}bg-red-100{% endif %}{% endif %}
  98.                                     ">
  99.                                 {{ name }}
  100.                                 {% if outOfStock %}
  101.                                     {% if dropdown %}
  102.                                         <span class="out-of-stock-label"> - {{ "tapBar.soldOutLabel"|trans }}</span>
  103.                                     {% elseif radio %}
  104.                                         <span class="out-of-stock-icon w-full h-px bg-grey-700 absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rotate-45"></span>
  105.                                     {% endif %}
  106.                                 {% endif %}
  107.                             </label>
  108.                         </div>
  109.                     {% endblock %}
  110.                 {% endfor %}
  111.             </div>
  112.         {% endblock %}
  113.         <span class="absolute text-red-500 text-xs italic{% if dropdown %} bottom-100{% elseif radio %} top-100 mt-1{% endif %}"
  114.               data-error-message="Selecteer een maat" style="display: none"
  115.               aria-hidden="true"></span>
  116.     </section>
  117. {% endblock %}