custom/plugins/HuebertAddOrderAttributes/src/Resources/views/storefront/page/product-detail/buy-widget-form.html.twig line 1

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