ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/ProductAttribute/_CreateOrUpdate.TabUsedByProducts.cshtml
@model ProductAttributeModel
@inject AdminAreaSettings adminAreaSettings
@{
    <div class="note note-info">
        @T("Admin.Catalog.Attributes.ProductAttributes.UsedByProducts.Hint")
    </div>
    <div class="panel panel-default">
        <vc:admin-widget widget-zone="product_attribute_details_used_by_products_top" additional-data="Model" />
        <div class="panel-body">
            <div id="used-by-products-grid"></div>
        </div>
        <vc:admin-widget widget-zone="product_attribute_details_used_by_products_bottom" additional-data="Model" />
    </div>
    <script>
    $(document).ready(function () {
        $("#used-by-products-grid").kendoGrid({
            dataSource: {
                transport: {
                    read: {
                        url: "@Html.Raw(Url.Action("UsedByProducts", "ProductAttribute", new { productAttributeId = 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: "ProductName",
                title: "@T("Admin.Catalog.Attributes.ProductAttributes.UsedByProducts.Product")",
                width: 400,
                template: '<a class="k-link" href="@Url.Action("Edit", "Product")/#=Id#">#=kendo.htmlEncode(ProductName)#</a>',
            }, {
                field: "Published",
                title: "@T("Admin.Catalog.Attributes.ProductAttributes.UsedByProducts.Published")",
                width: 100,
                headerAttributes: { style: "text-align:center" },
                attributes: { style: "text-align:center" },
                template: '# if(Published) {# <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> #} #'
            }]
        });
    });
    </script>
}
