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.9 KB
Raw Blame
@model PaymentMethodRestrictionModel

<admin-card>
    <div class="note note-info">
        @Loc["Admin.Configuration.Payment.MethodRestrictions.DescriptionCountry"]
    </div>
    @if (Model.AvailablePaymentMethods.Count == 0)
    {
        <text>No payment methods installed</text>
    }
    else if (Model.AvailableCountries.Count == 0)
    {
        <text>No countries available</text>
    }
    else
    {
                    <script>
                            $(document).ready(function () {
                                @foreach (var pm in Model.AvailablePaymentMethods)
                                {
                                    var systemNameWithoutDot = pm.SystemName.Replace(".", "");
                                    <text>
                                $('#selectall-@(systemNameWithoutDot)').click(function () {
                                    $('.restrict_@(systemNameWithoutDot)').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.Payment.MethodRestrictions.Country"]</strong>
                    </th>
                    @foreach (var pm in Model.AvailablePaymentMethods)
                    {
                        var systemNameWithoutDot = pm.SystemName.Replace(".", "");
                        <th scope="col" class="text-center">
                            <strong>@pm.FriendlyName</strong>
                            <br/>
                            <input class="form-check-input" type="checkbox" id="selectall-@(systemNameWithoutDot)"/>
                        </th>
                    }
                </tr>
                @foreach (var c in Model.AvailableCountries)
                {
                    <tr>
                        <td>
                            <span>@c.Name</span>
                        </td>
                        @foreach (var pm in Model.AvailablePaymentMethods)
                        {
                            var resticted = Model.Resticted.ContainsKey(pm.SystemName) && Model.Resticted[pm.SystemName][c.Id];
    
                            var systemNameWithoutDot = pm.SystemName.Replace(".", "");
                            <td class="text-center">
                                <input class="restrict_@(systemNameWithoutDot) form-check-input" type="checkbox" value="@(c.Id)" name="restrict_@(systemNameWithoutDot)" @(resticted ? " checked=checked" : null)/>
                            </td>
                        }
                    </tr>
                }
                </tbody>
            </table>
        </div>
    }
</admin-card>