Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

_CustomerAttributes.cshtml

@model IList<CustomerModel.CustomerAttributeModel>
@using Nop.Core.Domain.Catalog;
@using Nop.Services.Customers

@foreach (var customerAttribute in Model)
{
    var controlId = $"{NopCustomerServicesDefaults.CustomerAttributePrefix}{customerAttribute.Id}";
    var textPrompt = customerAttribute.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 (customerAttribute.AttributeControlType)
            {
                case AttributeControlType.DropdownList:
                    {
                        <select name="@(controlId)" id="@(controlId)" class="form-control">
                            @if (!customerAttribute.IsRequired)
                            {
                                <option value="0">---</option>
                            }
                            @foreach (var attributeValue in customerAttribute.Values)
                            {
                                <option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">@attributeValue.Name</option>
                            }
                        </select>
                    }
                    break;
                case AttributeControlType.RadioList:
                    {
                        foreach (var attributeValue in customerAttribute.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 customerAttribute.Values)
                        {
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" value="@attributeValue.Id" id="@(controlId)_@(attributeValue.Id)" name="@(controlId)" checked="@attributeValue.IsPreSelected" @(customerAttribute.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="@(customerAttribute.DefaultValue)" class="form-control"/>
                    }
                    break;
                case AttributeControlType.MultilineTextbox:
                    {
                        <textarea id="@(controlId)" class="form-control" name="@(controlId)">@(customerAttribute.DefaultValue)</textarea>
                    }
                    break;
                case AttributeControlType.Datepicker:
                case AttributeControlType.FileUpload:
                case AttributeControlType.ColorSquares:
                case AttributeControlType.ImageSquares:
                    {
                        //not support attribute type
                    }
                    break;
            }
        </div>
    </div>
}