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.6 KB
Raw Blame
@model ShippingMethodRestrictionModel

<admin-card>
    <div class="note note-info">
        @Loc["Admin.Configuration.Shipping.Restrictions.DescriptionGroup"]
    </div>
    @if (Model.AvailableCountries.Count == 0)
    {
        <text>No countries defined</text>
    }
    else if (Model.AvailableCustomerGroups.Count == 0)
    {
        <text>No custome group available</text>
    }
    else
    {
                    <script>
                        $(document).ready(function () {
                            @foreach (var sm in Model.AvailableShippingMethods)
                            {
                                <text>
                            $('#selectgroupall-@(sm.Id)').click(function () {
                                $('.restrictgroup_@(sm.Id)').prop('checked', $(this).is(':checked')).change();
                            });

                            </text>
                            }
                        });
                    </script>
        <div class="table-responsive">
            <table class="table table-sm table-hover align-middle mb-0">
                <tbody>
                <tr>
                    <th scope="col">
                        <strong>@Loc["Admin.Configuration.Shipping.Restrictions.Group"]</strong>
                    </th>
                    @foreach (var sm in Model.AvailableShippingMethods)
                    {
                        <th scope="col" class="text-center">
                            <strong>@sm.Name</strong>
                            <br/>
                            <input class="form-check-input" type="checkbox" id="selectgroupall-@(sm.Id)"/>
                        </th>
                    }
                </tr>
                @foreach (var c in Model.AvailableCustomerGroups)
                {
                    <tr>
                        <td>
                            <span>@c.Name</span>
                        </td>
                        @foreach (var sm in Model.AvailableShippingMethods)
                        {
                            var restricted = Model.RestictedGroup.ContainsKey(c.Id) && Model.RestictedGroup[c.Id][sm.Id];
                            <td class="text-center">
                                <input id="restrictgroup_@(sm.Id)" class="restrictgroup_@(sm.Id) form-check-input" type="checkbox" value="@(c.Id)" name="restrictgroup_@(sm.Id)" @(restricted ? " checked=checked" : null)/>
                            </td>
                        }
                    </tr>
                }
                </tbody>
            </table>
        </div>
    }
</admin-card>