src/Storefront/Resources/views/storefront/component/address/address-personal.html.twig line 1
{# Provides customer type, salutation, title, firstname, lastname and birthday fields for address forms (e.g. registering a user, creating or updating an address) #}
{% block component_address_personal_fields %}
{% block component_address_personal_account_type %}
{% if onlyCompanyRegistration or (config('core.loginRegistration.showAccountTypeSelection') and not hideCustomerTypeSelect) %}
<div class="row g-2">
<div class="form-group col-md-3 col-sm-6 contact-type">
{% block component_address_personal_account_type_label %}
<label class="form-label"
for="{{ idPrefix ~ prefix }}accountType">
{{ "account.personalTypeLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
</label>
{% endblock %}
{% block component_address_personal_account_type_select %}
{% if onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection') %}
<select name="{% if prefix %}{{ prefix }}[accountType]{% else %}accountType{% endif %}"
id="{{ idPrefix ~ prefix }}accountType"
{% if onlyCompanyRegistration %}disabled{% endif %}
required="required"
class="form-select contact-select"
data-form-field-toggle="true"
data-form-field-toggle-target=".js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %}"
data-form-field-toggle-value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
data-form-field-toggle-scope="{% if scope == 'parent' %}parent{% else %}all{% endif %}"
{% if scope == 'parent' %}data-form-field-toggle-parent-selector={{ parentSelector }}{% endif %}
>
{% endif %}
{% set isCompany = false %}
{% if page.address.company or data.company is not empty %}
{% set isCompany = true %}
{% endif %}
{% if onlyCompanyRegistration or (accountType and accountType == constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS')) %}
{% set isCompany = true %}
{% endif %}
{% set isLoginPage = false %}
{% if activeRoute == 'frontend.account.login.page' %}
{% set isLoginPage = true %}
{% endif %}
{% if isLoginPage %}
<option disabled="disabled"
selected="selected"
value="">
{{ "account.personalTypePlaceholder"|trans|sw_sanitize }}
</option>
{% endif %}
{% if not onlyCompanyRegistration %}
<option value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_PRIVATE') }}"
{% if isCompany == false and isLoginPage == false %} selected="selected"{% endif %}>
{{ "account.personalTypePrivate"|trans|sw_sanitize }}
</option>
{% endif %}
<option value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}"
{% if isCompany == true and isLoginPage == false %} selected="selected"{% endif %}>
{{ "account.personalTypeBusiness"|trans|sw_sanitize }}
</option>
</select>
{% if onlyCompanyRegistration %}<input type="hidden" name="accountType" value="{{ constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') }}">{% endif %}
{% endblock %}
{% block component_address_personal_account_type_error %}
{% endblock %}
</div>
</div>
{% elseif not hideCustomerTypeSelect %}
<input type="hidden" name="accountType">
{% endif %}
{% endblock %}
{% block component_address_personal_fields_salutation_title %}
<div class="row g-2">
{% block component_address_personal_fields_salutation %}
<div class="form-group col-md-3 col-sm-6">
{% block component_address_personal_fields_salutation_label %}
<label class="form-label"
for="{{ idPrefix ~ prefix }}personalSalutation">
{{ "account.personalSalutationLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
</label>
{% endblock %}
{% block component_address_form_salutation_select %}
<select id="{{ idPrefix ~ prefix }}personalSalutation"
class="form-select{% if formViolations.getViolations('/salutationId') is not empty %} is-invalid{% endif %}"
name="{% if prefix %}{{ prefix }}[salutationId]{% else %}salutationId{% endif %}"
required="required">
{% if not data.get('salutationId') %}
<option disabled="disabled"
selected="selected"
value="">
{{ "account.personalSalutationPlaceholder"|trans|sw_sanitize }}
</option>
{% endif %}
{% for salutation in page.salutations %}
<option {% if salutation.id == data.get('salutationId') %}
selected="selected"
{% endif %}
value="{{ salutation.id }}">
{{ salutation.translated.displayName }}
</option>
{% endfor %}
</select>
{% endblock %}
{% block component_address_form_salutation_select_error %}
{% if formViolations.getViolations('/salutationId') is not empty %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
violationPath: '/salutationId'
} %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% block component_address_personal_fields_title %}
{% if config('core.loginRegistration.showTitleField') %}
<div class="form-group col-md-3 col-sm-6">
{% block component_address_personal_fields_title_label %}
<label class="form-label"
for="{{ idPrefix ~ prefix }}personalTitle">
{{ "account.personalTitleLabel"|trans|sw_sanitize }}
</label>
{% endblock %}
{% block component_address_personal_fields_title_input %}
<input type="text"
class="form-control"
autocomplete="section-personal title"
id="{{ idPrefix ~ prefix }}personalTitle"
placeholder="{{ "account.personalTitlePlaceholder"|trans|striptags }}"
name="{% if prefix %}{{ prefix }}[title]{% else %}title{% endif %}"
value="{{ data.get('title') }}">
{% endblock %}
</div>
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% block component_address_personal_fields_name %}
<div class="row g-2">
{% block component_address_personal_fields_first_name %}
<div class="form-group col-sm-6">
{% if formViolations.getViolations("/firstName") is not empty %}
{% set violationPath = "/firstName" %}
{% else %}
{% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "account.personalFirstNameLabel"|trans|sw_sanitize }) %}
{% endif %}
{% block component_address_personal_fields_first_name_label %}
<label class="form-label"
for="{{ idPrefix ~ prefix }}personalFirstName">
{{ "account.personalFirstNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
</label>
{% endblock %}
{% block component_address_personal_fields_first_name_input %}
<input type="text"
class="form-control{% if violationPath is not empty %} is-invalid{% endif %}"
autocomplete="section-personal given-name"
id="{{ idPrefix ~ prefix }}personalFirstName"
placeholder="{{ "account.personalFirstNamePlaceholder"|trans|striptags }}"
name="{% if prefix %}{{ prefix }}[firstName]{% else %}firstName{% endif %}"
value="{{ data.get('firstName') }}"
data-form-validation-required
{% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
required="required">
{% endblock %}
{% block component_address_personal_fields_first_name_input_error %}
{% if violationPath %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% block component_address_personal_fields_last_name %}
<div class="form-group col-sm-6">
{% if formViolations.getViolations("/lastName") is not empty %}
{% set violationPath = "/lastName" %}
{% else %}
{% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "account.personalLastNameLabel"|trans|sw_sanitize }) %}
{% endif %}
{% block component_address_personal_fields_last_name_label %}
<label class="form-label"
for="{{ idPrefix ~ prefix }}personalLastName">
{{ "account.personalLastNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
</label>
{% endblock %}
{% block component_address_personal_fields_last_name_input %}
<input type="text"
class="form-control{% if violationPath %} is-invalid{% endif %}"
autocomplete="section-personal family-name"
id="{{ idPrefix ~ prefix }}personalLastName"
placeholder="{{ "account.personalLastNamePlaceholder"|trans|striptags }}"
name="{% if prefix %}{{ prefix }}[lastName]{% else %}lastName{% endif %}"
value="{{ data.get('lastName') }}"
data-form-validation-required
{% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
required="required">
{% endblock %}
{% block component_address_personal_fields_last_name_input_error %}
{% if violationPath %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
{% block component_address_personal_company %}
{% if (onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection')) and activeRoute == 'frontend.account.profile.page' %}
<div class="js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %}">
{% block component_address_personal_company_fields %}
<div class="row g-2">
{% block component_address_personal_company_name %}
<div class="form-group col-12">
{% if formViolations.getViolations("/company") is not empty %}
{% set violationPath = "/company" %}
{% else %}
{% set requiredMessage = "error.VIOLATION::IS_BLANK_ERROR"|trans({ '%field%': "address.companyNameLabel"|trans|sw_sanitize }) %}
{% endif %}
{% block component_address_personal_company_name_label %}
<label class="form-label" for="{{ idPrefix ~ prefix }}company">
{{ "address.companyNameLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
</label>
{% endblock %}
{% block component_address_personal_company_name_input %}
<input type="text"
class="form-control{% if violationPath %} is-invalid{% endif %}"
id="{{ idPrefix ~ prefix }}company"
placeholder="{{ "address.companyNamePlaceholder"|trans|striptags }}"
name="company"
value="{{ data.get('company') }}"
data-form-validation-required
{% if requiredMessage is defined %}data-form-validation-required-message="{{ requiredMessage }}"{% endif %}
required="required">
{% endblock %}
{% block component_address_personal_company_name_input_error %}
{% if violationPath %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
</div>
{% endif %}
{% endblock %}
{% block component_address_personal_vat_id %}
{% if showVatIdField %}
{% if config('core.loginRegistration.showAccountTypeSelection') or onlyCompanyRegistration %}
<div class="js-field-toggle-contact-type-company{% if customToggleTarget %}-{{ prefix }}{% endif %} js-field-toggle-contact-type-vat-id">
{% block component_address_personal_vat_id_fields %}
<div class="row g-2">
<div class="form-group col-12">
{% sw_include '@Storefront/storefront/component/address/address-personal-vat-id.html.twig' with {
'vatIds': data.get('vatIds'),
'editMode': true
} %}
</div>
</div>
{% endblock %}
</div>
{% endif %}
{% endif %}
{% endblock %}
{% block component_address_personal_fields_birthday %}
{% if showBirthdayField %}
{% block component_address_personal_fields_birthday_label %}
<label for="{{ idPrefix ~ prefix }}personalBirthday">
{{ "account.personalBirthdayLabel"|trans|sw_sanitize }}{{ config('core.loginRegistration.birthdayFieldRequired') ? "general.required"|trans|sw_sanitize }}
</label>
{% endblock %}
{% block component_address_personal_fields_birthday_selects %}
<div class="row g-2">
{% block component_address_personal_fields_birthday_select_day %}
<div class="form-group col-md-2 col-4">
<select id="{{ idPrefix ~ prefix }}personalBirthday"
name="{% if prefix %}{{ prefix }}[birthdayDay]{% else %}birthdayDay{% endif %}"
class="form-select{% if formViolations.getViolations('/birthdayDay') is not empty %} is-invalid{% endif %}"
{{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
{% if not data.get('birthdayDay') %}
<option selected="selected"
value="">
{{ "account.personalBirthdaySelectDay"|trans|sw_sanitize }}
</option>
{% endif %}
{% for day in range(1, 31) %}
<option value="{{ day }}"
{% if day == data.get('birthdayDay') %} selected="selected"{% endif %}>
{{ day }}
</option>
{% endfor %}
</select>
{% block component_address_personal_fields_birthday_select_day_error %}
{% if formViolations.getViolations('/birthdayDay') is not empty %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
violationPath: '/birthdayDay'
} %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% block component_address_personal_fields_birthday_select_month %}
<div class="form-group col-md-2 col-4">
<select name="{% if prefix %}{{ prefix }}[birthdayMonth]{% else %}birthdayMonth{% endif %}"
class="form-select{% if formViolations.getViolations('/birthdayMonth') is not empty %} is-invalid{% endif %}"
{{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
{% if not data.get('birthdayMonth') %}
<option selected="selected"
value="">
{{ "account.personalBirthdaySelectMonth"|trans|sw_sanitize }}
</option>
{% endif %}
{% for month in range(1, 12) %}
<option value="{{ month }}"
{% if month == data.get('birthdayMonth') %} selected="selected"{% endif %}>
{{ month }}
</option>
{% endfor %}
</select>
{% block component_address_personal_fields_birthday_select_month_error %}
{% if formViolations.getViolations('/birthdayMonth') is not empty %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
violationPath: '/birthdayMonth'
} %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
{% block component_address_personal_fields_birthday_select_year %}
<div class="form-group col-md-2 col-4">
{% set currentYear = "now"|date('Y') %}
{% set startYear = currentYear - 120 %}
<select name="{% if prefix %}{{ prefix }}[birthdayYear]{% else %}birthdayYear{% endif %}"
class="form-select{% if formViolations.getViolations('/birthdayYear') is not empty %} is-invalid{% endif %}"
{{ config('core.loginRegistration.birthdayFieldRequired') ? 'required="required"' }}>
{% if not data.get('birthdayYear') %}
<option selected="selected"
value="">
{{ "account.personalBirthdaySelectYear"|trans|sw_sanitize }}
</option>
{% endif %}
{% for year in range(currentYear, startYear) %}
<option value="{{ year }}"
{% if year == data.get('birthdayYear') %} selected="selected"{% endif %}>
{{ year }}
</option>
{% endfor %}
</select>
{% block component_address_personal_fields_birthday_select_year_error %}
{% if formViolations.getViolations('/birthdayYear') is not empty %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' with {
violationPath: '/birthdayYear'
} %}
{% endif %}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
{% endif %}
{% endblock %}
{% endblock %}