{% extends '@CoreShopFrontend/layout-full.html.twig' %}
{% form_theme form 'bootstrap_4_layout.html.twig' %}

{% block center %}
    <div id="main-container" class="container p-0">

        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="{{ path('coreshop_index') }}">{{ 'coreshop.ui.home'|trans }}</a></li>
                <li class="breadcrumb-item"><a href="{{ path('coreshop_customer_profile') }}">{{ 'coreshop.ui.profile'|trans }}</a></li>
                <li class="breadcrumb-item"><a href="{{ path('coreshop_customer_addresses') }}">{{ 'coreshop.ui.addresses'|trans }}</a></li>
                <li class="breadcrumb-item active">{{ 'coreshop.ui.addresses'|trans }}</li>
            </ol>
        </nav>

        <h2 class="main-heading text-center">
            {% if address.addressIdentifier is not empty %}
                {{ ('coreshop.ui.' ~ address.addressIdentifier.name ~ '_address')|trans }}
            {% else %}
                {{ 'coreshop.ui.address'|trans }}
            {% endif %}
            {% if not address.getId %}
                – <span>{{ 'coreshop.ui.add_new_address'|trans }}</span>
            {% endif %}
        </h2>

        <section class="registration-area">
            <div class="row">
                <div class="col-sm-12">
                    <div class="card card-smart">
                        <div class="card-body">
                            {{ form_start(form) }}
                                {{ form_errors(form,coreshop_test_form_attribute('address-validation-errors')) }}

                                {% if form.addressAffiliation is defined %}
                                    {{ form_row(form.addressAffiliation) }}
                                {% endif %}

                                {{ form_row(form.salutation,coreshop_test_form_attribute('address-salutation')) }}
                                {{ form_row(form.firstname,coreshop_test_form_attribute('address-firstname')) }}
                                {{ form_row(form.lastname,coreshop_test_form_attribute('address-lastname')) }}
                                {{ form_row(form.street,coreshop_test_form_attribute('address-street')) }}
                                {{ form_row(form.number,coreshop_test_form_attribute('address-number')) }}
                                {{ form_row(form.postcode,coreshop_test_form_attribute('address-postcode')) }}
                                {{ form_row(form.city,coreshop_test_form_attribute('address-city')) }}
                                {{ form_row(form.country,coreshop_test_form_attribute('address-country')) }}
                                {{ form_row(form.phoneNumber,coreshop_test_form_attribute('address-phoneNumber')) }}

                                <div class="form-group">
                                    <button type="submit" class="btn btn-success" {{ coreshop_test_html_attribute('address-save-changes') }} >
                                        {% if not address.id %}
                                            {{ 'coreshop.ui.add'|trans }}
                                        {% else %}
                                            {{ 'coreshop.ui.save'|trans }}
                                        {% endif %}
                                    </button>
                                </div>
                            {{ form_end(form) }}
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
{% endblock %}
