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