custom/static-plugins/checkout/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="form-row">
  4.         {% block component_address_form_street %}
  5.             <div class="form-row m-0 p-0 form-street-input col-12">
  6.                 {{ parent() }}
  7.             </div>
  8.         {% endblock %}
  9.         {% block component_address_form_zipcode_city %}
  10.             <div class="form-row m-0 p-0 form-zipcode-city-input col-12">
  11.                 {{ parent() }}
  12.             </div>
  13.         {% endblock %}
  14.         {% block component_address_form_additional_field1 %}
  15.             {% if config('core.loginRegistration.showAdditionalAddressField1') %}
  16.                 {% if formViolations.getViolations("/additionalAddressLine1") is not empty %}
  17.                     {% set violationPath = "/additionalAddressLine1" %}
  18.                 {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine1") is not empty %}
  19.                     {% set violationPath = "/#{prefix}/additionalAddressLine1" %}
  20.                 {% endif %}
  21.                 <div class="form-group col-12">
  22.                     {{ block('component_address_form_additional_field1_label') }}
  23.                     {{ block('component_address_form_additional_field1_input') }}
  24.                     {{ block('component_address_form_additional_field1_error') }}
  25.                 </div>
  26.             {% endif %}
  27.         {% endblock %}
  28.         {% block component_address_form_additional_field2 %}
  29.             {% if config('core.loginRegistration.showAdditionalAddressField2') %}
  30.                 {% if formViolations.getViolations("/additionalAddressLine2") is not empty %}
  31.                     {% set violationPath = "/additionalAddressLine2" %}
  32.                 {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine2") is not empty %}
  33.                     {% set violationPath = "/#{prefix}/additionalAddressLine2" %}
  34.                 {% endif %}
  35.                 <div class="form-group col-12">
  36.                     {{ block('component_address_form_additional_field2_label') }}
  37.                     {{ block('component_address_form_additional_field2_input') }}
  38.                     {{ block('component_address_form_additional_field2_error') }}
  39.                 </div>
  40.             {% endif %}
  41.         {% endblock %}
  42.     </div>
  43.     <div class="form-row country-and-state-form-elements" data-country-state-select="true">
  44.         {% block component_address_form_country %}
  45.             <div class="form-group col-6">
  46.                 {% set initialCountryId = null %}
  47.                 {% if 'billing' in prefix %}
  48.                     {% set initialCountryId = context.salesChannel.countryId %}
  49.                 {% endif %}
  50.                 {% if data.get('countryId') %}
  51.                     {% set initialCountryId = data.get('countryId') %}
  52.                 {% endif %}
  53.                 {% if formViolations.getViolations("/countryId") is not empty %}
  54.                     {% set violationPath = "/countryId" %}
  55.                 {% elseif formViolations.getViolations("/#{prefix}/countryId") is not empty %}
  56.                     {% set violationPath = "/#{prefix}/countryId" %}
  57.                 {% endif %}
  58.                 {% block component_address_form_country_label %}
  59.                     <label class="form-label active input-valid"
  60.                            for="{{ prefix }}AddressCountry">
  61.                         {{ "address.countryLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  62.                     </label>
  63.                 {% endblock %}
  64.                 {% block component_address_form_country_select %}
  65.                     <select class="country-select custom-select{% if violationPath %} is-invalid{% endif %} input-valid"
  66.                             id="{{ prefix }}AddressCountry"
  67.                             name="{{ prefix }}[countryId]"
  68.                             required="required"
  69.                             data-initial-country-id="{{ initialCountryId }}">
  70.                         {% if not initialCountryId %}
  71.                             <option disabled="disabled"
  72.                                     value=""
  73.                                     selected="selected">
  74.                                 {{ "address.countryPlaceholder"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  75.                             </option>
  76.                         {% endif %}
  77.                         {% for country in page.countries %}
  78.                             <option {% if country.id == initialCountryId %}
  79.                                 selected="selected"
  80.                             {% endif %}
  81.                                 value="{{ country.id }}"
  82.                                 {% if feature('FEATURE_NEXT_14114') %}
  83.                                 data-vat-id-required="{{ country.vatIdRequired }}"
  84.                                 {% endif %}
  85.                                 {% if feature('FEATURE_NEXT_15707') and  not country.shippingAvailable and disableNonShippableCountries %}
  86.                                 disabled="disabled"
  87.                                 {% endif %}>
  88.                                 {{ country.translated.name }}{% if feature('FEATURE_NEXT_15707') and showNoShippingPostfix and not country.shippingAvailable %} {{ "address.countryPostfixNoShipping"|trans|sw_sanitize }}{% endif %}
  89.                             </option>
  90.                         {% endfor %}
  91.                     </select>
  92.                 {% endblock %}
  93.             </div>
  94.             <div class="form-group col-md-6 d-none">
  95.                 {% if formViolations.getViolations("/countryStateId") is not empty %}
  96.                     {% set violationPath = "/countryStateId" %}
  97.                 {% elseif formViolations.getViolations("/#{prefix}/countryStateId") is not empty %}
  98.                     {% set violationPath = "/#{prefix}/countryStateId" %}
  99.                 {% endif %}
  100.                 {{ block('component_address_form_country_state_label') }}
  101.                 {{ block('component_address_form_country_state_select') }}
  102.                 {{ block('component_address_form_country_error') }}
  103.             </div>
  104.         {% endblock %}
  105.         {% block component_address_form_phone_number %}
  106.             {% if config('core.loginRegistration.showPhoneNumberField') %}
  107.                 <div class="form-group col-6">
  108.                     {% if formViolations.getViolations("/phoneNumber") is not empty %}
  109.                         {% set violationPath = "/phoneNumber" %}
  110.                     {% elseif formViolations.getViolations("/#{prefix}/phoneNumber") is not empty %}
  111.                         {% set violationPath = "/#{prefix}/phoneNumber" %}
  112.                     {% endif %}
  113.                     {% block component_address_form_phone_number_label %}
  114.                         <label class="form-label{% if data.get('phoneNumber') %} active{% endif %}"
  115.                                for="{{ prefix }}AddressPhoneNumber">
  116.                             {{ "address.phoneNumberLabel"|trans|sw_sanitize }}{{ config('core.loginRegistration.phoneNumberFieldRequired') ? "general.required"|trans|sw_sanitize }}
  117.                         </label>
  118.                     {% endblock %}
  119.                     {% block component_address_form_phone_number_input %}
  120.                         <input type="tel"
  121.                                pattern="[+]?[0-9]{8,}"
  122.                                class="form-control"
  123.                                id="{{ prefix }}AddressPhoneNumber"
  124.                                placeholder="{{ "address.phoneNumberPlaceholder"|trans|striptags }}"
  125.                                name="{{ prefix }}[phoneNumber]"
  126.                                value="{{ data.get('phoneNumber') }}"
  127.                             {{ config('core.loginRegistration.phoneNumberFieldRequired') ? 'required="true"' }}>
  128.                     {% endblock %}
  129.                     {{ block('component_address_form_phone_error') }}
  130.                 </div>
  131.             {% endif %}
  132.         {% endblock %}
  133.         <button type="submit" class="d-none"></button>
  134.     </div>
  135. {% endblock %}
  136. {% block component_address_form_zipcode_label %}
  137.     <label class="form-label{% if data.get('zipcode') %} active{% endif %}"
  138.            for="{{ prefix }}AddressZipcode">
  139.         {{ "address.zipcodeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  140.     </label>
  141. {% endblock %}
  142. {% block component_address_form_city_label %}
  143.     <label class="form-label{% if data.get('city') %} active{% endif %}"
  144.            for="{{ prefix }}AddressCity">
  145.         {{ "address.cityLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  146.     </label>
  147. {% endblock %}