@using MrCMS.Helpers
@model List<MrCMS.Models.SortItem>
@{ Layout = "~/Areas/Admin/Views/Shared/_LayoutPopup.cshtml";}

@using (Html.BeginForm("Sort", "ProductSpecificationAttributeOption", FormMethod.Post))
{
    <fieldset>
        <legend>
            Sort Product Specification Atrribute Options
            <span class="btn-group  display-inline  pull-right">
                <button class="btn btn-primary" id="submit">
                    Save & Close</button>
            </span>
        </legend>

        @Html.Hidden("attributeId", ((MrCMS.Web.Apps.Ecommerce.Entities.Products.ProductSpecificationAttribute) ViewBag.ProductSpecificationAttribute).Id)
        <ul id="sortable">
            @if (Model.Any())
            {
                for (var i = 0; i < Model.Count; i++)
                {
                    <li>
                        @Html.HiddenFor(model => model[i].Id)
                        @Html.HiddenFor(model => model[i].Order)
                        <i class="glyphicon glyphicon-resize-full"></i>&nbsp;&nbsp;
                        @Model[i].Name
                    </li>
                }
            }
            else
            {
                <li>No options to sort.</li>
            }
        </ul>
    </fieldset>
}

@{ Html.IncludeScript("~/Apps/Ecommerce/Areas/Admin/Content/Scripts/custom/sorting.js"); }