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

Open in your IDE?
  1. {# Provides customer type, salutation, title, firstname, lastname and birthday fields for address forms (e.g. registering a user, creating or updating an address) #}
  2. {% block component_address_personal_fields %}
  3.     {% block component_address_personal_account_type %}
  4.         {% if onlyCompanyRegistration or (config('core.loginRegistration.showAccountTypeSelection') and not hideCustomerTypeSelect) %}
  5.             <div class="{{ formRowClass }}">
  6.                 <div class="form-group col-md-3 col-sm-6 contact-type">
  7.                     {% block component_address_personal_account_type_label %}
  8.                         <label class="form-label"
  9.                                for="{{ idPrefix ~ prefix }}accountType">
  10.                             {{ "account.personalTypeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  11.                         </label>
  12.                     {% endblock %}
  13.                     {% block component_address_personal_account_type_select %}
  14.                             {% if onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection') %}
  15.                                 <select name="{% if prefix %}{{ prefix }}[accountType]{% else %}accountType{% endif %}"
  16.                                     id="{{ idPrefix ~ prefix }}accountType"
  17.                                     {% if onlyCompanyRegistration %}disabled{% endif %}
  18.                                     required="required"
  19.                                     class="{{ formSelectClass }} contact-select"
  20.                                     data-form-field-toggle="true"
  21.                                     data-form-field-toggle-target=".js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %}"
  22.                                     data-form-field-toggle-value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
  23.                                     data-form-field-toggle-scope="{% if scope == 'parent' %}parent{% else %}all{% endif %}"
  24.                                     {% if scope == 'parent' %}data-form-field-toggle-parent-selector={{ parentSelector }}{% endif %}
  25.                                 >
  26.                             {% endif %}
  27.                             {% set isCompany = false %}
  28.                             {% if page.address.company or data.company is not empty %}
  29.                                 {% set isCompany  = true %}
  30.                             {% endif %}
  31.                             {% if onlyCompanyRegistration or (accountType and accountType == constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS')) %}
  32.                                 {% set isCompany  = true %}
  33.                             {% endif %}
  34.                             {% set isLoginPage = false %}
  35.                             {% if activeRoute == 'frontend.account.login.page' %}
  36.                                 {% set isLoginPage = true %}
  37.                             {% endif %}
  38.                             {% if isLoginPage %}
  39.                                 <option disabled="disabled"
  40.                                         selected="selected"
  41.                                         value="">
  42.                                     {{ "account.personalTypeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  43.                                 </option>
  44.                             {% endif %}
  45.                             {% if not onlyCompanyRegistration %}
  46.                                 <option value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_PRIVATE') }}"
  47.                                     {% if isCompany == false and isLoginPage == false %} selected="selected"{% endif %}>
  48.                                     {{ "account.personalTypePrivate"|trans|sw_sanitize }}
  49.                                 </option>
  50.                             {% endif %}
  51.                             <option value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
  52.                                 {% if isCompany == true and isLoginPage == false %} selected="selected"{% endif %}>
  53.                                 {{ "account.personalTypeBusiness"|trans|sw_sanitize }}
  54.                             </option>
  55.                         </select>
  56.                         {% if onlyCompanyRegistration %}<input type="hidden" name="accountType" value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}">{% endif %}
  57.                     {% endblock %}
  58.                     {% block component_address_personal_account_type_error %}
  59.                     {% endblock %}
  60.                 </div>
  61.             </div>
  62.         {% elseif not hideCustomerTypeSelect %}
  63.             <input type="hidden" name="accountType">
  64.         {% endif %}
  65.     {% endblock %}
  66.     {% block component_address_personal_fields_salutation_title %}
  67.         <div class="{{ formRowClass }}">
  68.             {% block component_address_personal_fields_salutation %}
  69.                 <div class="form-group col-md-3 col-sm-6">
  70.                     {% block component_address_personal_fields_salutation_label %}
  71.                         <label class="form-label"
  72.                                for="{{ idPrefix ~ prefix }}personalSalutation">
  73.                             {{ "account.personalSalutationLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  74.                         </label>
  75.                     {% endblock %}
  76.                     {% block component_address_form_salutation_select %}
  77.                         <select id="{{ idPrefix ~ prefix }}personalSalutation"
  78.                                 class="{{ formSelectClass }}{% if formViolations.getViolations('/salutationId') is not empty %} is-invalid{% endif %}"
  79.                                 name="{% if prefix %}{{ prefix }}[salutationId]{% else %}salutationId{% endif %}"
  80.                                 required="required">
  81.                             {% if not data.get('salutationId') %}
  82.                                 <option disabled="disabled"
  83.                                         selected="selected"
  84.                                         value="">
  85.                                     {{ "account.personalSalutationPlaceholder"|trans|sw_sanitize }}
  86.                                 </option>
  87.                             {% endif %}
  88.                             {% for salutation in page.salutations %}
  89.                                 <option {% if salutation.id == data.get('salutationId') %}
  90.                                     selected="selected"
  91.                                 {% endif %}
  92.                                         value="{{ salutation.id }}">
  93.                                     {{ salutation.translated.displayName }}
  94.                                 </option>
  95.                             {% endfor %}
  96.                         </select>
  97.                     {% endblock %}
  98.                     {% block component_address_form_salutation_select_error %}
  99.                         {% if formViolations.getViolations('/salutationId') is not empty %}
  100.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  101.                                 violationPath: '/salutationId'
  102.                             } %}
  103.                         {% endif %}
  104.                     {% endblock %}
  105.                 </div>
  106.             {% endblock %}
  107.             {% block component_address_personal_fields_title %}
  108.                 {% if config('core.loginRegistration.showTitleField') %}
  109.                     <div class="form-group col-md-3 col-sm-6">
  110.                         {% block component_address_personal_fields_title_label %}
  111.                             <label class="form-label"
  112.                                    for="{{ idPrefix ~ prefix }}personalTitle">
  113.                                 {{ "account.personalTitleLabel"|trans|sw_sanitize }}
  114.                             </label>
  115.                         {% endblock %}
  116.                         {% block component_address_personal_fields_title_input %}
  117.                             <input type="text"
  118.                                    class="form-control"
  119.                                    autocomplete="section-personal title"
  120.                                    id="{{ idPrefix ~ prefix }}personalTitle"
  121.                                    placeholder="{{ "account.personalTitlePlaceholder"|trans|striptags }}"
  122.                                    name="{% if prefix %}{{ prefix }}[title]{% else %}title{% endif %}"
  123.                                    value="{{ data.get('title') }}">
  124.                         {% endblock %}
  125.                     </div>
  126.                 {% endif %}
  127.             {% endblock %}
  128.         </div>
  129.     {% endblock %}
  130.     {% block component_address_personal_fields_name %}
  131.         <div class="{{ formRowClass }}">
  132.             {% block component_address_personal_fields_first_name %}
  133.                 <div class="form-group col-sm-6">
  134.                     {% if formViolations.getViolations("/firstName") is not empty %}
  135.                         {% set violationPath = "/firstName" %}
  136.                     {% else %}
  137.                         {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "account.personalFirstNameLabel"|trans|sw_sanitize }) %}
  138.                     {% endif %}
  139.                     {% block component_address_personal_fields_first_name_label %}
  140.                         <label class="form-label"
  141.                                for="{{ idPrefix ~ prefix }}personalFirstName">
  142.                             {{ "account.personalFirstNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  143.                         </label>
  144.                     {% endblock %}
  145.                     {% block component_address_personal_fields_first_name_input %}
  146.                         <input type="text"
  147.                                class="form-control{% if violationPath is not empty %} is-invalid{% endif %}"
  148.                                autocomplete="section-personal given-name"
  149.                                id="{{ idPrefix ~ prefix }}personalFirstName"
  150.                                placeholder="{{ "account.personalFirstNamePlaceholder"|trans|striptags }}"
  151.                                name="{% if prefix %}{{ prefix }}[firstName]{% else %}firstName{% endif %}"
  152.                                value="{{ data.get('firstName') }}"
  153.                                data-form-validation-required
  154.                                {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  155.                                required="required">
  156.                     {% endblock %}
  157.                     {% block component_address_personal_fields_first_name_input_error %}
  158.                         {% if violationPath %}
  159.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  160.                         {% endif %}
  161.                     {% endblock %}
  162.                 </div>
  163.             {% endblock %}
  164.             {% block component_address_personal_fields_last_name %}
  165.                 <div class="form-group col-sm-6">
  166.                     {% if formViolations.getViolations("/lastName") is not empty %}
  167.                         {% set violationPath = "/lastName" %}
  168.                     {% else %}
  169.                         {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "account.personalLastNameLabel"|trans|sw_sanitize }) %}
  170.                     {% endif %}
  171.                     {% block component_address_personal_fields_last_name_label %}
  172.                         <label class="form-label"
  173.                                for="{{ idPrefix ~ prefix }}personalLastName">
  174.                             {{ "account.personalLastNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  175.                         </label>
  176.                     {% endblock %}
  177.                     {% block component_address_personal_fields_last_name_input %}
  178.                         <input type="text"
  179.                                class="form-control{% if violationPath %} is-invalid{% endif %}"
  180.                                autocomplete="section-personal family-name"
  181.                                id="{{ idPrefix ~ prefix }}personalLastName"
  182.                                placeholder="{{ "account.personalLastNamePlaceholder"|trans|striptags }}"
  183.                                name="{% if prefix %}{{ prefix }}[lastName]{% else %}lastName{% endif %}"
  184.                                value="{{ data.get('lastName') }}"
  185.                                data-form-validation-required
  186.                                {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  187.                                required="required">
  188.                     {% endblock %}
  189.                     {% block component_address_personal_fields_last_name_input_error %}
  190.                         {% if violationPath %}
  191.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  192.                         {% endif %}
  193.                     {% endblock %}
  194.                 </div>
  195.             {% endblock %}
  196.         </div>
  197.     {% endblock %}
  198.     {% block component_address_personal_company %}
  199.         {% if (onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection')) and activeRoute == 'frontend.account.profile.page' %}
  200.             <div class="js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %}">
  201.                 {% block component_address_personal_company_fields %}
  202.                     <div class="{{ formRowClass }}">
  203.                         {% block component_address_personal_company_name %}
  204.                             <div class="form-group col-12">
  205.                                 {% if formViolations.getViolations("/company") is not empty %}
  206.                                     {% set violationPath = "/company" %}
  207.                                 {% else %}
  208.                                     {% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.companyNameLabel"|trans|sw_sanitize }) %}
  209.                                 {% endif %}
  210.                                 {% block component_address_personal_company_name_label %}
  211.                                     <label class="form-label" for="{{ idPrefix ~ prefix }}company">
  212.                                         {{ "address.companyNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  213.                                     </label>
  214.                                 {% endblock %}
  215.                                 {% block component_address_personal_company_name_input %}
  216.                                     <input type="text"
  217.                                            class="form-control{% if violationPath %} is-invalid{% endif %}"
  218.                                            id="{{ idPrefix ~ prefix }}company"
  219.                                            placeholder="{{ "address.companyNamePlaceholder"|trans|striptags }}"
  220.                                            name="company"
  221.                                            value="{{ data.get('company') }}"
  222.                                            data-form-validation-required
  223.                                            {% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
  224.                                            required="required">
  225.                                 {% endblock %}
  226.                                 {% block component_address_personal_company_name_input_error %}
  227.                                     {% if violationPath %}
  228.                                         {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  229.                                     {% endif %}
  230.                                 {% endblock %}
  231.                             </div>
  232.                         {% endblock %}
  233.                     </div>
  234.                 {% endblock %}
  235.             </div>
  236.         {% endif %}
  237.     {% endblock %}
  238.     {% block component_address_personal_vat_id %}
  239.         {% if showVatIdField %}
  240.             {% if config('core.loginRegistration.showAccountTypeSelection') or onlyCompanyRegistration %}
  241.                 <div class="js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %} js-field-toggle-contact-type-vat-id">
  242.                     {% block component_address_personal_vat_id_fields %}
  243.                         <div class="{{ formRowClass }}">
  244.                             <div class="form-group col-12">
  245.                                 {% sw_include '@Storefront/storefront/component/address/address-personal-vat-id.html.twig' with {
  246.                                     'vatIds': data.get('vatIds'),
  247.                                     'editMode': true
  248.                                 } %}
  249.                             </div>
  250.                         </div>
  251.                     {% endblock %}
  252.                 </div>
  253.             {% endif %}
  254.         {% endif %}
  255.     {% endblock %}
  256.     {% block component_address_personal_fields_birthday %}
  257.         {% if showBirthdayField %}
  258.             {% block component_address_personal_fields_birthday_label %}
  259.                 <label for="{{ idPrefix ~ prefix }}personalBirthday">
  260.                     {{ "account.personalBirthdayLabel"|trans|sw_sanitize }}{{ config('core.loginRegistration.birthdayFieldRequired') ? "general.required"|trans|sw_sanitize }}
  261.                 </label>
  262.             {% endblock %}
  263.             {% block component_address_personal_fields_birthday_selects %}
  264.                 <div class="{{ formRowClass }}">
  265.                     {% block component_address_personal_fields_birthday_select_day %}
  266.                         <div class="form-group col-md-2 col-4">
  267.                             <select id="{{ idPrefix ~ prefix }}personalBirthday"
  268.                                     name="{% if prefix %}{{ prefix }}[birthdayDay]{% else %}birthdayDay{% endif %}"
  269.                                     class="{{ formSelectClass }}{% if formViolations.getViolations('/birthdayDay') is not empty %} is-invalid{% endif %}"
  270.                                     {{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
  271.                                 {% if not data.get('birthdayDay') %}
  272.                                     <option selected="selected"
  273.                                             value="">
  274.                                         {{ "account.personalBirthdaySelectDay"|trans|sw_sanitize }}
  275.                                     </option>
  276.                                 {% endif %}
  277.                                 {% for day in range(1, 31) %}
  278.                                     <option value="{{ day }}"
  279.                                             {% if day == data.get('birthdayDay') %} selected="selected"{% endif %}>
  280.                                         {{ day }}
  281.                                     </option>
  282.                                 {% endfor %}
  283.                             </select>
  284.                             {% block component_address_personal_fields_birthday_select_day_error %}
  285.                                 {% if formViolations.getViolations('/birthdayDay') is not empty %}
  286.                                     {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  287.                                         violationPath: '/birthdayDay'
  288.                                     } %}
  289.                                 {% endif %}
  290.                             {% endblock %}
  291.                         </div>
  292.                     {% endblock %}
  293.                     {% block component_address_personal_fields_birthday_select_month %}
  294.                         <div class="form-group col-md-2 col-4">
  295.                             <select name="{% if prefix %}{{ prefix }}[birthdayMonth]{% else %}birthdayMonth{% endif %}"
  296.                                     class="{{ formSelectClass }}{% if formViolations.getViolations('/birthdayMonth') is not empty %} is-invalid{% endif %}"
  297.                                     {{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
  298.                                 {% if not data.get('birthdayMonth') %}
  299.                                     <option selected="selected"
  300.                                             value="">
  301.                                         {{ "account.personalBirthdaySelectMonth"|trans|sw_sanitize }}
  302.                                     </option>
  303.                                 {% endif %}
  304.                                 {% for month in range(1, 12) %}
  305.                                     <option value="{{ month }}"
  306.                                             {% if month == data.get('birthdayMonth') %} selected="selected"{% endif %}>
  307.                                         {{ month }}
  308.                                     </option>
  309.                                 {% endfor %}
  310.                             </select>
  311.                             {% block component_address_personal_fields_birthday_select_month_error %}
  312.                                 {% if formViolations.getViolations('/birthdayMonth') is not empty %}
  313.                                     {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  314.                                         violationPath: '/birthdayMonth'
  315.                                     } %}
  316.                                 {% endif %}
  317.                             {% endblock %}
  318.                         </div>
  319.                     {% endblock %}
  320.                     {% block component_address_personal_fields_birthday_select_year %}
  321.                         <div class="form-group col-md-2 col-4">
  322.                             {% set currentYear = "now"|date('Y') %}
  323.                             {% set startYear = currentYear - 120 %}
  324.                             <select name="{% if prefix %}{{ prefix }}[birthdayYear]{% else %}birthdayYear{% endif %}"
  325.                                     class="{{ formSelectClass }}{% if formViolations.getViolations('/birthdayYear') is not empty %} is-invalid{% endif %}"
  326.                                     {{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
  327.                                 {% if not data.get('birthdayYear') %}
  328.                                     <option selected="selected"
  329.                                             value="">
  330.                                         {{ "account.personalBirthdaySelectYear"|trans|sw_sanitize }}
  331.                                     </option>
  332.                                 {% endif %}
  333.                                 {% for year in range(currentYear, startYear) %}
  334.                                     <option value="{{ year }}"
  335.                                             {% if year == data.get('birthdayYear') %} selected="selected"{% endif %}>
  336.                                         {{ year }}
  337.                                     </option>
  338.                                 {% endfor %}
  339.                             </select>
  340.                             {% block component_address_personal_fields_birthday_select_year_error %}
  341.                                 {% if formViolations.getViolations('/birthdayYear') is not empty %}
  342.                                     {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  343.                                         violationPath: '/birthdayYear'
  344.                                     } %}
  345.                                 {% endif %}
  346.                             {% endblock %}
  347.                         </div>
  348.                     {% endblock %}
  349.                 </div>
  350.             {% endblock %}
  351.         {% endif %}
  352.     {% endblock %}
  353. {% endblock %}