ildar-shaymukhametov_grandnode-refactorings/Plugins/Grand.Plugin.Shipping.ShippingPoint/Views/Configure.cshtml
@{
    Layout = "_ConfigurePlugin";

}

<form asp-controller="ShippingPoint" asp-action="Configure" method="post" id="shipping-instore-form">
    
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                <div id="shipping-points-grid"></div>
                <script>
                    $(document).ready(function() {
                        $("#shipping-points-grid").kendoGrid({
                            dataSource: {
                                type: "json",
                                transport: {
                                    read: {
                                        url: "@Html.Raw(Url.Action("List", "ShippingPoint"))",
                                        type: "POST",
                                        dataType: "json",
                                        data: addAntiForgeryToken
                                    },
                                    destroy: {
                                        url: "@Html.Raw(Url.Action("Delete", "ShippingPoint"))",
                                        type: "POST",
                                        dataType: "json",
                                        data: addAntiForgeryToken
                                    }
                                },
                                schema: {
                                    data: "Data",
                                    total: "Total",
                                    errors: "Errors",
                                    model: {
                                        id: "Id"
                                    }
                                },
                                requestEnd: function (e) {
                                    if (e.type == "update") {
                                        this.read();
                                    }
                                },
                                error: function(e) {
                                    display_kendoui_grid_error(e);
                                    this.cancelChanges();
                                },
                                serverPaging: true,
                                serverFiltering: true,
                                serverSorting: true
                            },
                            pageable: {
                                refresh: true,
                                numeric: false,
                                previousNext: false,
                                info: false
                            },
                            editable: {
                                confirmation: "@T("Admin.Common.DeleteConfirmation")",
                                mode: "inline"
                            },
                            scrollable: false,
                            columns: [ {
                                field: "ShippingPointName",
                                width: 200,
                                title: "@T("Plugins.Shipping.ShippingPoint.Fields.ShippingPointName")"
                            }, {
                                field: "OpeningHours",
                                width: 200,
                                title: "@T("Plugins.Shipping.ShippingPoint.Fields.OpeningHours")"
                            }, {
                                field: "PickupFee",
                                width: 150,
                                title: "@T("Plugins.Shipping.ShippingPoint.Fields.PickupFee")"
                            },{
                                field: "StoreName",
                                width: 100,
                                title: "@T("Plugins.Shipping.ShippingPoint.Fields.Store")"
                            }, {
                                field: "Id",
                                title: "@T("Admin.Common.Edit")",
                                width: 100,
                                template: "<input type='submit' value='@T("Admin.Common.Edit")' onclick=\"javascript:OpenWindow('@Url.Action("Edit", "ShippingPoint")?id=#=Id#&btnId=btnRefresh&formId=shipping-instore-form', 800, 800, true); return false;\" class='k-button k-button-icontext' />"
                            }, {
                                command: { name: "destroy", text: "@T("Admin.Common.Delete")" },
                                title: "@T("Admin.Common.Delete")",
                                width: 100
                            }]
                        });
                    });
                </script>
            </div>
            <div class="panel-footer">
                <input type="submit" id="btnAddNewOption" class="btn btn-primary" value="@T("Admin.Common.AddNew")" onclick="javascript:OpenWindow('@(Url.Action("Create", "ShippingPoint") + "?btnId=btnRefresh&formId=shipping-instore-form")', 800, 800, true); return false;" />
                <input type="submit" id="btnRefresh" class="btn btn-default" style="display: none" />
            </div>

            <script>
                $(document).ready(function () {
                    $('#btnRefresh').click(function () {
                        var grid = $("#shipping-points-grid").data('kendoGrid');
                        grid.dataSource.read();
                        return false;
                    });
                });
            </script>

        </div>
    </div>
</form>