ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Views/Customer/_CustomerAttributes.cshtml
@model IList<Grand.Web.Models.Customer.CustomerAttributeModel>
@using Grand.Domain.Catalog;
@foreach (var attribute in Model)
{
    string controlId = string.Format("customer_attribute_{0}", attribute.Id);
    string textPrompt = attribute.Name;
    <div class="row">
            <div class="col-12 form-group custom-attributes">
            @switch (attribute.AttributeControlType)
            {
                case AttributeControlType.DropdownList:
                    {
                        <label for="@(controlId)" class="col-form-label">@textPrompt:</label>
                        <select class="custom-select form-control" name="@(controlId)" id="@(controlId)">
                            @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:
                    {

                        <span class="col-form-label">@textPrompt:</span>
                        <ul class="option-list pl-0">
                            @foreach (var attributeValue in attribute.Values)
                            {
                                <li>
                                    <fieldset>
                                        <legend class="sr-only">@(controlId)</legend>
                                        <label class="custom-control custom-radio">
                                            <input class="custom-control-input" id="@(controlId)_@(attributeValue.Id)" type="radio" name="@(controlId)" value="@attributeValue.Id" />
                                            <span class="custom-control-label"></span>
                                            <span class="custom-control-description">@attributeValue.Name</span>
                                        </label>
                                    </fieldset>

                                </li>
                            }
                        </ul>
                    }
                    break;
                case AttributeControlType.Checkboxes:
                case AttributeControlType.ReadonlyCheckboxes:
                    {
                        <span class="col-form-label">@textPrompt:</span>
                        <ul class="option-list pl-0">
                            @foreach (var attributeValue in attribute.Values)
                            {
                                <li>

                                    <label for="@(controlId)_@(attributeValue.Id)" class="custom-control custom-checkbox">
                                        <input class="custom-control-input" id="@(controlId)_@(attributeValue.Id)" type="checkbox" name="@(controlId)" value="@(attributeValue.Id)" checked="@(attributeValue.IsPreSelected)" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) />
                                        <span class="custom-control-label"></span>
                                        <span class="custom-control-description">@attributeValue.Name</span>
                                    </label>

                                </li>
                            }
                        </ul>
                    }
                    break;
                case AttributeControlType.TextBox:
                    {
                        <label for="@(controlId)" class="col-form-label">@textPrompt:</label>
                        <input name="@(controlId)" type="text" class="form-control textbox" id="@(controlId)" value="@(attribute.DefaultValue)" />
                    }
                    break;
                case AttributeControlType.MultilineTextbox:
                    {
                        <label for="@(controlId)" class="col-form-label">@textPrompt:</label>
                        <textarea class="form-control" id="@(controlId)" 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>
}
