vendor/shopware/storefront/Resources/views/storefront/component/address/address-form.html.twig line 1

Open in your IDE?
  1. {% block component_address_form %}
  2.     {% block component_address_form_addressId %}
  3.         {% if data.get('id') %}
  4.             <input type="hidden"
  5.                    name="{{ prefix }}[id]"
  6.                    value="{{ data.get('id') }}">
  7.         {% endif %}
  8.     {% endblock %}
  9.     {% block component_address_form_company %}
  10.         {% if showFormCompany %}
  11.             {% if config('core.loginRegistration.showAccountTypeSelection') %}
  12.                 {% set accountTypeRequired = true %}
  13.             {% endif %}
  14.             {% if config('core.loginRegistration.showAccountTypeSelection') or prefix == "address" or prefix == "shippingAddress" or hasSelectedBusiness %}
  15.                 <div class="{% if prefix == "shippingAddress" or hasSelectedBusiness %}address-contact-type-company{% elseif prefix == "address" %}js-field-toggle-contact-type-company d-block{% else %}js-field-toggle-contact-type-company d-none{% endif %}">
  16.                     {% block component_address_form_company_fields %}
  17.                         <div class="form-row">
  18.                             {% block component_address_form_company_name %}
  19.                                 <div class="form-group{% if showVatIdField %} col-12{% else %} col-6{% endif %}">
  20.                                     {% if formViolations.getViolations("/company") is not empty %}
  21.                                         {% set violationPath = "/company" %}
  22.                                     {% elseif formViolations.getViolations("/#{prefix}/company") is not empty %}
  23.                                         {% set violationPath = "/#{prefix}/company" %}
  24.                                     {% endif %}
  25.                                     {% block component_address_form_company_name_label %}
  26.                                         <label class="form-label"
  27.                                                for="{{ prefix }}company">
  28.                                             {{ "address.companyNameLabel"|trans|sw_sanitize }}{% if prefix != "shippingAddress" and accountTypeRequired %}{{ "general.required"|trans|sw_sanitize }}{% endif %}
  29.                                         </label>
  30.                                     {% endblock %}
  31.                                     {% block component_address_form_company_name_input %}
  32.                                         <input type="text"
  33.                                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  34.                                                id="{{ prefix }}company"
  35.                                                placeholder="{{ "address.companyNamePlaceholder"|trans|striptags }}"
  36.                                                name="{{ prefix }}[company]"
  37.                                                value="{{ data.get('company') }}"
  38.                                                {% if prefix != "shippingAddress" and accountTypeRequired %}required="required"{% endif %}>
  39.                                     {% endblock %}
  40.                                     {% block component_address_form_company_name_input_error %}
  41.                                         {% if violationPath %}
  42.                                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  43.                                         {% endif %}
  44.                                     {% endblock %}
  45.                                 </div>
  46.                             {% endblock %}
  47.                         {% if showVatIdField %}
  48.                             </div>
  49.                             <div class="form-row">
  50.                         {% endif %}
  51.                             {% block component_address_form_company_department %}
  52.                                 <div class="form-group col-md-6">
  53.                                     {% if formViolations.getViolations("/department") is not empty %}
  54.                                         {% set violationPath = "/department" %}
  55.                                     {% elseif formViolations.getViolations("/#{prefix}/department") is not empty %}
  56.                                         {% set violationPath = "/#{prefix}/department" %}
  57.                                     {% endif %}
  58.                                     {% block component_address_form_company_department_label %}
  59.                                         <label class="form-label"
  60.                                                for="{{ prefix }}department">
  61.                                             {{ "address.companyDepartmentLabel"|trans|sw_sanitize }}
  62.                                         </label>
  63.                                     {% endblock %}
  64.                                     {% block component_address_form_company_department_input %}
  65.                                         <input type="text"
  66.                                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  67.                                                id="{{ prefix }}department"
  68.                                                placeholder="{{ "address.companyDepartmentPlaceholder"|trans|striptags }}"
  69.                                                name="{{ prefix }}[department]"
  70.                                                value="{{ data.get('department') }}">
  71.                                     {% endblock %}
  72.                                     {% block component_address_form_company_department_input_error %}
  73.                                         {% if violationPath %}
  74.                                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  75.                                         {% endif %}
  76.                                     {% endblock %}
  77.                                 </div>
  78.                             {% endblock %}
  79.                             {% block component_address_form_company_vatId %}
  80.                                 {% if showVatIdField %}
  81.                                     <div class="form-group col-md-6">
  82.                                         {% if formViolations.getViolations("/vatId") is not empty %}
  83.                                             {% set violationPath = "/vatId" %}
  84.                                         {% elseif formViolations.getViolations("/#{prefix}/vatId") is not empty %}
  85.                                             {% set violationPath = "/#{prefix}/vatId" %}
  86.                                         {% endif %}
  87.                                         {% block component_address_form_company_vatId_label %}
  88.                                             <label class="form-label"
  89.                                                    for="{{ prefix }}vatId">
  90.                                                 {{ "address.companyVatLabel"|trans|sw_sanitize }}
  91.                                             </label>
  92.                                         {% endblock %}
  93.                                         {% block component_address_form_company_vatId_input %}
  94.                                             <input type="text"
  95.                                                    class="form-control{% if violationPath %} is-invalid{% endif %}"
  96.                                                    id="{{ prefix }}vatId"
  97.                                                    placeholder="{{ "address.companyVatPlaceholder"|trans|striptags }}"
  98.                                                    name="{{ prefix }}[vatId]"
  99.                                                    value="{{ data.get('vatId') }}">
  100.                                         {% endblock %}
  101.                                         {% block component_address_form_company_vatId_input_error %}
  102.                                             {% if violationPath %}
  103.                                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  104.                                             {% endif %}
  105.                                         {% endblock %}
  106.                                     </div>
  107.                                 {% endif %}
  108.                             {% endblock %}
  109.                         </div>
  110.                     {% endblock %}
  111.                 </div>
  112.             {% endif %}
  113.         {% endif %}
  114.     {% endblock %}
  115.     {% block component_address_form_address_fields %}
  116.         <div class="form-row">
  117.             {% block component_address_form_street %}
  118.                 <div class="form-group col-md-6">
  119.                     {% if formViolations.getViolations("/street") is not empty %}
  120.                         {% set violationPath = "/street" %}
  121.                     {% elseif formViolations.getViolations("/#{prefix}/street") is not empty %}
  122.                         {% set violationPath = "/#{prefix}/street" %}
  123.                     {% endif %}
  124.                     {% block component_address_form_street_label %}
  125.                         <label class="form-label"
  126.                                for="{{ prefix }}AddressStreet">
  127.                             {{ "address.streetLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  128.                         </label>
  129.                     {% endblock %}
  130.                     {% block component_address_form_street_input %}
  131.                         <input type="text"
  132.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  133.                                id="{{ prefix }}AddressStreet"
  134.                                placeholder="{{ "address.streetPlaceholder"|trans|striptags }}"
  135.                                name="{{ prefix }}[street]"
  136.                                value="{{ data.get('street') }}"
  137.                                required="required">
  138.                     {% endblock %}
  139.                     {% block component_address_form_street_input_error %}
  140.                         {% if violationPath %}
  141.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  142.                         {% endif %}
  143.                     {% endblock %}
  144.                 </div>
  145.             {% endblock %}
  146.             {% block component_address_form_zipcode_city %}
  147.                 {% set zipcodeField %}
  148.                     {% if formViolations.getViolations("/zipcode") is not empty %}
  149.                         {% set violationPath = "/zipcode" %}
  150.                     {% elseif formViolations.getViolations("/#{prefix}/zipcode") is not empty %}
  151.                         {% set violationPath = "/#{prefix}/zipcode" %}
  152.                     {% endif %}
  153.                     {% block component_address_form_zipcode_label %}
  154.                         <label class="form-label"
  155.                                for="{{ prefix }}AddressZipcode">
  156.                             {{ "address.zipcodeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  157.                         </label>
  158.                     {% endblock %}
  159.                     {% block component_address_form_zipcode_input %}
  160.                         <input type="text"
  161.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  162.                                id="{{ prefix }}AddressZipcode"
  163.                                placeholder="{{ "address.zipcodePlaceholder"|trans|striptags }}"
  164.                                name="{{ prefix }}[zipcode]"
  165.                                value="{{ data.get('zipcode') }}"
  166.                                required="required">
  167.                     {% endblock %}
  168.                     {% block component_address_form_zipcode_error %}
  169.                         {% if violationPath %}
  170.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  171.                         {% endif %}
  172.                     {% endblock %}
  173.                 {% endset %}
  174.                 {% set cityField %}
  175.                     {% if formViolations.getViolations("/city") is not empty %}
  176.                         {% set violationPath = "/city" %}
  177.                     {% elseif formViolations.getViolations("/#{prefix}/city") is not empty %}
  178.                         {% set violationPath = "/#{prefix}/city" %}
  179.                     {% else %}
  180.                         {% set violationPath = null %}
  181.                     {% endif %}
  182.                     {% block component_address_form_city_label %}
  183.                         <label class="form-label"
  184.                                for="{{ prefix }}AddressCity">
  185.                             {{ "address.cityLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  186.                         </label>
  187.                     {% endblock %}
  188.                     {% block component_address_form_city_input %}
  189.                         <input type="text"
  190.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  191.                                id="{{ prefix }}AddressCity"
  192.                                placeholder="{{ "address.cityPlaceholder"|trans|striptags }}"
  193.                                name="{{ prefix }}[city]"
  194.                                value="{{ data.get('city') }}"
  195.                                required="required">
  196.                     {% endblock %}
  197.                     {% block component_address_form_city_error %}
  198.                         {% if violationPath %}
  199.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  200.                         {% endif %}
  201.                     {% endblock %}
  202.                 {% endset %}
  203.                 {% if config('core.address.showZipcodeInFrontOfCity') %}
  204.                     <div class="form-group col-md-2 col-4">
  205.                         {{ zipcodeField }}
  206.                     </div>
  207.                     <div class="form-group col-md-4 col-8">
  208.                         {{ cityField }}
  209.                     </div>
  210.                 {% else %}
  211.                     <div class="form-group col-md-4 col-8">
  212.                         {{ cityField }}
  213.                     </div>
  214.                     <div class="form-group col-md-2 col-4">
  215.                         {{ zipcodeField }}
  216.                     </div>
  217.                 {% endif %}
  218.             {% endblock %}
  219.             {% block component_address_form_additional_field1 %}
  220.                 {% if config('core.loginRegistration.showAdditionalAddressField1') %}
  221.                     {% if formViolations.getViolations("/additionalAddressLine1") is not empty %}
  222.                         {% set violationPath = "/additionalAddressLine1" %}
  223.                     {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine1") is not empty %}
  224.                         {% set violationPath = "/#{prefix}/additionalAddressLine1" %}
  225.                     {% endif %}
  226.                     <div class="form-group col-md-6">
  227.                         {% block component_address_form_additional_field1_label %}
  228.                             <label class="form-label"
  229.                                    for="{{ prefix }}AdditionalField1">
  230.                                 {{ "address.additionalField1Label"|trans|sw_sanitize }}{{ config('core.loginRegistration.additionalAddressField1Required') ? "general.required"|trans|sw_sanitize }}
  231.                             </label>
  232.                         {% endblock %}
  233.                         {% block component_address_form_additional_field1_input %}
  234.                             <input type="text"
  235.                                    class="form-control {% if violationPath %} is-invalid{% endif %}"
  236.                                    id="{{ prefix }}AdditionalField1"
  237.                                    placeholder="{{ "address.additionalField1Placeholder"|trans|striptags }}"
  238.                                    name="{{ prefix }}[additionalAddressLine1]"
  239.                                    value="{{ data.get('additionalAddressLine1') }}"
  240.                                     {{ config('core.loginRegistration.additionalAddressField1Required') ? 'required="true"' }}>
  241.                         {% endblock %}
  242.                         {% block component_address_form_additional_field1_error %}
  243.                             {% if violationPath %}
  244.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  245.                             {% endif %}
  246.                         {% endblock %}
  247.                     </div>
  248.                 {% endif %}
  249.             {% endblock %}
  250.             {% block component_address_form_additional_field2 %}
  251.                 {% if config('core.loginRegistration.showAdditionalAddressField2') %}
  252.                     {% if formViolations.getViolations("/additionalAddressLine2") is not empty %}
  253.                         {% set violationPath = "/additionalAddressLine2" %}
  254.                     {% elseif formViolations.getViolations("/#{prefix}/additionalAddressLine2") is not empty %}
  255.                         {% set violationPath = "/#{prefix}/additionalAddressLine2" %}
  256.                     {% endif %}
  257.                     <div class="form-group col-md-6">
  258.                         {% block component_address_form_additional_field2_label %}
  259.                             <label class="form-label"
  260.                                    for="{{ prefix }}AdditionalField2">
  261.                                 {{ "address.additionalField2Label"|trans|sw_sanitize }}{{ config('core.loginRegistration.additionalAddressField2Required') ? "general.required"|trans|sw_sanitize }}
  262.                             </label>
  263.                         {% endblock %}
  264.                         {% block component_address_form_additional_field2_input %}
  265.                             <input type="text"
  266.                                    class="form-control {% if violationPath %} is-invalid{% endif %}"
  267.                                    id="{{ prefix }}AdditionalField2"
  268.                                    placeholder="{{ "address.additionalField2Placeholder"|trans|striptags }}"
  269.                                    name="{{ prefix }}[additionalAddressLine2]"
  270.                                    value="{{ data.get('additionalAddressLine2') }}"
  271.                                     {{ config('core.loginRegistration.additionalAddressField2Required') ? 'required="true"' }}>
  272.                         {% endblock %}
  273.                         {% block component_address_form_additional_field2_error %}
  274.                             {% if violationPath %}
  275.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  276.                             {% endif %}
  277.                         {% endblock %}
  278.                     </div>
  279.                 {% endif %}
  280.             {% endblock %}
  281.         </div>
  282.         <div class="form-row country-and-state-form-elements" data-country-state-select="true">
  283.             {% block component_address_form_country %}
  284.                 <div class="form-group col-md-6">
  285.                     {% if formViolations.getViolations("/countryId") is not empty %}
  286.                         {% set violationPath = "/countryId" %}
  287.                     {% elseif formViolations.getViolations("/#{prefix}/countryId") is not empty %}
  288.                         {% set violationPath = "/#{prefix}/countryId" %}
  289.                     {% endif %}
  290.                     {% block component_address_form_country_label %}
  291.                         <label class="form-label"
  292.                                for="{{ prefix }}AddressCountry">
  293.                             {{ "address.countryLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  294.                         </label>
  295.                     {% endblock %}
  296.                     {% block component_address_form_country_select %}
  297.                         <select class="country-select custom-select{% if violationPath %} is-invalid{% endif %}"
  298.                                 id="{{ prefix }}AddressCountry"
  299.                                 name="{{ prefix }}[countryId]"
  300.                                 required="required"
  301.                                 data-initial-country-id="{{ data.get('countryId') }}">
  302.                             {% if not data.get('countryId') %}
  303.                                 <option disabled="disabled"
  304.                                         value=""
  305.                                         selected="selected">
  306.                                     {{ "address.countryPlaceholder"|trans|sw_sanitize }}
  307.                                 </option>
  308.                             {% endif %}
  309.                             {% for country in page.countries %}
  310.                                 <option {% if country.id == data.get('countryId') %}
  311.                                         selected="selected"
  312.                                         {% endif %}
  313.                                         value="{{ country.id }}">
  314.                                     {{ country.translated.name }}
  315.                                 </option>
  316.                             {% endfor %}
  317.                         </select>
  318.                     {% endblock %}
  319.                 </div>
  320.                 <div class="form-group col-md-6  d-none">
  321.                     {% if formViolations.getViolations("/countryStateId") is not empty %}
  322.                         {% set violationPath = "/countryStateId" %}
  323.                     {% elseif formViolations.getViolations("/#{prefix}/countryStateId") is not empty %}
  324.                         {% set violationPath = "/#{prefix}/countryStateId" %}
  325.                     {% endif %}
  326.                     {% block component_address_form_country_state_label %}
  327.                         <label class="form-label"
  328.                                for="{{ prefix }}AddressCountry">
  329.                             {{ "address.countryStateLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  330.                         </label>
  331.                     {% endblock %}
  332.                     {% block component_address_form_country_state_select %}
  333.                         <select class="country-state-select custom-select{% if violationPath %} is-invalid{% endif %}"
  334.                                 id="{{ prefix }}AddressCountryState"
  335.                                 name="{{ prefix }}[countryStateId]"
  336.                                 data-initial-country-state-id="{{ data.get('countryStateId') }}">
  337.                             <option value=""
  338.                                     selected="selected"
  339.                                     data-placeholder-option="true">
  340.                                 {{ "address.countryStatePlaceholder"|trans|sw_sanitize }}
  341.                             </option>
  342.                         </select>
  343.                     {% endblock %}
  344.                     {% block component_address_form_country_error %}
  345.                         {% if violationPath %}
  346.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  347.                         {% endif %}
  348.                     {% endblock %}
  349.                 </div>
  350.             {% endblock %}
  351.         </div>
  352.         <div class="form-row">
  353.             {% block component_address_form_phone_number %}
  354.                 {% if config('core.loginRegistration.showPhoneNumberField') %}
  355.                     <div class="form-group col-md-6">
  356.                         {% if formViolations.getViolations("/phoneNumber") is not empty %}
  357.                             {% set violationPath = "/phoneNumber" %}
  358.                         {% elseif formViolations.getViolations("/#{prefix}/phoneNumber") is not empty %}
  359.                             {% set violationPath = "/#{prefix}/phoneNumber" %}
  360.                         {% endif %}
  361.                         {% block component_address_form_phone_number_label %}
  362.                             <label class="form-label"
  363.                                    for="{{ prefix }}AddressPhoneNumber">
  364.                                 {{ "address.phoneNumberLabel"|trans|sw_sanitize }}{{ config('core.loginRegistration.phoneNumberFieldRequired') ? "general.required"|trans|sw_sanitize }}
  365.                             </label>
  366.                         {% endblock %}
  367.                         {% block component_address_form_phone_number_input %}
  368.                             <input type="text"
  369.                                    class="form-control"
  370.                                    id="{{ prefix }}AddressPhoneNumber"
  371.                                    placeholder="{{ "address.phoneNumberPlaceholder"|trans|striptags }}"
  372.                                    name="{{ prefix }}[phoneNumber]"
  373.                                    value="{{ data.get('phoneNumber') }}"
  374.                                 {{ config('core.loginRegistration.phoneNumberFieldRequired') ? 'required="true"' }}>
  375.                         {% endblock %}
  376.                         {% block component_address_form_phone_error %}
  377.                             {% if violationPath %}
  378.                                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  379.                             {% endif %}
  380.                         {% endblock %}
  381.                     </div>
  382.                 {% endif %}
  383.             {% endblock %}
  384.         </div>
  385.     {% endblock %}
  386.     {#TODO: NEXT-2671 - country states#}
  387. {% endblock %}