@model IList<VendorModel.VendorAttributeModel>

@using Nop.Core.Domain.Catalog;
@using Nop.Services.Vendors

    <div class="card card-default advanced-setting">
        <div class="card-header">
            @T("Admin.Vendors.VendorAttributes")
        </div>
        <div class="card-body">
            @foreach (var attribute in Model)
            {
                var controlId = $"{NopVendorDefaults.VendorAttributePrefix}{attribute.Id}";
                var textPrompt = attribute.Name;
                <div class="form-group row">
                    <div class="col-md-3">
                        <div class="label-wrapper">
                            <label class="col-form-label">
                                @textPrompt
                            </label>
                        </div>
                    </div>
                    <div class="col-md-9">
                        @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:
                                {
                                    foreach (var attributeValue in attribute.Values)
                                    {
                                        <div class="form-check">
                                            <input type="radio" class="form-check-input" name="@(controlId)" id="@(controlId)_@(attributeValue.Id)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" >
                                            <label class="form-check-label" for="@(controlId)_@(attributeValue.Id)">
                                                @attributeValue.Name
                                            </label>
                                        </div>
                                    }
                                }
                                break;
                            case AttributeControlType.Checkboxes:
                            case AttributeControlType.ReadonlyCheckboxes:
                                {
                                    foreach (var attributeValue in attribute.Values)
                                    {
                                        <div class="form-check">
                                            <input class="form-check-input" type="checkbox" value="@attributeValue.Id" id="@(controlId)_@(attributeValue.Id)" name="@(controlId)" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null)>
                                            <label class="form-check-label" for="@(controlId)_@(attributeValue.Id)">
                                                @attributeValue.Name
                                            </label>
                                        </div>
                                    }
                                }
                                break;
                            case AttributeControlType.TextBox:
                                {
                                    <input name="@(controlId)" type="text" id="@(controlId)" value="@(attribute.DefaultValue)" class="form-control"/>
                                }
                                break;
                            case AttributeControlType.MultilineTextbox:
                                {
                                    <textarea id="@(controlId)" class="form-control" name="@(controlId)">@(attribute.DefaultValue)</textarea>
                                }
                                break;
                            case AttributeControlType.Datepicker:
                            case AttributeControlType.FileUpload:
                            case AttributeControlType.ColorSquares:
                            case AttributeControlType.ImageSquares:
                                {
                                    //not support attribute type
                                }
                                break;
                        }
                    </div>
                </div>
            }
        </div>
    </div>