{#
This file is part of EC-CUBE

Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.

http://www.ec-cube.co.jp/

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends 'default_frame.twig' %}

{% set mypageno = 'delivery' %}

{% set body_class = 'mypage' %}

{% block main %}
    <div class="ec-layoutRole__main">
        <div class="ec-mypageRole">
            <div class="ec-pageHeader">
                <h1>{{ 'マイページ'|trans }}/{{ 'お届け先一覧'|trans }}</h1>
            </div>
            {{ include('Mypage/navi.twig') }}
        </div>
        <div class="ec-mypageRole">
            {% if Customer.CustomerAddresses|length > 0 %}
                <p class="ec-para-normal">{{ '%count%件のお届け先があります'|trans({'%count%':Customer.CustomerAddresses|length}) }}</p>
            {% else %}
                <p class="ec-para-normal">{{ 'お届け先は登録されていません。'|trans }}</p>
            {% endif %}
        </div>
        <div class="ec-mypageRole">
            <div class="ec-off1Grid">
                <div class="ec-off1Grid__cell">
                    <div class="ec-addressRole">
                        <div class="ec-addressRole__actions">
                            {% if Customer.CustomerAddresses|length < eccube_config.eccube_deliv_addr_max %}
                                <a class="ec-inlineBtn" href="{{ url('mypage_delivery_new') }}">{{ '新規お届け先を追加する'|trans }}</a>
                            {% else %}
                                <span class="ec-errorMessage">{{ 'お届け先登録の上限の%count%件に達しています。お届け先を入力したい場合は、削除か変更を行ってください。'|trans({ '%count%': eccube_config.eccube_deliv_addr_max }) }}</span>
                            {% endif %}
                        </div>
                    </div>
                    {% if Customer.CustomerAddresses|length > 0 %}
                        <div class="ec-addressList">
                            {% for CustomerAddress in Customer.CustomerAddresses %}
                                <div class="ec-addressList__item">
                                    <a class="ec-addressList__remove" href="{{ url('mypage_delivery_delete', { id : CustomerAddress.id }) }}" {{ csrf_token_for_anchor() }} data-method="delete">
                                        <div class="ec-icon">
                                            <img src="{{ asset('assets/icon/cross.svg') }}" alt="remove">
                                        </div>
                                    </a>
                                    <div class="ec-addressList__address">
                                        <div>{{ CustomerAddress.name01 }}&nbsp;{{ CustomerAddress.name02 }}</div>
                                        <div>{{ '〒'|trans }}{{ CustomerAddress.postal_code }} {{ CustomerAddress.Pref }}{{ CustomerAddress.addr01 }}{{ CustomerAddress.addr02 }}</div>
                                        <div>{{ CustomerAddress.phone_number }}</div>
                                    </div>
                                    <div class="ec-addressList__action">
                                        <a class="ec-inlineBtn" href="{{ url('mypage_delivery_edit', { id : CustomerAddress.id }) }}">{{ '変更'|trans }}</a>
                                    </div>
                                </div>
                            {% endfor %}
                        </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
{% endblock %}
