templates/Shop/includes/documentsbuttons.html.twig line 1

Open in your IDE?
  1. {% set documentsObject = app_product_documents(product) %}
  2. {% set documents = documentsObject.documents %}
  3. {% set docLang1 = documentsObject.docLang1 %}
  4. {% set docLang2 = documentsObject.docLang2 %}
  5. <div class="tabs-listing style2 mt-0 mt-md-5">
  6.     <ul class="product-tabs style2 list-unstyled d-flex-wrap justify-content-center m-0 d-none d-md-flex" id="tabsList">
  7.         <li rel="features" class="featuresIL {{ (kit and is_authenticated) ? '' : 'd-none' }}"><a class="tablink">{{ 'product_detail.content.product_tabs_features_translations' |trans }}</a></li>
  8.         <li rel="description" class="{{ (kit and is_authenticated) ? '' : 'descriptionIL' }}"><a class="tablink">{{ 'product_detail.content.product_tabs_description_translations' |trans }}</a></li>
  9.         {% if documents[docLang1] | length > 0 or documents[docLang2] | length > 0 %}
  10.                 {% for documentTypes, doc in documents[docLang1] %}
  11.                     {% set doc = null %}
  12.                     {% if documents[docLang1][documentTypes] | length > 0 %}
  13.                         {% set doc = documents[docLang1][documentTypes] | first %}
  14.                     {% else %}
  15.                         {% if documents[docLang2][documentTypes] | length > 0 %}
  16.                             {% set doc = documents[docLang2][documentTypes] | first %}
  17.                         {% endif %}
  18.                     {% endif %}
  19.                     {% if doc is not null %}
  20.                         {% set url = "" %}
  21.                         {% set title = "" %}
  22.                         {% if app_helper_is_object(doc) %}
  23.                             {%  set asset = doc.getElement() %}
  24.                             {%  set url = asset.getFrontendPath() %}
  25.                             {%  set title = doc.getDoctype() %}
  26.                         {% else %}
  27.                             {%  set url = doc %}
  28.                             {%  set title = documentTypes %}
  29.                         {% endif %}
  30.                         {% set rel = title | replace({' ': '','á':'a','é':'e','í':'i','ó':'o','ú':'u'}) %}
  31.                         {% if title is not empty %}
  32.                             <li rel="{{ rel }}"><a class="tablink" href="{{ url }}" target="_blank" rel="noreferrer noopener" >{{ ("lbl_" ~ title) | trans }}</a></li>
  33.                         {% endif %}
  34.                     {% endif %}
  35.                 {% endfor %}
  36.         {%  endif %}
  37.     </ul>
  38.     <div class="tab-container" id="tabsContainer">
  39.         <div id="features" class="tab-content features {{ (kit and is_authenticated) ? '' : 'd-none' }}">
  40.                 <div class="product-features">
  41.                     <div class="row">
  42.                         <div class="col-12">
  43.                             <h4 class="pt-2 text-uppercase">{{ 'product_detail.content.title_product_features_translations' | trans }}</h4>
  44.                             <ul class="checkmarkList">
  45.                                 {% if attributesRows | length > 0 or typesRows | length > 0 %}
  46.                                     <table class="table table-striped">
  47.                                         {% for row in attributesRows %}
  48.                                             {{ row | raw }}
  49.                                         {% endfor %}
  50.                                         {% for row in typesRows %}
  51.                                             {{ row | raw }}
  52.                                         {% endfor %}
  53.                                     </table>
  54.                                 {% endif %}
  55.                             </ul>
  56.                         </div>
  57.                     </div>
  58.                 </div>
  59.             </div>
  60.         <div id="description" class="tab-content">
  61.             <div class="product-description">
  62.                 <div class="row">
  63.                     <div class="col-12">
  64.                         <h4 class="pt-2 text-uppercase">{{ 'product_detail.content.title_product_description_translations' | trans }}</h4>
  65.                         {% set description = longDescription is not empty ? longDescription : shortDescription %}
  66.                         {% if description matches '/<[^>]+>/' %}
  67.                             <div class="fs-6">
  68.                                 {% for paragraph in description | split('</p>') %}
  69.                                     {% if paragraph | trim %}
  70.                                         {{ paragraph | trim | raw }}</p>
  71.                                     {% endif %}
  72.                                 {% endfor %}
  73.                             </div>
  74.                         {% else %}
  75.                             <p class="fs-6">{{ description | nl2br | raw }}</p>
  76.                         {% endif %}
  77.                     </div>
  78.                 </div>
  79.             </div>
  80.         </div>
  81.             {% if documents[docLang1] | length > 0 or documents[docLang2] | length > 0 %}
  82.                 {% for documentTypes, doc in documents[docLang1] %}
  83.                     {% set doc = null %}
  84.                     {% if documents[docLang1][documentTypes] | length > 0 %}
  85.                         {% set doc = documents[docLang1][documentTypes] | first %}
  86.                     {% else %}
  87.                         {% if documents[docLang2][documentTypes] | length > 0 %}
  88.                             {% set doc = documents[docLang2][documentTypes] | first %}
  89.                         {% endif %}
  90.                     {% endif %}
  91.                     {% if doc is not null %}
  92.                         {% set url = "" %}
  93.                         {% set title = "" %}
  94.                         {% if app_helper_is_object(doc) %}
  95.                             {%  set asset = doc.getElement() %}
  96.                             {%  set url = asset.getFrontendPath() %}
  97.                             {%  set title = doc.getDoctype() %}
  98.                         {% else %}
  99.                             {%  set url = doc %}
  100.                             {%  set title = documentTypes %}
  101.                         {% endif %}
  102.                         {% set rel = title | replace({' ': '','á':'a','é':'e','í':'i','ó':'o','ú':'u'}) %}
  103.                         {% if title is not empty %}
  104.                             <h3 class="tabs-ac-style d-md-none" rel="{{ rel }}">{{ ("lbl_" ~ title)| trans }}</h3>
  105.                             <div id="{{ rel }}" class="tab-content d-md-none">
  106.                                 <div class="product-description">
  107.                                     <div class="row">
  108.                                         <div class="col-12 col-sm-12 col-md-8 col-lg-8 mb-4 mb-md-0">
  109.                                             <h4 class="pt-2 text-uppercase">{{ ("lbl_" ~ title) | trans }}</h4>
  110.                                             <a href="{{ url }}" target="_blank" rel="noreferrer noopener" class="btn rounded-0 product-form__cart-submit mb-0"><span>{{ 'product_detail.content.manual_link_translations' |trans }}</span></a>
  111.                                         </div>
  112.                                     </div>
  113.                                 </div>
  114.                             </div>
  115.                         {% endif %}
  116.                     {% endif %}
  117.                 {% endfor %}
  118.             {%  endif %}
  119.     </div>
  120. </div>
  121. <script>
  122.     document.addEventListener('DOMContentLoaded', function() {
  123.         const tabsList = document.getElementById('tabsList');
  124.         if (tabsList) {
  125.             const firstListItem = tabsList.querySelector('.descriptionIL');
  126.             if (firstListItem) {
  127.                 firstListItem.click();
  128.             }
  129.         }
  130.     });
  131. </script>