@using MrCMS.Helpers
@model MrCMS.Web.Apps.Ecommerce.Entities.Users.Address
@{
    var otherAddresses = ViewData["other-addresses"] as List<SelectListItem>;
    var countryOptions = ViewData["country-options"] as List<SelectListItem>;
}
<div id="billing-address">
    @using (Html.BeginForm("SaveBillingAddress", "PaymentDetails", FormMethod.Post, new { @class = "form-horizontal" }))
    {

        if (otherAddresses != null && otherAddresses.Any())
        {
            <div class="form-horizontal">
                <div class="form-group">
                    <div class="col-sm-4 col-md-3 text-right">
                        <label class="control-label">@Resource("Use Existing Address")</label>
                    </div>
                    <div class="col-sm-8 col-md-6">
                        @Html.DropDownList("existing-addresses", otherAddresses, new { @class = "form-control" })
                    </div>
                </div>
            </div>
        }
        
        <div class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.FirstName, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.FirstName, new { placeholder = "First name", @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.FirstName)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.LastName, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.LastName, new { placeholder = "Last name", @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.LastName)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.Company, new { @class = "control-label" })
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.Company, new { placeholder = "Company", @class = "form-control " })
                    @Html.ValidationMessageFor(address => address.Company)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.PhoneNumber, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.PhoneNumber, new { placeholder = "Phone number", @class = "form-control " })
                    @Html.ValidationMessageFor(address => address.PhoneNumber)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.Address1, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.Address1, new { placeholder = "Address 1", @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.Address1)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.Address2, new { @class = "control-label" })
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.Address2, new { placeholder = "Address 2", @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.Address2)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.City, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.City, new { placeholder = "City", @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.City)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.StateProvince, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.StateProvince, new { placeholder = "State/Province", @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.StateProvince)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.CountryCode, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.DropDownListFor(address => address.CountryCode, countryOptions, new { @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.CountryCode)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3 text-right">
                    @Html.LabelFor(address => address.PostalCode, new { @class = "control-label" }) <span class="red">*</span>
                </div>
                <div class="col-sm-8 col-md-6">
                    @Html.TextBoxFor(address => address.PostalCode, new { placeholder = "Postal Code", @class = "form-control" })
                    @Html.ValidationMessageFor(address => address.PostalCode)
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-sm-4 col-md-3"></div>
                <div class="col-sm-8 col-md-6">
                    <input type="submit" class="btn btn-default btn-block" id="continue" name="continue" value="@Resource("Set Billing Address")" />
                </div>
            </div>

        </div>
    }
</div>
