ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/Affiliate/_CreateOrUpdate.TabCustomers.cshtml
@model AffiliateModel
@inject AdminAreaSettings adminAreaSettings
@{
    <vc:admin-widget widget-zone="affiliate_details_customers_top" additional-data="Model" />
    <div id="customers-grid"></div>
    <script>
    $(document).ready(function () {
        $("#customers-grid").kendoGrid({
            dataSource: {
                transport: {
                    read: {
                        url: "@Html.Raw(Url.Action("AffiliatedCustomerList", "Affiliate", new { affiliateId = 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: "Name",
                title: "@T("Admin.Affiliates.Customers.Name")",
                template: '<a class="k-link" href="@Url.Action("Edit", "Customer")/#=Id#"">#=kendo.htmlEncode(Name)#</a>'
            }]
        });
    });
    </script>
    <vc:admin-widget widget-zone="affiliate_details_customers_bottom" additional-data="Model" />
}
