@using MrCMS.Web.Apps.Ecommerce.Entities.Orders
@model MrCMS.Models.Auth.RegisterModel
@{
    var order = ViewData["order"] as Order;
    var errorMessage = TempData["register-error"] as string;
}

<div class="border-all margin-bottom-20">
    <div class="sub-header grey-background">
        @Resource("Order Placed - Register", "Would you like us to remember your details for next time?")  
    </div>
    <div class="padding-20">
        @if (!string.IsNullOrWhiteSpace(errorMessage))
        {
            <div class="alert alert-danger" role="alert">
                @errorMessage
            </div>
        }
        @using (Html.BeginForm("RegisterAndAssociateOrder", "OrderPlaced", null, FormMethod.Post, new { @class = "form-horizontal" }))
        {
            @Html.HiddenFor(model => model.Email)
            @Html.HiddenFor(model => model.FirstName)
            @Html.HiddenFor(model => model.LastName)
            @Html.Hidden("Id", order.Guid)
            <div class="row">
                <div class="col-sm-6">
                    <div class="margin-bottom-10">
                        @Html.LabelFor(model => model.Password, Resource("Simply enter a password"))
                        @Html.PasswordFor(model => model.Password, new { @class = "form-control" })
                        @Html.ValidationMessageFor(x => x.Password)
                    </div>
                    <br />
                    <div class="row">
                        <div class="col-sm-4">
                            <button type="submit" class="btn btn-primary btn-block">@Resource("Register")</button>
                        </div>
                    </div>
                </div>
            </div>
        }
    </div>
</div>