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="form-row">
  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="custom-select 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="form-row">
  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="custom-select{% 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="form-row">
  132.             {% block component_address_personal_fields_first_name %}
  133.                 <div class="form-group col-sm-6">
  134.                     {% block component_address_personal_fields_first_name_label %}
  135.                         <label class="form-label"
  136.                                for="{{ idPrefix ~ prefix }}personalFirstName">
  137.                             {{ "account.personalFirstNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  138.                         </label>
  139.                     {% endblock %}
  140.                     {% block component_address_personal_fields_first_name_input %}
  141.                         <input type="text"
  142.                                class="form-control{% if formViolations.getViolations('/firstName') is not empty %} is-invalid{% endif %}"
  143.                                autocomplete="section-personal given-name"
  144.                                id="{{ idPrefix ~ prefix }}personalFirstName"
  145.                                placeholder="{{ "account.personalFirstNamePlaceholder"|trans|striptags }}"
  146.                                name="{% if prefix %}{{ prefix }}[firstName]{% else %}firstName{% endif %}"
  147.                                value="{{ data.get('firstName') }}"
  148.                                required="required">
  149.                     {% endblock %}
  150.                     {% block component_address_personal_fields_first_name_input_error %}
  151.                         {% if formViolations.getViolations('/firstName') is not empty %}
  152.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  153.                                 violationPath: '/firstName'
  154.                             } %}
  155.                         {% endif %}
  156.                     {% endblock %}
  157.                 </div>
  158.             {% endblock %}
  159.             {% block component_address_personal_fields_last_name %}
  160.                 <div class="form-group col-sm-6">
  161.                     {% block component_address_personal_fields_last_name_label %}
  162.                         <label class="form-label"
  163.                                for="{{ idPrefix ~ prefix }}personalLastName">
  164.                             {{ "account.personalLastNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  165.                         </label>
  166.                     {% endblock %}
  167.                     {% block component_address_personal_fields_last_name_input %}
  168.                         <input type="text"
  169.                                class="form-control{% if formViolations.getViolations('/lastName') is not empty %} is-invalid{% endif %}"
  170.                                autocomplete="section-personal family-name"
  171.                                id="{{ idPrefix ~ prefix }}personalLastName"
  172.                                placeholder="{{ "account.personalLastNamePlaceholder"|trans|striptags }}"
  173.                                name="{% if prefix %}{{ prefix }}[lastName]{% else %}lastName{% endif %}"
  174.                                value="{{ data.get('lastName') }}"
  175.                                required="required">
  176.                     {% endblock %}
  177.                     {% block component_address_personal_fields_last_name_input_error %}
  178.                         {% if formViolations.getViolations('/lastName') is not empty %}
  179.                             {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  180.                                 violationPath: '/lastName'
  181.                             } %}
  182.                         {% endif %}
  183.                     {% endblock %}
  184.                 </div>
  185.             {% endblock %}
  186.         </div>
  187.     {% endblock %}
  188.     {% block component_address_personal_company %}
  189.         {% if (onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection')) and activeRoute == 'frontend.account.profile.page' %}
  190.             <div class="js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %}">
  191.                 {% block component_address_personal_company_fields %}
  192.                     <div class="form-row">
  193.                         {% block component_address_personal_company_name %}
  194.                             <div class="form-group col-12">
  195.                                 {% if formViolations.getViolations("/company") is not empty %}
  196.                                     {% set violationPath = "/company" %}
  197.                                 {% endif %}
  198.                                 {% block component_address_personal_company_name_label %}
  199.                                     <label class="form-label" for="{{ idPrefix ~ prefix }}company">
  200.                                         {{ "address.companyNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
  201.                                     </label>
  202.                                 {% endblock %}
  203.                                 {% block component_address_personal_company_name_input %}
  204.                                     <input type="text"
  205.                                            class="form-control{% if violationPath %} is-invalid{% endif %}"
  206.                                            id="{{ idPrefix ~ prefix }}company"
  207.                                            placeholder="{{ "address.companyNamePlaceholder"|trans|striptags }}"
  208.                                            name="company"
  209.                                            value="{{ data.get('company') }}"
  210.                                            required="required">
  211.                                 {% endblock %}
  212.                                 {% block component_address_personal_company_name_input_error %}
  213.                                     {% if violationPath %}
  214.                                         {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
  215.                                     {% endif %}
  216.                                 {% endblock %}
  217.                             </div>
  218.                         {% endblock %}
  219.                     </div>
  220.                 {% endblock %}
  221.             </div>
  222.         {% endif %}
  223.     {% endblock %}
  224.     {% block component_address_personal_vat_id %}
  225.         {% if showVatIdField %}
  226.             {% if config('core.loginRegistration.showAccountTypeSelection') or onlyCompanyRegistration %}
  227.                 <div class="js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %} js-field-toggle-contact-type-vat-id">
  228.                     {% block component_address_personal_vat_id_fields %}
  229.                         <div class="form-row">
  230.                             <div class="form-group col-12">
  231.                                 {% sw_include '@Storefront/storefront/component/address/address-personal-vat-id.html.twig' with {
  232.                                     'vatIds': data.get('vatIds'),
  233.                                     'editMode': true
  234.                                 } %}
  235.                             </div>
  236.                         </div>
  237.                     {% endblock %}
  238.                 </div>
  239.             {% endif %}
  240.         {% endif %}
  241.     {% endblock %}
  242.     {% block component_address_personal_fields_birthday %}
  243.         {% if showBirthdayField %}
  244.             {% block component_address_personal_fields_birthday_label %}
  245.                 <label for="{{ idPrefix ~ prefix }}personalBirthday">
  246.                     {{ "account.personalBirthdayLabel"|trans|sw_sanitize }}{{ config('core.loginRegistration.birthdayFieldRequired') ? "general.required"|trans|sw_sanitize }}
  247.                 </label>
  248.             {% endblock %}
  249.             {% block component_address_personal_fields_birthday_selects %}
  250.                 <div class="form-row">
  251.                     {% block component_address_personal_fields_birthday_select_day %}
  252.                         <div class="form-group col-md-2 col-4">
  253.                             <select id="{{ idPrefix ~ prefix }}personalBirthday"
  254.                                     name="{% if prefix %}{{ prefix }}[birthdayDay]{% else %}birthdayDay{% endif %}"
  255.                                     class="custom-select{% if formViolations.getViolations('/birthdayDay') is not empty %} is-invalid{% endif %}"
  256.                                     {{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
  257.                                 {% if not data.get('birthdayDay') %}
  258.                                     <option selected="selected"
  259.                                             value="">
  260.                                         {{ "account.personalBirthdaySelectDay"|trans|sw_sanitize }}
  261.                                     </option>
  262.                                 {% endif %}
  263.                                 {% for day in range(1, 31) %}
  264.                                     <option value="{{ day }}"
  265.                                             {% if day == data.get('birthdayDay') %} selected="selected"{% endif %}>
  266.                                         {{ day }}
  267.                                     </option>
  268.                                 {% endfor %}
  269.                             </select>
  270.                             {% block component_address_personal_fields_birthday_select_day_error %}
  271.                                 {% if formViolations.getViolations('/birthdayDay') is not empty %}
  272.                                     {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  273.                                         violationPath: '/birthdayDay'
  274.                                     } %}
  275.                                 {% endif %}
  276.                             {% endblock %}
  277.                         </div>
  278.                     {% endblock %}
  279.                     {% block component_address_personal_fields_birthday_select_month %}
  280.                         <div class="form-group col-md-2 col-4">
  281.                             <select name="{% if prefix %}{{ prefix }}[birthdayMonth]{% else %}birthdayMonth{% endif %}"
  282.                                     class="custom-select{% if formViolations.getViolations('/birthdayMonth') is not empty %} is-invalid{% endif %}"
  283.                                     {{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
  284.                                 {% if not data.get('birthdayMonth') %}
  285.                                     <option selected="selected"
  286.                                             value="">
  287.                                         {{ "account.personalBirthdaySelectMonth"|trans|sw_sanitize }}
  288.                                     </option>
  289.                                 {% endif %}
  290.                                 {% for month in range(1, 12) %}
  291.                                     <option value="{{ month }}"
  292.                                             {% if month == data.get('birthdayMonth') %} selected="selected"{% endif %}>
  293.                                         {{ month }}
  294.                                     </option>
  295.                                 {% endfor %}
  296.                             </select>
  297.                             {% block component_address_personal_fields_birthday_select_month_error %}
  298.                                 {% if formViolations.getViolations('/birthdayMonth') is not empty %}
  299.                                     {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  300.                                         violationPath: '/birthdayMonth'
  301.                                     } %}
  302.                                 {% endif %}
  303.                             {% endblock %}
  304.                         </div>
  305.                     {% endblock %}
  306.                     {% block component_address_personal_fields_birthday_select_year %}
  307.                         <div class="form-group col-md-2 col-4">
  308.                             {% set currentYear = "now"|date('Y') %}
  309.                             {% set startYear = currentYear - 120 %}
  310.                             <select name="{% if prefix %}{{ prefix }}[birthdayYear]{% else %}birthdayYear{% endif %}"
  311.                                     class="custom-select{% if formViolations.getViolations('/birthdayYear') is not empty %} is-invalid{% endif %}"
  312.                                     {{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
  313.                                 {% if not data.get('birthdayYear') %}
  314.                                     <option selected="selected"
  315.                                             value="">
  316.                                         {{ "account.personalBirthdaySelectYear"|trans|sw_sanitize }}
  317.                                     </option>
  318.                                 {% endif %}
  319.                                 {% for year in range(currentYear, startYear) %}
  320.                                     <option value="{{ year }}"
  321.                                             {% if year == data.get('birthdayYear') %} selected="selected"{% endif %}>
  322.                                         {{ year }}
  323.                                     </option>
  324.                                 {% endfor %}
  325.                             </select>
  326.                             {% block component_address_personal_fields_birthday_select_year_error %}
  327.                                 {% if formViolations.getViolations('/birthdayYear') is not empty %}
  328.                                     {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
  329.                                         violationPath: '/birthdayYear'
  330.                                     } %}
  331.                                 {% endif %}
  332.                             {% endblock %}
  333.                         </div>
  334.                     {% endblock %}
  335.                 </div>
  336.             {% endblock %}
  337.         {% endif %}
  338.     {% endblock %}
  339. {% endblock %}