custom/plugins/HuebertAddOrderAttributes/src/Resources/views/storefront/page/product-detail/attribute-dependecies.html.twig line 1

Open in your IDE?
  1. {% block page_product_detail_buy_form_inner_csrf %}
  2.     <div data-frontend-calculations = "true" >
  3.     {% if page.product.available %}
  4.         {% set dependencies = null %}
  5.         {% if  page.product.categoryAttributes|length>0 %}
  6.             {% set dependencies = page.product.categoryAttributes %}
  7.         {% elseif page.product.dependenciesAttributes|length>0 %}
  8.             {% set dependencies = page.product.dependenciesAttributes %}
  9.             {% elseif page.product.productStreamDependencies|length > 0 %}
  10.                 {% set dependencies = page.product.productStreamDependencies %}
  11.         {% endif %}
  12.         {% if dependencies %}
  13.             {% for dependency in dependencies %}
  14.                 {% if dependency.active %}
  15.         <div class="custom-control custom-checkbox {% if loop.last %}mb-3{% else %}mb-1{% endif %}">
  16.         <input class="huebert-depedenency-chekbox" type="checkbox" id="huebert-depedenency-chekbox-{{ loop.index }}">
  17.                             <label for="huebert-depedenency-chekbox-{{ loop.index }}">{{ dependency.name }}</label>
  18.             {%if dependency.price %}
  19.             <label class="depencency-price" for="huebert-depedenency-chekbox-{{ loop.index }}">  : <strong> {{ dependency.price | currency }}  </strong></label>
  20.             {%endif%}
  21.             <input type="hidden" class="dependency-price"  value="{{dependency.name}}--{{dependency.price}}">
  22.             <input type="hidden" class="dependency-price-send"   name="dependencies[{{ page.product.id }}][{{ dependency.id }}]" value="">
  23.         </div>
  24.             <div class="huebert-depedenency" style="display: none">
  25.             {% set attributesData = null %}
  26.             {% if dependency.extensions.dependencies %}
  27.                 {% set attributesData = dependency.extensions.dependencies %}
  28. {#                {{ dump(attributesData) }}#}
  29.             {% endif %}
  30.             {% if attributesData %}
  31.             {% block huebert_upload_modal_container %}
  32.                 {% sw_include '@Storefront/storefront/page/product-detail/modal/upload.html.twig' %}
  33.             {% endblock %}
  34.             <div class="row">
  35.                 <div class="col-12 attributes-container" data-frontend-calculations="true" data-snippets='{
  36.                     "totalSnippet": "{{ "huebert.detail.totalCalculated"|trans }}",
  37.                     "currency": "{{ context.currency.symbol }}"
  38.                 }'>
  39.                     {% for attribute in attributesData %}
  40.                         {% set last = loop.last %}
  41.                         {% set separatedQuantity = page.separatedQuantity %}
  42.                         {% if separatedQuantity %}
  43.                             {% set inputName = "lineItems" %}
  44.                         {% else %}
  45.                             {% set inputName = "attributes" %}
  46.                         {% endif %}
  47.                         <div class="row {% if attribute.translated.infotext and attribute.infotype == "textbelow" %}info-text-bottom-active{% endif %}">
  48.                             <div class="col-md-6 col-12">
  49.                                 {% if attribute.type is same as('dropdown') %}
  50.                                     {% if page.enabledPrices %}
  51.                                         {# WITH PRICES #}
  52.                                         {% if attribute.translated.optionsNameValue.options %}
  53.                                             <label class="form-label" for="{{ attribute.id }}">
  54.                                                 {{ attribute.translated.name }}
  55.                                                 {% if attribute.translated.infotext and attribute.infotype == "help" %}
  56.                                                     <dfn class="hue-tooltip"> {% sw_icon 'help' style {'size':'xs'} %}
  57.                                                         <span role="tooltip">{{ attribute.translated.infotext| raw }}</span>
  58.                                                     </dfn>
  59.                                                 {% endif %}
  60.                                             </label>
  61.                                             <select id="{{ attribute.id }}"
  62.                                                     class="custom-select {% if last %}mb-4{% else %}mb-3{% endif %} dropdownValue onValueChange"
  63.                                                 {% if separatedQuantity %}
  64.                                                     name="lineItems[{{ page.product.id }}][attributes_with_prices][{{ attribute.translated.name }}]"
  65.                                                 {% else %}
  66.                                                     name="attributes[{{ page.product.id }}][{{ attribute.id }}][attributes_with_prices][{{ attribute.translated.name }}]"
  67.                                                 {% endif %}
  68.                                                 {% if attribute.required %}required="required"{% endif %}>
  69.                                                 <option disabled="disabled" selected="selected" value="">
  70.                                                     {{ "huebert.detail.dropdownHint"|trans }}
  71.                                                 </option>
  72.                                                 {% for option in attribute.translated.optionsNameValue.options %}
  73.                                                     <option value="{{ option.name }}--{{ option.value }}">
  74.                                                         {{ option.name }}
  75.                                                     </option>
  76.                                                 {% endfor %}
  77.                                             </select>
  78.                                         {% endif %}
  79.                                     {% else %}
  80.                                         {% if attribute.options %}
  81.                                             <label class="form-label" for="{{ attribute.id }}">{{ attribute.translated.name }}</label>
  82.                                             <select id="{{ attribute.id }}"
  83.                                                     class="custom-select {% if last %}mb-4{% else %}mb-3{% endif %}"
  84.                                                     name="attributes[{{ page.product.id }}][{{ attribute.id }}]"
  85.                                                     {% if attribute.required %}required="required"{% endif %}>
  86.                                                 <option disabled="disabled" selected="selected" value="">
  87.                                                     {{ "huebert.detail.dropdownHint"|trans }}
  88.                                                 </option>
  89.                                                 {% for option in attribute.options|split(',')  %}
  90.                                                     <option value="{{ option }}">
  91.                                                         {{ option }}
  92.                                                     </option>
  93.                                                 {% endfor %}
  94.                                             </select>
  95.                                         {% endif %}
  96.                                     {% endif %}
  97.                                 {% elseif attribute.type is same as('single-select') %}
  98.                                     {% if page.enabledPrices %}
  99.                                         {# WITH PRICES #}
  100.                                         {% if attribute.translated.optionsNameValue.options %}
  101.                                             <label class="form-label" for="{{ attribute.id }}">{{ attribute.translated.name }}</label>
  102.                                             {% for option in attribute.translated.optionsNameValue.options  %}
  103.                                                 <div class="custom-control custom-radio {% if loop.last %}mb-3{% else %}mb-1{% endif %}">
  104.                                                     <input type="radio"
  105.                                                            class="custom-control-input singleValue onValueChange"
  106.                                                            id="{{ attribute.id }}_{{ loop.index }}"
  107.                                                         {% if separatedQuantity %}
  108.                                                             name="lineItems[{{ page.product.id }}][attributes_with_prices][{{ attribute.translated.name }}]"
  109.                                                         {% else %}
  110.                                                             name="attributes[{{ page.product.id }}][{{ attribute.id }}][attributes_with_prices][{{ attribute.translated.name }}]"
  111.                                                         {% endif %}
  112.                                                            value="{{ option.name }}--{{ option.value }}"
  113.                                                         {% if attribute.required %}required="required"{% endif %}>
  114.                                                     <label for="{{ attribute.id }}_{{ loop.index }}" class="custom-control-label">
  115.                                                         {{ option.name }}
  116.                                                     </label>
  117.                                                 </div>
  118.                                             {% endfor %}
  119.                                         {% endif %}
  120.                                     {% else %}
  121.                                         {% if attribute.options %}
  122.                                             <label class="form-label" for="{{ attribute.id }}">{{ attribute.translated.name }}</label>
  123.                                             {% for option in attribute.options|split(',')  %}
  124.                                                 <div class="custom-control custom-radio {% if loop.last %}mb-3{% else %}mb-1{% endif %}">
  125.                                                     <input type="radio"
  126.                                                            class="custom-control-input"
  127.                                                            id="{{ attribute.id }}_{{ loop.index }}"
  128.                                                            name="attributes[{{ page.product.id }}][{{ attribute.id }}]"
  129.                                                            value="{{ option }}"
  130.                                                            {% if attribute.required %}required="required"{% endif %}>
  131.                                                     <label for="{{ attribute.id }}_{{ loop.index }}" class="custom-control-label">
  132.                                                         {{ option }}
  133.                                                     </label>
  134.                                                 </div>
  135.                                             {% endfor %}
  136.                                         {% endif %}
  137.                                     {% endif %}
  138.                                 {% elseif attribute.type is same as('multi-select') %}
  139.                                     {% if page.enabledPrices %}
  140.                                         {# WITH PRICES #}
  141.                                         {% if attribute.translated.optionsNameValue.options %}
  142.                                             <label class="form-label" for="{{ attribute.id }}">{{ attribute.translated.name }}</label>
  143.                                             {% for option in attribute.translated.optionsNameValue.options  %}
  144.                                                 <div class="custom-control custom-checkbox {% if loop.last %}mb-3{% else %}mb-1{% endif %}">
  145.                                                     <input type="checkbox"
  146.                                                            class="custom-control-input multiValue onValueChange"
  147.                                                            id="{{ attribute.id }}_{{ loop.index }}"
  148.                                                         {% if separatedQuantity %}
  149.                                                             name="lineItems[{{ page.product.id }}][attributes_with_prices][{{ attribute.translated.name }}][{{ option.name }}]"
  150.                                                         {% else %}
  151.                                                             name="attributes[{{ page.product.id }}][{{ attribute.id }}][attributes_with_prices][{{ attribute.translated.name }}][{{ option.name }}]"
  152.                                                         {% endif %}
  153.                                                            value="{{ option.value }}"
  154.                                                         {% if attribute.required %}required="required"{% endif %}>
  155.                                                     <label for="{{ attribute.id }}_{{ loop.index }}" class="custom-control-label">
  156.                                                         {{ option.name }}
  157.                                                     </label>
  158.                                                 </div>
  159.                                             {% endfor %}
  160.                                         {% endif %}
  161.                                     {% else %}
  162.                                         {% if attribute.options %}
  163.                                             <label class="form-label" for="{{ attribute.id }}">{{ attribute.translated.name }}</label>
  164.                                             {% for option in attribute.options|split(',')  %}
  165.                                                 <div class="custom-control custom-checkbox {% if loop.last %}mb-3{% else %}mb-1{% endif %}">
  166.                                                     <input type="checkbox"
  167.                                                            class="custom-control-input"
  168.                                                            id="{{ attribute.id }}_{{ loop.index }}"
  169.                                                            name="attributes[{{ page.product.id }}][{{ attribute.id }}][]"
  170.                                                            value="{{ option }}"
  171.                                                            {% if attribute.required %}required="required"{% endif %}>
  172.                                                     <label for="{{ attribute.id }}_{{ loop.index }}" class="custom-control-label">
  173.                                                         {{ option }}
  174.                                                     </label>
  175.                                                 </div>
  176.                                             {% endfor %}
  177.                                         {% endif %}
  178.                                     {% endif %}
  179.                                 {% elseif attribute.type is same as('media') %}
  180.                                     <label class="form-label" for="{{ attribute.id }}">{{ attribute.translated.name }}</label>
  181.                                     <template data-media-upload-plugin data-uplaodUrl="{{ seoUrl('huebert.add.order.attributes.media.upload') }}"></template>
  182.                                     <div style="margin-bottom: 20px;width:300px;">
  183.                                         <input type="file"
  184.                                                id="huebert-add-media-upload_{{ loop.index }}"
  185.                                                class="huebert-add-media-upload_{{ loop.index }} media"
  186.                                                name="huebert-add-media-upload_{{ loop.index }}"
  187.                                                accept="{{ attribute.fileTypes }}"
  188.                                                size = "{{ attribute.mediaMaxSize }}"
  189.                                                {% if attribute.required %}required="required"{% endif %}/>
  190.                                         {% if page.previewImage %}
  191.                                             <img  style="display: none;" width="{{ page.imageWidth }}px" class="uploadedImage" src="#" alt="Uploaded image" />
  192.                                             <img style="display: none; margin:7px" width="50px" id="pdf-png" src="/bundles/huebertaddorderattributes/static/PDF_icon.png" alt="Uploaded pdf" >
  193.                                             <span style="display: none; margin:7px" id="file-png" class="icon icon-xl">{% sw_icon 'file' %}</span>
  194.                                         {% endif %}
  195.                                         <span class="huebert-upload-error_{{ loop.index }}" style="display: none; color:red;">
  196.                                         {{ "huebert.detail.uploadImageErr"|trans }}
  197.                                     </span>
  198.                                         <span class="huebert-upload-error_maxsize" style="display: none; color:#7f3535;">
  199.                                         {{ "huebert.detail.uploadImageErrMaxSize"|trans }} {{ attribute.mediaMaxSize  }} kB
  200.                                         </span>
  201.                                         <span class="huebert-upload-error-type_{{ loop.index }}" style="display: none; color:red;">
  202.                                      {{ "huebert.detail.uploadImageErrorType"|trans }} {{ attribute.fileTypes  }}
  203.                                         </span>
  204.                                     </div>
  205.                                     <input type="hidden" name="_csrf_token_hueber_media_upload"
  206.                                            id="_csrf_token_huebert_media_upload"
  207.                                            value="{{ sw_csrf('huebert.add.order.attributes.media.upload', {"mode":"token"}) }}">
  208.                                     <input type="hidden"
  209.                                            name="attributes[{{ page.product.id }}][{{ attribute.id }}]"
  210.                                            value=""
  211.                                            class="huebert-add-media-upload_mediaId_{{ loop.index }}"
  212.                                            id="{{ attribute.id }}_{{ loop.index }}"/>
  213.                                     <input type="hidden"
  214.                                            name="attributes[{{ page.product.id }}][{{ attribute.id }}][media]"
  215.                                            value=""
  216.                                            class="huebert-add-media-upload_media_id_{{ loop.index }}"
  217.                                            id="{{ attribute.id }}_{{ loop.index }}"/>
  218.                                 {% else %}
  219.                                     <label class="form-label" for="{{ attribute.id }}">{{ attribute.translated.name }}</label>
  220.                                     <input
  221.                                         id="{{ attribute.id }}"
  222.                                         type="{{ attribute.type }}"
  223.                                         {% if attribute.type == "number" %}step=".01"{% endif %}
  224.                                         placeholder="{{ attribute.translated.placeholder }}"
  225.                                         aria-label="Custom input for {{ attribute.translated.name }}"
  226.                                         value=""
  227.                                         name="attributes[{{ page.product.id }}][{{ attribute.id }}]"
  228.                                         class="form-control {% if last %}mb-4{% else %}mb-3{% endif %}  {% if attribute.type == "text" %} text-validation {{ attribute.maxInputCharacters }}{% endif %}"
  229.                                         {% if attribute.validationpattern %}pattern="{{  attribute.validationpattern }}"{% endif %}
  230.                                         {% if attribute.required %}required="required"{% endif %}
  231.                                     >
  232.                                 {% endif %}
  233.                             </div>
  234.                             {% if attribute.translated.infotext and attribute.infotype == "text" %}
  235.                                 <div class="col-6 attribute-infotext">{% sw_icon 'info' style {'size':'xs'} %} {{ attribute.translated.infotext | raw }}</div>
  236.                             {% endif %}
  237.                         </div>
  238.                         {% if attribute.translated.infotext and attribute.infotype == "textbelow" %}
  239.                             <div class="attribute-infotext">{% sw_icon 'info' style {'size':'xs'} %} {{ attribute.translated.infotext | raw }}</div>
  240.                         {% endif %}
  241.                     {% endfor %}
  242.                 </div>
  243.             </div>
  244.         {% endif %}
  245.             </div>
  246.                 {% endif %}
  247.                     {% endfor %}
  248.         {% endif %}
  249.     {% endif %}
  250.     </div>
  251. {% endblock %}