@model IList<AddressAttributeModel>
@using Nop.Core.Domain.Catalog;
@foreach (var attribute in Model)
{
    var controlId = attribute.ControlId;
    var textPrompt = attribute.Name;

    <div class="inputs custom-attributes">
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2 col-md-2">@textPrompt:</label>
            <div class="col-xs-12 col-sm-6 col-md-6">
                @switch (attribute.AttributeControlType)
                {
                    case AttributeControlType.DropdownList:
                        {
                            <select name="@(controlId)" id="@(controlId)" class="form-control">
                                @if (!attribute.IsRequired)
                            {
                                    <option value="0">---</option>
                                }
                                @foreach (var attributeValue in attribute.Values)
                            {
                                    <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">@attributeValue.Name</option>
                                }
                            </select>
                        }
                    break;
                    case AttributeControlType.RadioList:
                        {
                            <ul class="option-list">
                                @foreach (var attributeValue in attribute.Values)
                            {
                                    <li>
                                        <input id="@(controlId)_@(attributeValue.Id)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" />
                                        <label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>
                                    </li>
                                }
                            </ul>
                        }
                    break;
                    case AttributeControlType.Checkboxes:
                    case AttributeControlType.ReadonlyCheckboxes:
                        {
                            <ul class="option-list">
                                @foreach (var attributeValue in attribute.Values)
                            {
                                    <li>
                                        <input id="@(controlId)_@(attributeValue.Id)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) />
                                        <label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label>
                                    </li>
                                }
                            </ul>
                        }
                    break;
                    case AttributeControlType.TextBox:
                        {
                            <input name="@(controlId)" type="text" class="textbox form-control" id="@(controlId)" value="@(attribute.DefaultValue)" />
                        }
                    break;
                    case AttributeControlType.MultilineTextbox:
                        {
                            <textarea id="@(controlId)" name="@(controlId)" class="form-control">@(attribute.DefaultValue)</textarea>
                        }
                    break;
                    case AttributeControlType.Datepicker:
                    case AttributeControlType.FileUpload:
                    case AttributeControlType.ColorSquares:
                    case AttributeControlType.ImageSquares:
                        {
                            //not support attribute type
                        }
                    break;
                }
            </div>
            <div class="col-sm-3 col-md-4">
                @if (attribute.IsRequired)
                {
                    <nop-required />
                }
            </div>
        </div>
    </div>
}
