<?php

use Oney\ThreeByFour\Block\Catalog\Simulation;

/** @var  Simulation $block */
$simulationsByPrices = $block->getSimulations();
$simulationContentClasses = $this->getSimulationsContentClasses();

if (!empty($simulationsByPrices)) :
?>
    <div id="oney-threebyfour-simulator" class="<?php echo $this->getCssClassCountry(); ?>">
        <?php foreach ($simulationsByPrices as $price => $simulations): ?>
            <?php if (empty($simulations)) continue; ?>
            <div class="oney-threebyfour-simulator-content <?php echo $simulationContentClasses[$price]; ?>">
            <?php foreach ($simulations as $key => $simulation) {
                if (!isset($simulation['instalments'])) continue;
            } ?>
            </div>
        <?php endforeach; ?>
    </div>
    <script type="text/x-magento-init">
    {
        "*": {
            "Oney_ThreeByFour/js/action/catalog/manage-simulation": {}
        },
        "#oney-threebyfour-simulator": {
            "Oney_ThreeByFour/js/view/product/simulation": {}
        }
    }
    </script>
<?php endif; ?>
