ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/Payment/MethodRestrictions.TabShipping.cshtml
@model PaymentMethodRestrictionModel
<div class="form-horizontal">
    <div class="form-body">
        <div class="form-group">
            <div class="col-md-12 col-sm-12">
                <div class="note note-info">
                    @T("Admin.Configuration.Payment.MethodRestrictions.DescriptionShipping")
                </div>
                @if (Model.AvailablePaymentMethods.Count == 0)
                {
                    <text>No payment methods installed</text>
                }
                else if (Model.AvailableShippingMethods.Count == 0)
                {
                    <text>No shipping method available</text>
                }
                else
                {
                    <script>
                            $(document).ready(function () {
                                @foreach (var pm in Model.AvailablePaymentMethods)
                                {
                                    var systemNameWithoutDot = pm.SystemName.Replace(".", "");
                                    <text>
                                    $('#selectshipall-@(systemNameWithoutDot)').click(function () {
                                        $('.restrictship_@(systemNameWithoutDot)').prop('checked', $(this).is(':checked')).change();
                                    });

                                    </text>
                                }
                            });
                    </script>
                        <table class="table table-bordered table-striped table-hover table-hover">
                            <tbody>
                                <tr>
                                    <th scope="col">
                                        <strong>@T("Admin.Configuration.Payment.MethodRestrictions.Shipping")</strong>
                                    </th>
                                    @foreach (var pm in Model.AvailablePaymentMethods)
                                    {
                                        var systemNameWithoutDot = pm.SystemName.Replace(".", "");
                                        <th scope="col">
                                            <strong>@pm.FriendlyName</strong>
                                            <label class='mt-checkbox mt-checkbox-outline control control-checkbox'><input type="checkbox" id="selectshipall-@(systemNameWithoutDot)" /> <div class="control__indicator"></div></label>
                                        </th>
                                    }
                                </tr>
                                @{
                                    bool altRow = true;
                                }
                                @foreach (var c in Model.AvailableShippingMethods)
                                {
                                    altRow = !altRow;
                                    <tr class="@(altRow ? "altrowstyle" : "rowstyle")">
                                        <td>
                                            <span>@c.Name</span>
                                        </td>
                                        @foreach (var pm in Model.AvailablePaymentMethods)
                                        {
                                            var resticted = Model.RestictedShipping.ContainsKey(pm.SystemName) && Model.RestictedShipping[pm.SystemName][c.Name];
                                            var systemNameWithoutDot = pm.SystemName.Replace(".", "");
                                            <td style="text-align:center">
                                                <label class='mt-checkbox mt-checkbox-outline control control-checkbox'><input class="restrictship_@(systemNameWithoutDot)" type="checkbox" value="@(c.Name)" name="restrictship_@(pm.SystemName)" @(resticted ? " checked=checked" : null) /> <div class="control__indicator"></div></label>
                                            </td>
                                        }
                                    </tr>
                                }
                            </tbody>
                        </table>
                }
            </div>
        </div>
    </div>
</div>