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.5 KB
Raw Blame
@using Constants = Grand.SharedUIResources.Constants
@model Grand.Web.AdminShared.Models.PushNotifications.MessagesModel
@{
    Layout = "_AdminLayout";
    //page title
    ViewBag.Title = Loc["Admin.PushNotifications.Messages"];
}

<script asp-src="@(Constants.WwwRoot)/administration/chart.min.js"></script>

@* The allowed/denied split as a chart card above the sent messages in a flush card. *@
<admin-page title="@Loc["Admin.PushNotifications.Messages"]" icon="bi-boxes">
    @if (!(Model.Allowed == 0 && Model.Denied == 0))
    {
        <admin-card>
            <div class="w-50">
                <canvas id="piechart"></canvas>
            </div>
        </admin-card>
    }

    <admin-card flush>
        <admin-grid id="messages-grid" read-url="@Url.Action("PushMessagesList", "PushNotifications", new { area = Grand.Web.Admin.Extensions.Constants.AreaAdmin })">
            <grid-column field="Id" title="@Loc["Admin.PushNotifications.Message.Fields.Id"]" width="100"/>
            <grid-column field="Title" title="@Loc["Admin.PushNotifications.Message.Fields.Title"]" width="200"/>
            <grid-column field="Text" title="@Loc["PushNotifications.Message.Fields.Text"]" width="400"/>
            <grid-column field="NumberOfReceivers" title="@Loc["Admin.PushNotifications.Message.Fields.NumberOfReceivers"]" width="100"/>
            <grid-column field="SentOn" title="@Loc["Admin.PushNotifications.Message.Fields.SentOn"]" width="200" format="{0:G}"/>
        </admin-grid>
    </admin-card>
</admin-page>


@if (!(Model.Allowed == 0 && Model.Denied == 0))
{
    <script asp-location="Footer">
    $(document).ready(function () {
        var config = {
            type: 'pie',
            data: {
                datasets: [{
                    data: [
                        @Model.Allowed,
                        @Model.Denied
                    ],
                    backgroundColor: [
                        'rgba(0, 200, 0, 0.6)',
                        "rgba(200, 0, 0, 0.6)"
                    ],
                    borderColor: [
                        'rgb(0, 128, 0)',
                        'rgb(128, 0, 0)'
                    ],
                    label: 'Allow notifications popup statistics'
                }],
                labels: [
                    'Allowed',
                    'Denied'
                ]
            },
            options: {
                responsive: true
            }
        };

        var ctx = document.getElementById('piechart').getContext('2d');
        window.myPie = new Chart(ctx, config);
    });
    </script>
}