custom/plugins/KMShop2022/src/Resources/views/storefront/component/address/address-form.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/address/address-form.html.twig' %}
  2. {% block component_address_form_address_fields %}
  3.     <div class="{{ formRowClass }}">
  4.         {% block component_address_form_street_name %}
  5.             <div class="form-group  col-md-10 col-10">
  6.                 {% if formViolations.getViolations("/street") is not empty %}
  7.                     {% set violationPath = "/street" %}
  8.                 {% elseif formViolations.getViolations("/#{prefix}/street") is not empty %}
  9.                     {% set violationPath = "/#{prefix}/street" %}
  10.                 {% else %}
  11.                     {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.streetLabel"|trans|sw_sanitize }) %}
  12.                 {% endif %}
  13.                 {% block component_address_form_street_name_label %}
  14.                     <label class="form-label"
  15.                            for="{{ idPrefix ~ prefix }}AddressStreet">
  16.                         {{ "address.streetLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  17.                     </label>
  18.                 {% endblock %}
  19.                 {% block component_address_form_street_name_input %}
  20.                     <input type="text"
  21.                            class="form-control{% if violationPath %} is-invalid{% endif %}"
  22.                            id="{{ idPrefix ~ prefix }}AddressStreet"
  23.                            placeholder="{{ "address.streetPlaceholder"|trans|striptags }}"
  24.                            name="{{ prefix }}[street]"
  25.                            value="{{ data.get('street') }}"
  26.                            data-form-validation-required
  27.                            {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  28.                            required="required">
  29.                 {% endblock %}
  30.                 {% block component_address_form_street_name_input_error %}
  31.                     {% if violationPath %}
  32.                         {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  33.                     {% endif %}
  34.                 {% endblock %}
  35.             </div>
  36.         {% endblock %}
  37.         {% block component_address_form_house_number %}
  38.             <div class="form-group  col-md-2 col-2">
  39.                 {% if formViolations.getViolations("/houseNumber") is not empty %}
  40.                     {% set violationPath = "/houseNumber" %}
  41.                 {% elseif formViolations.getViolations("/#{prefix}/houseNumber") is not empty %}
  42.                     {% set violationPath = "/#{prefix}/houseNumber" %}
  43.                 {% else %}
  44.                     {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.houseNumberLabel"|trans|sw_sanitize }) %}
  45.                 {% endif %}
  46.                 {% block component_address_form_house_number_label %}
  47.                     <label class="form-label"
  48.                            for="{{ idPrefix ~ prefix }}AddressHouseNumber">
  49.                         {{ "address.houseNumberLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  50.                     </label>
  51.                 {% endblock %}
  52.                 {% block component_address_form_house_number_input %}
  53.                     <input type="text"
  54.                            class="form-control{% if violationPath %} is-invalid{% endif %}"
  55.                            id="{{ idPrefix ~ prefix }}AddressHouseNumber"
  56.                            placeholder="{{ "address.houseNumberPlaceholder"|trans|striptags }}"
  57.                            name="{{ prefix }}[houseNumber]"
  58.                            value="{{ data.get('houseNumber') }}"
  59.                            data-form-validation-required
  60.                            {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  61.                            required="required">
  62.                 {% endblock %}
  63.                 {% block component_address_form_house_number_input_error %}
  64.                     {% if violationPath %}
  65.                         {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  66.                     {% endif %}
  67.                 {% endblock %}
  68.             </div>
  69.         {% endblock %}
  70.         {% block component_address_form_additional_field1 %}
  71.             {% if config('core.loginRegistration.showAdditionalAddressField1') %}
  72.                 {% if formViolations.getViolations("/additionalAddressLine1") is not empty %}
  73.                     {% set violationPath = "/additionalAddressLine1" %}
  74.                 {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine1") is not empty %}
  75.                     {% set violationPath = "/#{prefix}/additionalAddressLine1" %}
  76.                 {% endif %}
  77.                 <div class="form-group col-md-12">
  78.                     {% block component_address_form_additional_field1_label %}
  79.                         <label class="form-label"
  80.                                for="{{ idPrefix ~ prefix }}AdditionalField1">
  81.                             {{ "address.additionalField1Label"|trans|sw_sanitize }}
  82.                             {{ config('core.loginRegistration.additionalAddressField1Required') ? "general.required"|trans|sw_sanitize }}
  83.                         </label>
  84.                     {% endblock %}
  85.                     {% block component_address_form_additional_field1_input %}
  86.                         <input type="text"
  87.                                class="form-control {% if violationPath %} is-invalid{% endif %}"
  88.                                id="{{ idPrefix ~ prefix }}AdditionalField1"
  89.                                placeholder="{{ "address.additionalField1Placeholder"|trans|striptags }}"
  90.                                name="{{ prefix }}[additionalAddressLine1]"
  91.                                value="{{ data.get('additionalAddressLine1') }}"
  92.                                 {{ config('core.loginRegistration.additionalAddressField1Required') ? 'required="true"' }}>
  93.                     {% endblock %}
  94.                     {% block component_address_form_additional_field1_error %}
  95.                         {% if violationPath %}
  96.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  97.                         {% endif %}
  98.                     {% endblock %}
  99.                 </div>
  100.             {% endif %}
  101.         {% endblock %}
  102.         {% block component_address_form_additional_field2 %}
  103.             {% if config('core.loginRegistration.showAdditionalAddressField2') %}
  104.                 {% if formViolations.getViolations("/additionalAddressLine2") is not empty %}
  105.                     {% set violationPath = "/additionalAddressLine2" %}
  106.                 {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine2") is not empty %}
  107.                     {% set violationPath = "/#{prefix}/additionalAddressLine2" %}
  108.                 {% endif %}
  109.                 <div class="form-group col-md-12">
  110.                     {% block component_address_form_additional_field2_label %}
  111.                         <label class="form-label"
  112.                                for="{{ idPrefix ~ prefix }}AdditionalField2">
  113.                             {{ "address.additionalField2Label"|trans|sw_sanitize }}{{ config('core.loginRegistration.additionalAddressField2Required') ? "general.required"|trans|sw_sanitize }}
  114.                         </label>
  115.                     {% endblock %}
  116.                     {% block component_address_form_additional_field2_input %}
  117.                         <input type="text"
  118.                                class="form-control {% if violationPath %} is-invalid{% endif %}"
  119.                                id="{{ idPrefix ~ prefix }}AdditionalField2"
  120.                                placeholder="{{ "address.additionalField2Placeholder"|trans|striptags }}"
  121.                                name="{{ prefix }}[additionalAddressLine2]"
  122.                                value="{{ data.get('additionalAddressLine2') }}"
  123.                                 {{ config('core.loginRegistration.additionalAddressField2Required') ? 'required="true"' }}>
  124.                     {% endblock %}
  125.                     {% block component_address_form_additional_field2_error %}
  126.                         {% if violationPath %}
  127.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  128.                         {% endif %}
  129.                     {% endblock %}
  130.                 </div>
  131.             {% endif %}
  132.         {% endblock %}
  133.         {% block component_address_form_zipcode_city %}
  134.             {% set zipcodeField %}
  135.                 {% if formViolations.getViolations("/zipcode") is not empty %}
  136.                     {% set violationPath = "/zipcode" %}
  137.                 {% elseif formViolations.getViolations("/#{prefix}/zipcode") is not empty %}
  138.                     {% set violationPath = "/#{prefix}/zipcode" %}
  139.                 {% else %}
  140.                     {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.zipcodeLabel"|trans|sw_sanitize }) %}
  141.                 {% endif %}
  142.                 {% block component_address_form_zipcode_label %}
  143.                     <label class="form-label"
  144.                            for="{{ idPrefix ~ prefix }}AddressZipcode">
  145.                         {{ "address.zipcodeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  146.                     </label>
  147.                 {% endblock %}
  148.                 {% block component_address_form_zipcode_input %}
  149.                     <input type="text"
  150.                            class="form-control{% if violationPath %} is-invalid{% endif %}"
  151.                            id="{{ idPrefix ~ prefix }}AddressZipcode"
  152.                            placeholder="{{ "address.zipcodePlaceholder"|trans|striptags }}"
  153.                            name="{{ prefix }}[zipcode]"
  154.                            value="{{ data.get('zipcode') }}"
  155.                            data-form-validation-required
  156.                            {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  157.                            required="required">
  158.                 {% endblock %}
  159.                 {% block component_address_form_zipcode_error %}
  160.                     {% if violationPath %}
  161.                         {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  162.                     {% endif %}
  163.                 {% endblock %}
  164.             {% endset %}
  165.             {% set cityField %}
  166.                 {% if formViolations.getViolations("/city") is not empty %}
  167.                     {% set violationPath = "/city" %}
  168.                 {% elseif formViolations.getViolations("/#{prefix}/city") is not empty %}
  169.                     {% set violationPath = "/#{prefix}/city" %}
  170.                 {% else %}
  171.                     {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.cityLabel"|trans|sw_sanitize }) %}
  172.                     {% set violationPath = null %}
  173.                 {% endif %}
  174.                 {% block component_address_form_city_label %}
  175.                     <label class="form-label"
  176.                            for="{{ idPrefix ~ prefix }}AddressCity">
  177.                         {{ "address.cityLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  178.                     </label>
  179.                 {% endblock %}
  180.                 {% block component_address_form_city_input %}
  181.                     <input type="text"
  182.                            class="form-control{% if violationPath %} is-invalid{% endif %}"
  183.                            id="{{ idPrefix ~ prefix }}AddressCity"
  184.                            placeholder="{{ "address.cityPlaceholder"|trans|striptags }}"
  185.                            name="{{ prefix }}[city]"
  186.                            value="{{ data.get('city') }}"
  187.                            data-form-validation-required
  188.                            {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  189.                            required="required">
  190.                 {% endblock %}
  191.                 {% block component_address_form_city_error %}
  192.                     {% if violationPath %}
  193.                         {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  194.                     {% endif %}
  195.                 {% endblock %}
  196.             {% endset %}
  197.             {% if config('core.address.showZipcodeInFrontOfCity') %}
  198.                 <div class="form-group col-md-4 col-lg-2">
  199.                     {{ zipcodeField }}
  200.                 </div>
  201.                 <div class="form-group col-md-8 col-lg-10">
  202.                     {{ cityField }}
  203.                 </div>
  204.             {% else %}
  205.                 <div class="form-group col-md-8 col-lg-10">
  206.                     {{ cityField }}
  207.                 </div>
  208.                 <div class="form-group col-md-4 col-lg-2">
  209.                     {{ zipcodeField }}
  210.                 </div>
  211.             {% endif %}
  212.         {% endblock %}
  213.     </div>
  214.     <div class="{{ formRowClass }} country-and-state-form-elements" data-country-state-select="true">
  215.         {% block component_address_form_country %}
  216.             <div class="form-group col-md-6">
  217.                 {% set initialCountryId = null %}
  218.                 {% if data.get('countryId') %}
  219.                     {% set initialCountryId = data.get('countryId') %}
  220.                 {% elseif page.countries|length > 1 %}
  221.                     {% set initialCountryId = (page.countries|first).id %}
  222.                 {% endif %}
  223.                 {% if formViolations.getViolations("/countryId") is not empty %}
  224.                     {% set violationPath = "/countryId" %}
  225.                 {% elseif formViolations.getViolations("/#{prefix}/countryId") is not empty %}
  226.                     {% set violationPath = "/#{prefix}/countryId" %}
  227.                 {% endif %}
  228.                 {% block component_address_form_country_label %}
  229.                     <label class="form-label"
  230.                            for="{{ idPrefix ~ prefix }}AddressCountry">
  231.                         {{ "address.countryLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  232.                     </label>
  233.                 {% endblock %}
  234.                 {% block component_address_form_country_select %}
  235.                     <select class="country-select {{ formSelectClass }}{% if violationPath %} is-invalid{% endif %}"
  236.                             id="{{ idPrefix ~ prefix }}AddressCountry"
  237.                             name="{{ prefix }}[countryId]"
  238.                             required="required"
  239.                             data-initial-country-id="{{ initialCountryId }}">
  240.                         {% if not initialCountryId %}
  241.                             <option disabled="disabled"
  242.                                     value=""
  243.                                     selected="selected">
  244.                                 {{ "address.countryPlaceholder"|trans|sw_sanitize }}
  245.                             </option>
  246.                         {% endif %}
  247.                         {% for country in page.countries %}
  248.                             <option {% if country.id == initialCountryId %}
  249.                                 selected="selected"
  250.                             {% endif %}
  251.                                     value="{{ country.id }}"
  252.                                     data-vat-id-required="{{ country.vatIdRequired }}"
  253.                                     data-state-required="{{ country.forceStateInRegistration }}"
  254.                                     {% if feature('FEATURE_NEXT_15707') and  not country.shippingAvailable and disableNonShippableCountries %}
  255.                                 disabled="disabled"
  256.                                     {% endif %}>
  257.                                 {{ country.translated.name }}{% if feature('FEATURE_NEXT_15707') and showNoShippingPostfix and not country.shippingAvailable %} {{ "address.countryPostfixNoShipping"|trans|sw_sanitize }}{% endif %}
  258.                             </option>
  259.                         {% endfor %}
  260.                     </select>
  261.                 {% endblock %}
  262.             </div>
  263.             <div class="form-group col-md-6  d-none">
  264.                 {% if formViolations.getViolations("/countryStateId") is not empty %}
  265.                     {% set violationPath = "/countryStateId" %}
  266.                 {% elseif formViolations.getViolations("/#{prefix}/countryStateId") is not empty %}
  267.                     {% set violationPath = "/#{prefix}/countryStateId" %}
  268.                 {% endif %}
  269.                 {% block component_address_form_country_state_label %}
  270.                     <label class="form-label"
  271.                            for="{{ idPrefix ~ prefix }}AddressCountryState">
  272.                         {{ "address.countryStateLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  273.                     </label>
  274.                 {% endblock %}
  275.                 {% block component_address_form_country_state_select %}
  276.                     <select class="country-state-select {{ formSelectClass }}{% if violationPath %} is-invalid{% endif %}"
  277.                             id="{{ idPrefix ~ prefix }}AddressCountryState"
  278.                             name="{{ prefix }}[countryStateId]"
  279.                             data-initial-country-state-id="{{ data.get('countryStateId') }}">
  280.                         <option value=""
  281.                                 selected="selected"
  282.                                 data-placeholder-option="true">
  283.                             {{ "address.countryStatePlaceholder"|trans|sw_sanitize }}
  284.                         </option>
  285.                     </select>
  286.                 {% endblock %}
  287.                 {% block component_address_form_country_error %}
  288.                     {% if violationPath %}
  289.                         {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  290.                     {% endif %}
  291.                 {% endblock %}
  292.             </div>
  293.         {% endblock %}
  294.     </div>
  295. {% endblock %}