@model CatalogProductsModel
<script src="~/js/public.catalogproducts.js" asp-location="Footer"></script>

<div class="products-container">
    <div class="ajax-products-busy"></div>
    <div class="products-wrapper">
        @await Html.PartialAsync("_ProductsInGridOrLines", Model)
    </div>
</div>
<script asp-location="Footer">
    $(function() {
        CatalogProducts.init({
            ajax: @Model.UseAjaxLoading.ToString().ToLowerInvariant(),
            browserPath: '@Context.Request.Path',
            fetchUrl: '@ViewData["fetchUrl"]'
        });

        addPagerHandlers();
        $(CatalogProducts).on('loaded', function () {
            addPagerHandlers();
        });
    });

    function addPagerHandlers() {
        $('[data-page]').on('click', function (e) {
            e.preventDefault();
            CatalogProducts.getProducts($(this).data('page'));
            return false;
        });
    }
</script>