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.

3.1 KB
Raw Blame
@model Grand.Web.AdminShared.Models.PushNotifications.ReceiversModel
@{
    Layout = "_AdminLayout";
    //page title
    ViewBag.Title = Loc["Admin.PushNotifications.Receivers"];
}


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

    <admin-card flush>
        <admin-grid id="receivers-grid"
                    read-url="@Url.Action("PushReceiversList", "PushNotifications", new { area = Constants.AreaAdmin })"
                    destroy-url="@Url.Action("DeleteReceiver", "PushNotifications", new { area = Constants.AreaAdmin })"
                    confirm-destroy="true">
            <grid-column field="CustomerId" title="@Loc["Admin.PushNotifications.Message.Fields.CustomerEmail"]" width="100">
                <cell-template>
                    <a class="text-decoration-none" href="@Url.Action("Edit", "Customer", new { area = Constants.AreaAdmin })/{{ CustomerId }}">{{ CustomerEmail }}</a>
                </cell-template>
            </grid-column>
            <grid-column field="Allowed" title="@Loc["Admin.PushNotifications.Message.Fields.Allowed"]" width="100" align="Center">
                <cell-template>
                    <i data-if="Allowed" class="bi bi-check-lg true-icon text-success"></i>
                    <i data-else class="bi bi-x-lg false-icon text-danger"></i>
                </cell-template>
            </grid-column>
            <grid-column field="RegisteredOn" title="@Loc["Admin.PushNotifications.Message.Fields.RegisteredOn"]" width="200" format="{0:G}"/>
            <grid-commands destroy="true" title="@Loc["Admin.Common.Delete"]" width="50"/>
        </admin-grid>
    </admin-card>
</admin-page>


@if (!(Model.Allowed == 0 && Model.Denied == 0))
{
    <script asp-src="@(Grand.SharedUIResources.Constants.WwwRoot)/administration/chart.min.js"></script>

    <script>
    $(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>
}