{% if app.user is not empty and app.user.customer is not empty and app.user.customer.addresses|length > 0 %}
    <div class="address-book-select-wrapper">
        <div class="dropdown address-book-select bootstrap-select input-group-btn" {{ sylius_test_html_attribute('address-book') }}>
            <button class="btn dropdown-toggle" type="button" data-toggle="dropdown">
                <div class="filter-option">
                    <div class="filter-option-inner">
                        <div class="filter-option-inner-inner">{{ 'sylius.ui.select_address_from_book'|trans }}</div>
                    </div>
                </div>
            </button>

            <div class="dropdown-menu">
                {% for address in app.user.customer.addresses %}
                    <button type="button" class="dropdown-item" {{ sylius_test_html_attribute('address-book-item') }}
                            data-id="{{ address.id }}"
                            data-first-name="{{ address.firstName }}"
                            data-last-name="{{ address.lastName }}"
                            data-company="{{ address.company }}"
                            data-street="{{ address.street }}"
                            {% if address.complementaryStreet is defined %}
                                data-complementary-street="{{ address.complementaryStreet }}"
                            {% endif %}
                            data-country-code="{{ address.countryCode }}"
                            data-province-code="{{ address.provinceCode }}"
                            data-province-name="{{ address.provinceName }}"
                            data-city="{{ address.city }}"
                            data-postcode="{{ address.postcode }}"
                            data-phone-number="{{ address.phoneNumber }}"
                    >
                        <strong>{{ address.firstName }} {{ address.lastName }}</strong>, {{ address.street }}, {{ address.city }} {{ address.postcode }}, {{ address.countryCode|sylius_country_name }}
                    </button>
                {% endfor %}
            </div>
        </div>
    </div>
{% endif %}
