@inject Nop.Services.Common.IGenericAttributeService genericAttributeService
@inject IWorkContext workContext
@{
    const string cardId = "bestsellers-report-amount-card";
    const string hideCardAttributeName = "Reports.HideBestsellersBriefReportByAmountCard";
    var hideCard = await genericAttributeService.GetAttributeAsync<bool>(await workContext.GetCurrentCustomerAsync(), hideCardAttributeName);
}

<div class="card card-primary card-outline @if(hideCard){<text>collapsed-card</text>}" id="@cardId">
    <div class="card-header with-border">
        <h3 class="card-title">
            <i class="far fa-star"></i>
            @T("Admin.Reports.Sales.BestSellers.ByAmount")
        </h3>
        <div class="card-tools float-right">
            <button type="button" class="btn btn-tool" data-card-widget="collapse">
                @if (hideCard)
                {
                    <text><i class="fas fa-plus"></i></text>
                }
                else
                {
                    <text><i class="fas fa-minus"></i></text>
                }
            </button>
        </div>
    </div>
    <script>
        $(function() {
            var collapsed = !$('#@cardId').hasClass('collapsed-card');
            if (collapsed) {
                $('#bestsellersBriefReportByAmount').load('@Url.Action("GetBestsellersBriefReportByAmount", "Home")');
            }

            $('#@cardId').on('click', 'button[data-card-widget="collapse"]', function () {
                collapsed = !$('#@cardId').hasClass('collapsed-card');
                saveUserPreferences('@(Url.Action("SavePreference", "Preferences"))', '@hideCardAttributeName', collapsed);
                if (!collapsed) {
                    $('#bestsellersBriefReportByAmount').load('@Url.Action("GetBestsellersBriefReportByAmount", "Home")');
                }
            });
        });
    </script>
    <div class="card-body">
        <div id="bestsellersBriefReportByAmount"></div>
    </div>
</div>