@using MrCMS.Helpers
@model IList<MrCMS.Web.Apps.Ecommerce.Entities.ProductReviews.ProductReview>

    @using (Html.BeginForm())
    {
        @Html.ReturnToThis()
        <div>
            <span class="btn-group display-inline pull-right">
                <input class="btn btn-primary" type="submit" name="Approve" value="Approve" />
                <input class="btn btn-warning" type="submit" name="Reject" value="Reject" />
                <input class="btn btn-danger" type="submit" name="Delete" value="Delete" />
            </span>
        </div>
        <br />
        <br />

        <table class="table table-condensed table-striped">
            <thead>
                <tr>
                    <th>
                        
                    </th>
                    <th>
                        Product
                    </th>
                    <th>
                        Email
                    </th>
                    <th>
                        Name
                    </th>
                    <th>
                        Title
                    </th>
                    <th>
                        Status
                    </th>
                    <th>
                        Actions
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model)
                {
                    var status = "";
                    switch (item.Approved)
                    {
                        case true:
                            status = "Approved";
                            break;
                        case false:
                            status = "Rejected";
                            break;
                        default:
                            status = "Requires Approval";
                            break;
                    }

                    <tr>
                        <td>
                            @Html.CheckBox(string.Format("review-{0}", item.Id), item.Approved)
                        </td>
                        <td>
                            @item.ProductVariant.DisplayName
                        </td>
                        <td>
                            @item.Email
                        </td>
                        <td>
                            @item.Name
                        </td>
                        <td>
                            @item.Title
                        </td>
                        <td>
                            @status
                        </td>
                        <td>
                            <div class="btn-group">
                                @Html.ActionLink("Show", "Show", "ProductReview", new { id = item.Id }, new { @class = "btn btn-default btn-xs", data_toggle = "fb-modal" })
                                @Html.ActionLink("Edit", "Edit", "ProductReview", new { id = item.Id }, new { @class = "btn btn-xs btn-default", data_toggle = "fb-modal" })
                                @Html.ActionLink("Delete", "Delete", "ProductReview", new { id = item.Id }, new { @class = "btn btn-xs btn-danger", data_toggle = "fb-modal" })
                            </div>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    }
