Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

5.8 KB
Raw Blame
@using Grand.Business.Core.Interfaces.Common.Security
@using Grand.Domain.Permissions
@inject IPermissionService permissionService

@{
    //page title
    ViewBag.Title = Loc["Admin.Dashboard.Statistics"];
    var canManageOrders = await permissionService.Authorize(StandardPermission.ManageOrders);
    var canManageCustomers = await permissionService.Authorize(StandardPermission.ManageCustomers);
    var canManageProducts = await permissionService.Authorize(StandardPermission.ManageProducts);
}

<div class="grand-dashboard">
    <header class="grand-dashboard__header">
        <div>
            <h1 class="grand-dashboard__title">@Loc["Admin.Dashboard.Statistics"]</h1>
            <p class="grand-dashboard__subtitle">
                <i class="bi bi-bar-chart-line" aria-hidden="true"></i>
                <span>@Loc["Admin.Dashboard"]</span>
            </p>
        </div>
    </header>

    @if (canManageOrders)
    {
        <section class="grand-card" aria-labelledby="statistics-average">
            <header class="grand-card__header">
                <i class="bi bi-calculator grand-card__icon" aria-hidden="true"></i>
                <h2 id="statistics-average" class="grand-card__title">@Loc["Admin.Reports.Average"]</h2>
            </header>
            <div class="grand-card__body">
                @await Component.InvokeAsync("OrderAverageReport")
            </div>
        </section>
    }

    @if (canManageOrders || canManageCustomers || canManageProducts)
    {
        <div class="row g-3">
            @if (canManageOrders)
            {
                <div class="col-12 col-xl-6">
                    <section class="grand-card h-100" aria-labelledby="statistics-incomplete">
                        <header class="grand-card__header">
                            <i class="bi bi-hourglass-split grand-card__icon" aria-hidden="true"></i>
                            <h2 id="statistics-incomplete" class="grand-card__title">@Loc["Admin.Reports.Incomplete"]</h2>
                        </header>
                        <div class="grand-card__body">
                            @await Component.InvokeAsync("OrderIncompleteReport")
                        </div>
                    </section>
                </div>
                <div class="col-12 col-xl-6">
                    <section class="grand-card h-100" aria-labelledby="statistics-registered">
                        <header class="grand-card__header">
                            <i class="bi bi-person-plus grand-card__icon" aria-hidden="true"></i>
                            <h2 id="statistics-registered" class="grand-card__title">@Loc["Admin.Reports.Customers.RegisteredCustomers"]</h2>
                        </header>
                        <div class="grand-card__body">
                            @await Component.InvokeAsync("CustomerReportRegistered")
                        </div>
                    </section>
                </div>
            }
            @if (canManageProducts)
            {
                <div class="col-12 col-xl-6">
                    <section class="grand-card h-100" aria-labelledby="statistics-search-terms">
                        <header class="grand-card__header">
                            <i class="bi bi-search grand-card__icon" aria-hidden="true"></i>
                            <h2 id="statistics-search-terms" class="grand-card__title">@Loc["Admin.SearchTermReport"]</h2>
                        </header>
                        <div class="grand-card__body">
                            @await Component.InvokeAsync("PopularSearchTermsReport")
                        </div>
                    </section>
                </div>
            }
            @if (canManageOrders)
            {
                <div class="col-12 col-xl-6">
                    <section class="grand-card h-100" aria-labelledby="statistics-period">
                        <header class="grand-card__header">
                            <i class="bi bi-calendar3 grand-card__icon" aria-hidden="true"></i>
                            <h2 id="statistics-period" class="grand-card__title">@Loc["Admin.Reports.Period"]</h2>
                        </header>
                        <div class="grand-card__body">
                            @await Component.InvokeAsync("OrderPeriodReport")
                        </div>
                    </section>
                </div>
            }
        </div>
    }

    @if (canManageOrders)
    {
        <div class="row g-3">
            <div class="col-12 col-xl-6">
                <section class="grand-card h-100" aria-labelledby="statistics-bestsellers-quantity">
                    <header class="grand-card__header">
                        <i class="bi bi-trophy grand-card__icon" aria-hidden="true"></i>
                        <h2 id="statistics-bestsellers-quantity" class="grand-card__title">@Loc["Admin.Reports.BestSellers.ByQuantity"]</h2>
                    </header>
                    <div class="grand-card__body">
                        @await Component.InvokeAsync("BestsellersBriefReportByQuantity")
                    </div>
                </section>
            </div>
            <div class="col-12 col-xl-6">
                <section class="grand-card h-100" aria-labelledby="statistics-bestsellers-amount">
                    <header class="grand-card__header">
                        <i class="bi bi-cash-coin grand-card__icon" aria-hidden="true"></i>
                        <h2 id="statistics-bestsellers-amount" class="grand-card__title">@Loc["Admin.Reports.BestSellers.ByAmount"]</h2>
                    </header>
                    <div class="grand-card__body">
                        @await Component.InvokeAsync("BestsellersBriefReportByAmount")
                    </div>
                </section>
            </div>
        </div>
    }
</div>