<?php
/**
 * Hyvä Themes - https://hyva.io
 * Copyright © Hyvä Themes 2020-present. All rights reserved.
 * This product is licensed per Magento install
 * See https://hyva.io/license
 */

/** @var \Magento\Framework\Escaper $escaper */
/** @var \Magento\Customer\Block\Address\Book $block */
?>
<div class="block block-addresses-default my-6">
    <div class="block-title block-title text-2xl mb-6">
        <?= $escaper->escapeHtml(__('Default Addresses')) ?>
    </div>
    <div class="grid-cols-2 block-content md:grid gap-x-4 gap-y-0 my-6">
        <?php if ($customerDefaultBillingAddress = $block->getDefaultBilling()): ?>
            <div class="box box-address-billing card px-8 py-8 mb-4 md:mb-0">
                <div class="text-gray-900 text-lg title-font font-medium mb-3">
                    <span><?= $escaper->escapeHtml(__('Default Billing Address')) ?></span>
                </div>
                <div class="box-content">
                    <address>
                        <?= $block->getAddressHtml($block->getAddressById($customerDefaultBillingAddress)) ?>
                    </address>
                </div>
                <div class="box-actions">
                    <a href="<?= $escaper->escapeUrl($block->getAddressEditUrl($customerDefaultBillingAddress)) ?>"
                       class="inline-flex items-center w-full mt-3 md:text-sm text-gray-500
                        hover:text-secondary-darker"
                    >
                        <span>
                            <?= $escaper->escapeHtml(__('Change Billing Address')) ?>
                        </span>
                        <svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
                             stroke-width="2" class="w-4 h-4 ml-2" viewBox="0 0 24 24">
                            <path d="M5 12h14M12 5l7 7-7 7"></path>
                        </svg>
                    </a>
                </div>
            </div>
        <?php else: ?>
            <div class="box box-billing-address card">
                <div class="text-gray-900 text-lg title-font font-medium mb-3">
                    <span>
                        <?= $escaper->escapeHtml(__('Default Billing Address')) ?>
                    </span>
                </div>
                <div class="box-content">
                    <p><?= $escaper->escapeHtml(__('You have no default billing address in your address book.')) ?></p>
                </div>
            </div>
        <?php endif ?>

        <?php if ($customerDefaultBillingAddress = $block->getDefaultShipping()): ?>
            <div class="box box-address-shipping card px-8 py-8">
                <div class="text-gray-900 text-lg title-font font-medium mb-3">
                    <span><?= $escaper->escapeHtml(__('Default Shipping Address')) ?></span>
                </div>
                <div class="box-content">
                    <address>
                        <?= $block->getAddressHtml($block->getAddressById($customerDefaultBillingAddress)) ?>
                    </address>
                </div>
                <div class="box-actions">
                    <a href="<?= $escaper->escapeUrl($block->getAddressEditUrl($customerDefaultBillingAddress)) ?>"
                       class="inline-flex items-center w-full mt-3 md:text-sm text-gray-500
                        hover:text-secondary-darker"
                    >
                        <span><?= $escaper->escapeHtml(__('Change Shipping Address')) ?></span>
                        <svg fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
                             stroke-width="2" class="w-4 h-4 ml-2" viewBox="0 0 24 24">
                            <path d="M5 12h14M12 5l7 7-7 7"></path>
                        </svg>
                    </a>
                </div>
            </div>
        <?php else: ?>
            <div class="box box-shipping-address card">
                <div class="text-gray-900 text-lg title-font font-medium mb-3">
                    <span>
                        <?= $escaper->escapeHtml(__('Default Shipping Address')) ?>
                    </span>
                </div>
                <div class="box-content">
                    <p>
                        <?= $escaper->escapeHtml(__('You have no default shipping address in your address book.')) ?>
                    </p>
                </div>
            </div>
        <?php endif ?>
    </div>
</div>
