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.

2.3 KB
Raw Blame
@model CountryReportModel
@inject IReportDataScope Scope
@{
    //page title
    ViewBag.Title = Loc[$"{Scope.ResourceKeyPrefix}.Reports.Country"];
    var area = ViewContext.RouteData.Values["area"]?.ToString();
}

@* The bestsellers report's shape: the criteria in a filter bar opened on load, the grid in a flush
   card, Search as the one primary action. The ids the script below looks up are unchanged. *@
<admin-page title="@Loc[$"{Scope.ResourceKeyPrefix}.Reports.Country"]" icon="bi-card-list">
    <partial name="Partials/WidgetZone.Country" model="Model"/>

    <admin-filters id="countryreport-filters" submit-id="search-countryreport" expanded="true">
        <div class="grand-range">
            <admin-field asp-for="StartDate"/>
            <admin-field asp-for="EndDate"/>
        </div>
        <admin-field asp-for="OrderStatusId" asp-items="Model.AvailableOrderStatuses"/>
        <admin-field asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses"/>
    </admin-filters>

    <admin-card flush>
        <admin-grid id="countryreport-grid"
                    read-url="@Url.Action("CountryReportList", "Reports", new { area })"
                    additional-data="additionalData"
                    pager="Compact">
            <grid-column field="CountryName" title="@Loc["Admin.Reports.Country.Fields.CountryName"]"/>
            <grid-column field="TotalOrders" title="@Loc["Admin.Reports.Country.Fields.TotalOrders"]"/>
            <grid-column field="SumOrders" title="@Loc["Admin.Reports.Country.Fields.SumOrders"]"/>
        </admin-grid>
    </admin-card>
</admin-page>

<script>

        $(document).ready(function () {

            $('#search-countryreport').click(function () {
                var grid = GrandAdmin.grids.get('#countryreport-grid');
                grid.dataSource.read();
                return false;
            });

        });

        function additionalData() {
            var data = {
                StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
                EndDate: $('#@Html.IdFor(model => model.EndDate)').val(),
                OrderStatusId: $('#OrderStatusId').val(),
                PaymentStatusId: $('#PaymentStatusId').val()
            };
            addAntiForgeryToken(data);
            return data;
        }

    </script>