ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/NewsletterCategory/List.cshtml
@{
    //page title
    ViewBag.Title = T("Admin.Promotions.NewsletterCategory").Text;
}

<div class="row">
    <div class="col-md-12">
        <div class="x_panel light form-fit">
            <div class="x_title">
                <div class="caption">
                    <i class="fa fa-tags"></i>
                    @T("Admin.Promotions.NewsletterCategory")
                </div>
                <div class="actions btn-group btn-group-devided">
                    <a href="@Url.Action("Create")" class="btn green"><i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @T("Admin.Common.AddNew") </span></a>
                </div>
            </div>
            <div class="x_content form">
                <div class="form-horizontal">
                    <div class="form-body">
                        <div class="x_content">
                            <div id="newslettercategory-grid"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        $("#newslettercategory-grid").kendoGrid({
            dataSource: {
                transport: {
                    read: {
                        url: "@Html.Raw(Url.Action("List", "NewsletterCategory"))",
                        type: "POST",
                        dataType: "json",
                        data: addAntiForgeryToken
                    }
                },
                schema: {
                    data: "Data",
                    total: "Total",
                    errors: "Errors"
                },
                error: function(e) {
                    display_kendoui_grid_error(e);
                    // Cancel the changes
                    this.cancelChanges();
                },
                serverPaging: true,
                serverFiltering: true,
                serverSorting: true
            },
            pageable: {
                refresh: true,
                numeric: false,
                previousNext: false,
                info: false
            },
            editable: {
                confirmation: false,
                mode: "inline"
            },
            scrollable: false,
            columns: [{
                field: "Name",
                title: "@T("Admin.Promotions.NewsletterCategory.Fields.Name")",
                template: '<a class="k-link" href="Edit/#=Id#">#=kendo.htmlEncode(Name)#</a>',
            }, {
                field: "Selected",
                title: "@T("Admin.Promotions.NewsletterCategory.Fields.Selected")",
                width: 100,
                headerAttributes: { style: "text-align:center" },
                attributes: { style: "text-align:center" },
                template: '# if(Selected) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
            }, {
                field: "DisplayOrder",
                title: "@T("Admin.Promotions.NewsletterCategory.Fields.DisplayOrder")",
                width: 120
            }]
        });
    });
</script>
