@using System.Linq
@model MrCMS.Web.Apps.Ecommerce.Pages.Product
<div id="category-list">
    <div class="row">
        <div class="col-lg-6">
            <h4>Categories</h4>
        </div>
        <div class="col-lg-6">
            <div class="btn-group pull-right">
                @Html.ActionLink("Sort", "SortCategories", "Product", new { id = Model.Id }, new { @class = "btn btn-xs btn-default", data_toggle = "fb-modal" })
                @Html.ActionLink("Add", "AddCategory", "Product", new { id = Model.Id }, new { @class = "btn btn-xs btn-default", data_toggle = "fb-modal" })
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            @if (Model.Categories.Any())
            {
                <table class="table table-striped table-condensed">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var category in Model.Categories)
                        {
                            <tr>
                                <td>@category.NestedName</td>
                                <td>@Html.ActionLink("Remove", "RemoveCategory", "Product", new { id = Model.Id, categoryId = category.Id }, new { @class = "btn btn-danger btn-xs pull-right", data_toggle = "fb-modal" })</td>
                            </tr>
                        }
                    </tbody>
                </table>
            }
            else
            {
                <p>Please click add to add a category.</p>
            }
        </div>
    </div>
</div>
