ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/Vendor/_CreateOrUpdate.TabVendorReviews.cshtml
@model VendorModel
@inject AdminAreaSettings adminAreaSettings

<div class="panel panel-default">
    <vc:admin-widget widget-zone="vendor_details_reviews_top" additional-data="Model" />
    <div class="panel-body">
        <div id="reviews-grid"></div>
    </div>
    <vc:admin-widget widget-zone="vendor_details_reviews_bottom" additional-data="Model" />
</div>
<script>
$(document).ready(function () {
    $("#reviews-grid").kendoGrid({
        dataSource: {
            transport: {
                read: {
                    url: "@Html.Raw(Url.Action("Reviews", "Vendor", new { VendorId = Model.Id }))",
                    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();
            },
            pageSize: @(adminAreaSettings.DefaultGridPageSize),
            serverPaging: true,
            serverFiltering: true,
            serverSorting: true
        },
        pageable: {
            refresh: true,
            pageSizes: [@(adminAreaSettings.GridPageSizes)]
        },
        editable: {
            confirmation: false,
            mode: "inline"
        },
        scrollable: false,
        columns: [{
            field: "CustomerId",
            title: "@T("Admin.VendorReviews.Fields.Customer")",
            width: 200,
            template: '<a href="@Url.Action("Edit", "Customer")/#=CustomerId#">#:kendo.htmlEncode(CustomerInfo)#</a>'
        },
        {
            field: "Title",
            encoded: false,
            title: "@T("Admin.VendorReviews.Fields.Title")",
            width: 300
        },
        {
            field: "Rating",
            title: "@T("Admin.VendorReviews.Fields.Rating")",
            width: 100
        },
        {
            field: "IsApproved",
            title: "@T("Admin.VendorReviews.Fields.IsApproved")",
            width: 100,
            headerAttributes: { style: "text-align:center" },
            attributes: { style: "text-align:center" },
            template: '# if(IsApproved) {# <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: "CreatedOn",
            title: "@T("Admin.Orders.Fields.CreatedOn")",
            width: 200,
            type: "date",
            format: "{0:G}"
        },
        {
            field: "Id",
            title: "@T("Admin.Common.View")",
            width: 100,
            template: '<a class="btn btn-sm btn-default" href="@Url.Action("Edit", "VendorReview")/#=Id#"><i class="fa fa-search"></i> @T("Admin.Common.View")</a>'
        }]
    });
});
</script>