@model Telerik.Web.Mvc.GridModel<ProductReviewModel>
@using Telerik.Web.Mvc.UI

@{
    var gridPageSize = EngineContext.Current.Resolve<Nop.Core.Domain.Common.AdminAreaSettings>().GridPageSize;
}
<div class="section-header">
    <div class="title">
        <img src="@Url.Content("~/Administration/Content/images/ico-catalog.png")" alt="" />
        @T("Admin.Catalog.ProductReviews")
    </div>
    <div class="options">
    </div>
</div>
<table class="adminContent">
    <tr>
        <td>
            @(Html.Telerik().Grid<ProductReviewModel>(Model.Data)
                    .Name("productreviews-grid")
                    .Columns(columns =>
                    {
                        columns.Bound(x => x.Id)
                            .Width(50);
                        columns.Bound(x => x.ProductName)
                            .Width(200)
                            .Template(x => Html.ActionLink(x.ProductName, "Edit", "Product", new { id = x.ProductId }, new { }))
                            .ClientTemplate("<a href=\"" + @Url.Content("~/Admin/Product/Edit/") + "<#= ProductId #>\"><#= ProductName #></a>");
                        columns.Bound(x => x.CustomerId)
                            .Width(50)
                            .Template(x => Html.ActionLink(T("Admin.Common.View").Text, "Edit", "Customer", new { id = x.CustomerId }, new { }))
                            .ClientTemplate("<a href=\"" + @Url.Content("~/Admin/Customer/Edit/") + "<#= CustomerId #>\">" + T("Admin.Common.View").Text + "</a>");
                        columns.Bound(x => x.Title)
                            .Width(150)
                            .Centered();
                        columns.Bound(x => x.ReviewText)
                            .Width(350)
                            .Encoded(false)
                            .Centered();
                        columns.Bound(x => x.Rating)
                            .Width(50)
                            .Centered();
                        columns.Bound(x => x.IsApproved)
                            .Width(50)
                            .Centered();
                        columns.Bound(x => x.CreatedOn)
                            .Width(100)
                            .Centered();
                        columns.Bound(x => x.Id)
                            .Width(50)
                            .Centered()
                            .Template(x => Html.ActionLink(T("Admin.Common.Edit").Text, "Edit", new { id = x.Id }))
                            .ClientTemplate("<a href=\"Edit/<#= Id #>\">" + T("Admin.Common.Edit").Text + "</a>")
                            .Title(T("Admin.Common.Edit").Text);
                    })
                    .Pageable(settings => settings.Total(Model.Total).PageSize(gridPageSize).Position(GridPagerPosition.Both))
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("List", "ProductReview"))
                    .EnableCustomBinding(true))
        </td>
    </tr>
</table>
