<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var $block \Magento\Checkout\Block\Cart\Sidebar */
?>

<div data-block="minicart" class="minicart-wrapper">
    <a class="action showcart" href="<?= $block->escapeUrl($block->getShoppingCartUrl()) ?>"
       data-bind="scope: 'minicart_content'">
			<span class="text"><?= $block->escapeHtml(__('My Cart')) ?></span> 
			<span class="counter qty empty"
				  data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
				<!-- <span class="icon-cart-header"><i class="menu-icon  icon flaticon-shopping-cart6">&nbsp;</i></span> -->
				<span class="total-mini-cart-item">
				<!-- ko if: getCartParam('summary_count') -->
					<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
				<!-- /ko -->
				<!-- ko if: !getCartParam('summary_count') -->
					0
				<!-- /ko --> 
				</span>
			</span>
			<!-- <span class="content-cart hidden-xs">
				<span class="my-cart">My cart:</span>
				<span class="total-mini-cart-price" data-bind="html: getCartParam('subtotal')"></span>
			</span> -->
    </a>
    <?php if ($block->getIsNeedToDisplaySideBar()) :?>
        <div class="block block-minicart"
             data-role="dropdownDialog"
             data-mage-init='{"dropdownDialog":{
                "appendTo":"[data-block=minicart]",
                "triggerTarget":".showcart",
                "timeout": "2000",
                "closeOnMouseLeave": false,
                "closeOnEscape": true,
                "triggerClass":"active",
                "parentClass":"active",
                "buttons":[]}}'>
            <div id="minicart-content-wrapper" data-bind="scope: 'minicart_content'">
                <!-- ko template: getTemplate() --><!-- /ko -->
            </div>
            <?= $block->getChildHtml('minicart.addons') ?>
        </div>
    <?php else :?>
        <script>
            require(['jquery'], function ($) {
                $('a.action.showcart').click(function() {
                    $(document.body).trigger('processStart');
                });
            });
        </script>
    <?php endif ?>
    <script>
        window.checkout = <?= /* @noEscape */ $block->getSerializedConfig() ?>;
    </script>
    <script type="text/x-magento-init">
    {
        "[data-block='minicart']": {
            "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
        },
        "*": {
            "Magento_Ui/js/block-loader": "<?= $block->escapeJs(
                $block->escapeUrl($block->getViewFileUrl('images/loader-1.gif'))
            ) ?>"
        }
    }
    </script>
</div>


