{% sw_extends '@Storefront/storefront/component/address/address-personal.html.twig' %}
{% block component_address_personal_account_type %}
{% if onlyCompanyRegistration or (config('core.loginRegistration.showAccountTypeSelection') and not hideCustomerTypeSelect) %}
<div class="{{ formRowClass }}">
<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="{{ formSelectClass }} 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"
value="">
{{ "account.personalTypeLabel"|trans|sw_sanitize }}{{ "general.required"|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 selected="selected" 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 %}