<?php
/** @var \Magetop\Advancepreview\Block\PreviewMinicart $block */
$totalCart = $block->getTotalPriceInMiniCart();
//echo "TOTALAAL {$totalCart}";
$symobl = $block->getCurrentCurrencySymbol();
//echo $curency. 'Song dc bao lau';

?>
<?php if(isset($totalCart['is_custom']) && $totalCart['is_custom'] == 'yes') : ?>
<input type="hidden" id="txt-custom-minicart-total" value="<?php echo $totalCart['total_price']; ?>">
<input type="hidden" id="txt-custom-minicart-symobl" value="<?php echo trim($symobl); ?>">
<script>
    require([
        'jquery'
    ],function ($) {

        var txtPrice = $('#txt-custom-minicart-total').val();
        var symobl = $('#txt-custom-minicart-symobl').val();
        // console.log("MINI clicjk ", txtPrice);
      /*  setTimeout(function () {
            $('.minicart-wrapper .total-mini-cart-price .price').html(txtPrice);
        },5000)*/
        var sec = 0;
        var tiner = setInterval(function () {
            var qty = $('.total-mini-cart-price span').html();
            // console.log(qty, sec)
            if(qty !== symobl+'0.00') {
                $('.minicart-wrapper .total-mini-cart-price .price').html(txtPrice);
                clearInterval(tiner);
            }
            sec++;
        },500)
        setTimeout(function () {
            clearInterval(tiner);
        },11000)
        $('.minicart-wrapper .showcart').click(function () {
            console.log("testsete");
             $('#minicart-content-wrapper .block-content .price-wrapper > .price').html(txtPrice)
        })
        $('#top-cart-btn-checkout').click(function () {
            console.log("CLICK CLICK");
        })
    })
</script>
<?php endif; ?>
<?php $customerGroup = $block->getCustomerGroup(); ?>
<?php if($customerGroup < 2) : ?>
    <style>
        #block-collapsible-nav ul.items li:nth-child(3) {
            display: none;
        }

    </style>
<?php endif; ?>
