{# 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 %} {% set accountTypeFieldName = prefix ? prefix ~ '[accountType]' : 'accountType' %} {% if (onlyCompanyRegistration or (config('core.loginRegistration.showAccountTypeSelection') and not hideCustomerTypeSelect)) and not hasSelectedBusiness %}
{% set toggleTarget = ".js-field-toggle-contact-type-company" %} {% if customToggleTarget %} {% set toggleTarget = "#{toggleTarget}-#{prefix}" %} {% 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 %} {% set privateType = constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_PRIVATE') %} {% set businessType = constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS') %} {% set accountTypeOptions %} {% if isLoginPage %} {% endif %} {% if not onlyCompanyRegistration %} {% endif %} {% endset %} {% block component_address_personal_account_type_select %} {% sw_include '@Storefront/storefront/component/form/form-select.html.twig' with { label: 'account.personalTypeLabel'|trans|sw_sanitize, id: idPrefix ~ prefix ~ '-accountType', name: accountTypeFieldName, options: accountTypeOptions, validationRules: 'required', disabled: (onlyCompanyRegistration) ? 'true', additionalClass: 'col-md-6 contact-type', additionalSelectClass: 'contact-select', attributes: { 'data-form-field-toggle': 'true', 'data-form-field-toggle-target': toggleTarget, 'data-form-field-toggle-value': constant('Shopware\\Core\\Checkout\\Customer\\CustomerEntity::ACCOUNT_TYPE_BUSINESS'), 'data-form-field-toggle-scope': (scope == 'parent') ? 'parent' : 'all', 'data-form-field-toggle-parent-selector': (scope == 'parent') ? parentSelector, }, } %} {% endblock %} {% if onlyCompanyRegistration %} {# This is rendered on the profile edit page if the customer registered via a custom commercial registration form. #} {# The selection field is then disabled and the account type is set to "business". #} {% endif %}
{% elseif not hideCustomerTypeSelect %} {# This case applies to custom registration forms with the "Company signup form" config enabled. #} {# The registration is always of type "commercial" then. #} {% endif %} {% endblock %} {% block component_address_personal_fields_salutation_title %} {% if config('core.loginRegistration.showSalutation') or config('core.loginRegistration.showTitleField') %}
{% block component_address_personal_fields_salutation %} {% if config('core.loginRegistration.showSalutation') %} {% set salutationOptions %} {% for salutation in page.salutations %} {% endfor %} {% endset %} {% block component_address_personal_fields_salutation_select %} {% sw_include '@Storefront/storefront/component/form/form-select.html.twig' with { label: 'account.personalSalutationLabel'|trans|sw_sanitize, id: idPrefix ~ prefix ~ 'personalSalutation', name: prefix ? prefix ~ '[salutationId]' : 'salutationId', options: salutationOptions, autocomplete: 'section-personal honorific-prefix', violationPath: '/salutationId', additionalClass: 'col-md-3 col-sm-6', } %} {% endblock %} {% endif %} {% endblock %} {% block component_address_personal_fields_title %} {% if config('core.loginRegistration.showTitleField') %} {% if formViolations.getViolations("/#{prefix}/title") is not empty %} {% set violationPath = "/#{prefix}/title" %} {% elseif formViolations.getViolations("/title") is not empty %} {% set violationPath = "/title" %} {% endif %} {% block component_address_personal_fields_title_input %} {% sw_include '@Storefront/storefront/component/form/form-input.html.twig' with { label: 'account.personalTitleLabel'|trans|sw_sanitize, id: idPrefix ~ prefix ~ 'personalTitle', name: prefix ? prefix ~ '[title]' : 'title', value: data.get('title'), autocomplete: 'section-personal honorific-prefix', violationPath: violationPath, additionalClass: 'col-md-3 col-sm-6', } %} {% endblock %} {% endif %} {% endblock %}
{% endif %} {% endblock %} {% block component_address_personal_fields_name %}
{% block component_address_personal_fields_first_name %} {% if prefix !== '' and prefix != 'address' %} {% set prefix = prefix != 'shippingAddress' ? 'billingAddress' : 'shippingAddress' %} {% endif %} {# New implementation, setting of "violationPath" #} {% if formViolations.getViolations("/#{prefix}/firstName") is not empty %} {% set violationPath = "/#{prefix}/firstName" %} {% elseif formViolations.getViolations("/firstName") is not empty and prefix === 'address' %} {% set violationPath = "/firstName" %} {% endif %} {% block component_address_personal_fields_first_name_input %} {% sw_include '@Storefront/storefront/component/form/form-input.html.twig' with { label: 'account.personalFirstNameLabel'|trans|sw_sanitize, id: idPrefix ~ prefix ~ '-personalFirstName', name: prefix ? prefix ~ '[firstName]' : 'firstName', value: (prefix and data.has(prefix)) ? data.get(prefix).get('firstName') : data.get('firstName'), autocomplete: 'section-personal given-name', violationPath: violationPath, validationRules: 'required', additionalClass: 'col-sm-6', } %} {% endblock %} {% endblock %} {% block component_address_personal_fields_last_name %} {% if prefix !== '' and prefix != 'address' %} {% set prefix = prefix != 'shippingAddress' ? 'billingAddress' : 'shippingAddress' %} {% endif %} {% if formViolations.getViolations("/#{prefix}/lastName") is not empty %} {% set violationPath = "/#{prefix}/lastName" %} {% elseif formViolations.getViolations("/lastName") is not empty and prefix === 'address' %} {% set violationPath = "/lastName" %} {% endif %} {% block component_address_personal_fields_last_name_input %} {% sw_include '@Storefront/storefront/component/form/form-input.html.twig' with { label: 'account.personalLastNameLabel'|trans|sw_sanitize, id: idPrefix ~ prefix ~ '-personalLastName', name: prefix ? prefix ~ '[lastName]' : 'lastName', value: (prefix and data.has(prefix)) ? data.get(prefix).get('lastName') : data.get('lastName'), autocomplete: 'section-personal family-name', violationPath: violationPath, validationRules: 'required', additionalClass: 'col-sm-6', } %} {% endblock %} {% endblock %}
{% endblock %} {% if feature('v6.8.0.0') %} {% block component_address_personal_company_section %} {% if (config('core.loginRegistration.showAccountTypeSelection') or onlyCompanyRegistration) and showCompanyFields %}
{% block component_address_personal_company_name %} {% if formViolations.getViolations("/company") is not empty %} {% set violationPath = "/company" %} {% endif %} {# This is only rendered on the customer profile edit page. #} {% block component_address_personal_company_name_input %} {% sw_include '@Storefront/storefront/component/form/form-input.html.twig' with { label: 'address.companyNameLabel'|trans|sw_sanitize, id: idPrefix ~ prefix ~ '-company', name: 'company', value: data.get('company'), autocomplete: 'section-personal organization', violationPath: violationPath, validationRules: 'required', additionalClass: 'col-sm-6', } %} {% endblock %} {% endblock %} {% block component_address_personal_company_vat_id %} {# @deprecated tag:v6.8.0 - Unused variable `editMode` and will be removed #} {% set editMode = true %} {% sw_include '@Storefront/storefront/component/address/address-personal-vat-id.html.twig' with { 'vatIds': data.get('vatIds'), } %} {% endblock %}
{% endif %} {% endblock %} {% else %} {# @deprecated tag:v6.8.0 - Block will be removed use block `component_address_personal_company_name` instead #} {% block component_address_personal_company %} {% if (onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection')) and activeRoute == 'frontend.account.profile.page' %}
{% block component_address_personal_company_fields %}
{{ block('component_address_personal_company_name') }}
{% endblock %}
{% endif %} {% endblock %} {# @deprecated tag:v6.8.0 - Block will be removed use block `component_address_personal_company_vat_id` instead #} {% block component_address_personal_vat_id %} {% if (onlyCompanyRegistration or config('core.loginRegistration.showAccountTypeSelection')) and showVatIdField %}
{% block component_address_personal_vat_id_fields %}
{# This is only rendered on the customer profile edit page. #} {{ sw_block('component_address_personal_company_vat_id') }}
{% endblock %}
{% endif %} {% endblock %} {% endif %} {% block component_address_personal_fields_birthday %} {% if showBirthdayField %} {% sw_include '@Storefront/storefront/component/form/form-select-birthday.html.twig' with { label: 'account.personalBirthdayLabel'|trans|sw_sanitize, validationRules: config('core.loginRegistration.birthdayFieldRequired') ? 'required' : '', additionalClass: 'col-sm-6', } %} {% endif %} {% endblock %} {% endblock %}