<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/** @var Mage_Wishlist_Block_Customer_Sidebar $this */
?>
<?php if ($this->helper('wishlist')->isAllow()) : ?>
<div class="block block-wishlist">
    <div class="block-title">
        <strong><span><?= $this->getTitle() ?></span></strong>
    </div>
    <div class="block-content">
    <p class="block-subtitle"><?= $this->__('Last Added Items') ?></p>
    <?php if ($this->hasWishlistItems()): ?>
    <?php $_params = $this->escapeHtml(json_encode(['form_key' => $this->getFormKey()])); ?>
    <ol class="mini-products-list" id="wishlist-sidebar">
    <?php foreach ($this->getWishlistItems() as $_item): ?>
        <?php $product = $_item->getProduct(); ?>
        <li class="item">
            <a href="<?= $this->getProductUrl($_item) ?>" title="<?= $this->escapeHtml($product->getName()) ?>" class="product-image"><img src="<?= $this->helper('catalog/image')->init($product, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?= $this->escapeHtml($product->getName()) ?>" /></a>
            <div class="product-details">
                <a href="#"
                   class="btn-remove"
                   title="<?= $this->quoteEscape($this->__('Remove This Item')) ?>"
                   onclick="if (confirm('<?= $this->jsQuoteEscape($this->__('Are you sure you would like to remove this item from the wishlist?')) ?>')) {
                        customFormSubmit('<?= $this->getItemRemoveUrlCustom($_item, false) ?>', '<?= $_params ?>', 'post')
                    }">
                    <?= $this->__('Remove This Item') ?>
                </a>
                <p class="product-name"><a href="<?= $this->getProductUrl($_item) ?>"><?= $this->escapeHtml($product->getName()) ?></a></p>
                <?= $this->getPriceHtml($product, false, '-wishlist') ?>
                <?php if ($product->isSaleable() && $product->isVisibleInSiteVisibility()): ?>
                    <a href="#"
                       class="link-cart"
                       onclick="customFormSubmit('<?= $this->getItemAddToCartUrlCustom($_item, false) ?>', '<?= $_params ?>', 'post')">
                        <?= $this->__('Add to Cart') ?>
                    </a>
                <?php endif ?>
            </div>
        </li>
    <?php endforeach ?>
    </ol>
    <div class="actions">
        <a href="<?= $this->helper('wishlist')->getListUrl() ?>"><?= $this->__('Go to Wishlist') ?></a>
    </div>
    <?php else: ?>
        <p class="empty"><?= $this->__('You have no items in your wishlist.') ?></p>
    <?php endif ?>
    </div>
</div>
<?php endif ?>
