<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Temlate for \Magento\Customer\Block\Address\Book block
 * @var $block \Magento\Customer\Block\Address\Book
 */
?>
<div class="block block-addresses-default">
    <div class="block-title"><strong><?php /* @escapeNotVerified */ echo __('Default Addresses') ?></strong></div>
    <div class="block-content">
        <?php if ($_pAddsses = $block->getDefaultBilling()): ?>
            <div class="box box-address-billing">
                <strong class="box-title">
                    <span><?php /* @escapeNotVerified */ echo __('Default Billing Address') ?></span>
                </strong>
                <div class="box-content">
                    <address>
                        <?php echo $block->getAddressHtml($block->getAddressById($_pAddsses)) ?>
                    </address>
                </div>
                <div class="box-actions">
                    <a class="action edit" href="<?php /* @escapeNotVerified */ echo $block->getAddressEditUrl($_pAddsses) ?>">
                        <span><?php /* @escapeNotVerified */ echo __('Change Billing Address') ?></span>
                    </a>
                </div>
            </div>
        <?php else: ?>
            <div class="box box-billing-address">
                <strong class="box-title"><span><?php /* @escapeNotVerified */ echo __('Default Billing Address') ?></span></strong>
                <div class="box-content">
                    <p><?php /* @escapeNotVerified */ echo __('You have no default billing address in your address book.') ?></p>
                </div>
            </div>
        <?php endif ?>

        <?php if ($_pAddsses = $block->getDefaultShipping()): ?>
            <div class="box box-address-shipping">
                <strong class="box-title">
                    <span><?php /* @escapeNotVerified */ echo __('Default Shipping Address') ?></span>
                </strong>
                <div class="box-content">
                    <address>
                        <?php echo $block->getAddressHtml($block->getAddressById($_pAddsses)) ?>
                    </address>
                </div>
                <div class="box-actions">
                    <a class="action edit" href="<?php /* @escapeNotVerified */ echo $block->getAddressEditUrl($_pAddsses) ?>">
                        <span><?php /* @escapeNotVerified */ echo __('Change Shipping Address') ?></span>
                    </a>
                </div>
            </div>
        <?php else: ?>
            <div class="box box-shipping-address">
                <strong class="box-title"><span><?php /* @escapeNotVerified */ echo __('Default Shipping Address') ?></span></strong>
                <div class="box-content">
                    <p><?php /* @escapeNotVerified */ echo __('You have no default shipping address in your address book.') ?></p>
                </div>
            </div>
        <?php endif ?>
    </div>
</div>

<div class="block block-addresses-list">
    <div class="block-title"><strong><?php /* @escapeNotVerified */ echo __('Additional Address Entries') ?></strong></div>
    <div class="block-content">
        <?php if ($_pAddsses = $block->getAdditionalAddresses()): ?>
            <ol class="items addresses">
                <?php foreach ($_pAddsses as $_address): ?>
                    <li class="item">
                        <address>
                            <?php echo $block->getAddressHtml($_address) ?><br />
                        </address>
                        <div class="item actions">
                            <a class="action edit" href="<?php /* @escapeNotVerified */ echo $block->getUrl('customer/address/edit', ['id' => $_address->getId()]) ?>"><span><?php /* @escapeNotVerified */ echo __('Edit Address') ?></span></a>
                            <a class="action delete" href="#" role="delete-address" data-address="<?php /* @escapeNotVerified */ echo $_address->getId() ?>"><span><?php /* @escapeNotVerified */ echo __('Delete Address') ?></span></a>
                        </div>
                    </li>
                <?php endforeach; ?>
            </ol>
        <?php else: ?>
            <p class="empty"><?php /* @escapeNotVerified */ echo __('You have no other address entries in your address book.') ?></p>
        <?php endif ?>
    </div>
</div>

<div class="actions-toolbar">
    <div class="primary">
        <button type="button" role="add-address" title="<?php /* @escapeNotVerified */ echo __('Add New Address') ?>" class="action primary add"><span><?php /* @escapeNotVerified */ echo __('Add New Address') ?></span></button>
    </div>
    <div class="secondary">
        <a class="action back" href="<?php echo $block->escapeUrl($block->getBackUrl()) ?>"><span><?php /* @escapeNotVerified */ echo __('Back') ?></span></a>
    </div>
</div>
<script type="text/x-magento-init">
    {
        ".page-main": {
            "address": {
                "deleteAddress": "li.item a[role='delete-address']",
                "deleteUrlPrefix": "<?php /* @escapeNotVerified */ echo $block->getDeleteUrl() ?>id/",
                "addAddress": "button[role='add-address']",
                "addAddressLocation": "<?php /* @escapeNotVerified */ echo $block->getAddAddressUrl() ?>"
            }
        }
    }
</script>
