@using System.Collections.Generic
@using System.Linq
@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="delivery-address-container">
    @using (Html.BeginForm("SetAddress", "SetShippingAddress", FormMethod.Post, new { id = "shipping-address" }))
    {
        <div class="border-all margin-bottom-20">
            <div class="sub-header grey-background">
                @Resource("Checkout - Who shall we deliver to?", "Who shall we deliver to?")
            </div>
            <div class="padding-20">
                <div class="form-horizontal">
                    @if (otherAddresses.Any())
                    {
                        <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 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>

            </div>
        </div>
        
        <div class="border-all margin-bottom-20">
            <div class="sub-header grey-background">
                @Resource("Checkout - Where would you like to deliver?", "Where would you like to deliver?")
            </div>
            <div class="padding-20">
                
                <div class="form-horizontal">
                    
                    <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 text-right"></div>
                        <div class="col-sm-8 col-md-6">
                            <input type="submit" class="btn btn-primary btn-block" id="continue" name="continue" value="@Resource("Deliver to This Address")" />
                        </div>
                    </div>

                </div>

            </div>
        </div>
    }
</div>