<?php

$configHelper = $this->helper('Wyomind\ElasticsearchLayeredNavigation\Helper\Config');
$dataHelper = $this->helper('Wyomind\ElasticsearchCore\Helper\Data');
$frontendHelper = $this->helper('Wyomind\ElasticsearchLayeredNavigation\Helper\Frontend');
$storeId = $dataHelper->getCurrentStoreId();
$labels = $configHelper->getLabels($storeId);
$result = $frontendHelper->getResult($block->getType());
$count = $result['amount']['total'];
$nbFilters = count($result['selectedFilters']);
?>

<div id="product-count" class="product-count">
    <p class="toolbar-amount" id="toolbar-amount">
        <?php if ($count > 0) : ?>
            <?= /* @noEscape */ str_replace("{{nbItems}}", $count, $labels["nb_items"]); ?>
        <?php endif; ?>

    </p>
</div>
<?php if ($block->getType() == "open-filters") :?>
    <button class="action primary ">
        <i class="fas fa-filter" style="float:left"></i>
        <span><?= __('Filters') ?><span class='nb-filters'><?= ($nbFilters > 0 ? " (".$nbFilters.")" : "") ?></span></span>
    </button>
<?php endif; ?>