<?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="card card-default card-addresses-default">
    <h6 class="card-header"><?php /* @escapeNotVerified */ echo __('Default Addresses') ?></h6>
    <div class="card-body">
        <div class="container-fluid">
            <div class="row">
                <?php if ($_pAddsses = $block->getDefaultBilling()): ?>
                    <div class="col-md-6">
                        <div class="edit-address edit-address-billing">
                            <h6><?php /* @escapeNotVerified */ echo __('Default Billing Address') ?></h6>
                            <address><?php echo $block->getAddressHtml($block->getAddressById($_pAddsses)) ?></address>
                            <a class="edit" href="<?php /* @escapeNotVerified */echo $block->getAddressEditUrl($_pAddsses) ?>">
                                <i class="fal fa-pen"></i> <?php /* @escapeNotVerified */ echo __('Change Billing Address') ?>
                            </a>
                        </div>
                    </div>
                <?php else: ?>
                    <div class="col-12">
                        <div class="edit-address edit-address-billing">
                            <h6><?php /* @escapeNotVerified */ echo __('Default Billing Address') ?></h6>
                            <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="col-md-6 mt-4 mt-md-0">
                        <div class="edit-address edit-address-shipping">
                            <h6><?php /* @escapeNotVerified */ echo __('Default Shipping Address') ?></h6>
                            <address><?php echo $block->getAddressHtml($block->getAddressById($_pAddsses)) ?></address>
                            <a class="edit" href="<?php /* @escapeNotVerified */ echo $block->getAddressEditUrl($_pAddsses) ?>">
                                <i class="fal fa-pen"></i> <?php /* @escapeNotVerified */ echo __('Change Shipping Address') ?>
                            </a>
                        </div>
                    </div>
                <?php else: ?>
                    <div class="col-12">
                        <div class="card panel-primary card-shipping-address">
                            <h6><?php /* @escapeNotVerified */ echo __('Default Shipping Address') ?></h6>
                            <p><?php /* @escapeNotVerified */ echo __('You have no default shipping address in your address book.') ?></p>
                        </div>
                    </div>
                <?php endif ?>
            </div>
        </div>
    </div>
</div>

<div class="card card-default panel-addresses-list">
    <h6 class="card-header"><?php /* @escapeNotVerified */ echo __('Additional Address Entries') ?></h6>
    <div class="card-body">
        <?php if ($_pAddsses = $block->getAdditionalAddresses()): ?>
            <div class="container-fluid items addresses">
                <div class="row">
                    <?php foreach ($_pAddsses as $_address): ?>
                        <div class="col-sm-6">

                            <div>
                                <h6><?php /* @escapeNotVerified */ echo __('Address details') ?></h6>
                                <address><?php echo $block->getAddressHtml($_address) ?></address>

                                    <div class="item actions">
                                        <a class="dit" href="<?php /* @escapeNotVerified */ echo $block->getUrl('customer/address/edit', ['id' => $_address->getId()]) ?>">
                                            <i class="fal fa-pen"></i> <?php /* @escapeNotVerified */ echo __('Edit Address') ?>
                                        </a>

                                        <a class="btn btn-link delete" href="#" role="delete-address" data-address="<?php /* @escapeNotVerified */ echo $_address->getId() ?>">
                                            <i class="fal fa-trash-alt"></i> <?php /* @escapeNotVerified */ echo __('Delete Address') ?>
                                        </a>
                                    </div>
                            </div>


                        </div>
                    <?php endforeach; ?>
                </div>
            </div>
        <?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="form-group">
        <button type="button" role="add-address" title="<?php /* @escapeNotVerified */
        echo __('Add New Address') ?>" class="btn btn-primary primary add"><?php /* @escapeNotVerified */
            echo __('Add New Address') ?></button>
        <a class="btn btn-link back" href="<?php echo $block->escapeUrl($block->getBackUrl()) ?>"><?php /* @escapeNotVerified */
            echo __('Back') ?></a>
    </div>
</div>
<script type="text/x-magento-init">
    {
        ".main-container": {
            "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>
