@using MrCMS.Paging
@using MrCMS.Web.Apps.Ecommerce.Stock.Entities
@model MrCMS.Web.Apps.Ecommerce.Areas.Admin.Models.WarehouseSearchModel
@{
    var warehouses = ViewData["results"] as IPagedList<Warehouse> ?? PagedList<Warehouse>.Empty;
}

<form>
    <fieldset>
        <legend>
            Warehouse Stock
            <span class="btn-group display-inline pull-right">
                @Html.ActionLink("Add", "Add", "Warehouse", null, new { @class = "btn btn-primary", data_toggle = "fb-modal" })
            </span>
        </legend>
        @if (warehouses.Any())
        {
            <table class="table table-condensed table-striped">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Actions</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var warehouse in warehouses)
                    {
                        <tr>
                            <td>
                                @warehouse.Name
                            </td>
                            <td>
                                <div class="btn-group">
                                    @Html.ActionLink("Edit", "Edit", "Warehouse", new { id = warehouse.Id }, new { @class = "btn btn-xs btn-default" })
                                    @Html.ActionLink("Delete", "Delete", "Warehouse", new { id = warehouse.Id }, new { @class = "btn btn-xs btn-danger", data_toggle = "fb-modal" })
                                </div>
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        }
        else
        {
            <p>No warehouses.</p>
        }
    </fieldset>
</form>
