<?php
/**
 * Mageplaza
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Mageplaza.com license that is
 * available through the world-wide-web at this URL:
 * https://www.mageplaza.com/LICENSE.txt
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade this extension to newer
 * version in the future.
 *
 * @category    Mageplaza
 * @package     Mageplaza_LayeredNavigation
 * @copyright   Copyright (c) Mageplaza (https://www.mageplaza.com/)
 * @license     https://www.mageplaza.com/LICENSE.txt
 */

/** @type \Mageplaza\LayeredNavigation\Model\Layer\Filter\Attribute $filter */
$filter = $this->getFilter();
$attributeCode = $filter->getRequestVar();

/** @type \Mageplaza\Layerednavigation\Model\Layer\Filter $filterModel */
$filterModel = $this->helper(\Mageplaza\LayeredNavigation\Helper\Data::class)->getFilterModel();
?>
<ol class="items">
    <?php /** @type \Magento\Catalog\Model\Layer\Filter\Item[] $filterItems */
    foreach ($filterItems as $filterItem) : ?>
        <li class="item">
            <?php if ($filterModel->isSliderTypes($filter)) : ?>
                <div id="ln_slider_container_<?= /** @noEscape */ $attributeCode ?>" class="ln_slider_container">
                    <div id="ln_slider_<?= /** @noEscape */ $attributeCode ?>"></div>
                    <div id="ln_slider_text_<?= /** @noEscape */ $attributeCode ?>"></div>
                </div>
            <?php else : ?>
                <?php if ($filterItem->getCount() > 0) : ?>
                    <input type="<?= /** @noEscape */ $filterModel->isMultiple($filter) ? 'checkbox' : 'radio' ?>"
                        <?= /** @noEscape */ $filterModel->isMultiple($filter) ? '' : 'name="' . $filter->getRequestVar() . '"' ?>
                        <?= /** @noEscape */ $filterModel->isSelected($filterItem) ? 'checked="checked"' : '' ?> />
                <?php else : ?>
                    <input type="<?= /** @noEscape */ $filterModel->isMultiple($filter) ? 'checkbox' : 'radio' ?>"
                           disabled="disabled"/>
                <?php endif; ?>
                <a href="<?= /** @noEscape */ $block->escapeUrl($filterModel->getItemUrl($filterItem)) ?>">
                    <?= /** @noEscape */ $filterItem->getLabel() ?>
                    <?php if ($filterModel->isShowCounter($filter)) : ?>
                        <span class="count"><?= /** @noEscape */ $filterItem->getCount() ?>
                            <span class="filter-count-label">
                                <?= /** @noEscape */ ($filterItem->getCount() === 1) ? 'item' : 'items' ?>
                            </span>
                        </span>
                    <?php endif; ?>
                </a>
            <?php endif; ?>
        </li>
    <?php endforeach ?>
</ol>
