Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
@model IList<OrderModel.AddOrderProductModel.ProductAttributeModel>
@if (Model.Count > 0)
{
foreach (var attribute in Model)
{
@* a field of the caller's grid, drawn as <admin-field> draws one *@
<div class="grand-field">
@{
var controlId = $"attributes[{attribute.Id}]";
var textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;
}
<label class="grand-field__label" for="@(controlId)">
@textPrompt
@if (attribute.IsRequired)
{
<span class="required">*</span>
}
</label>
<div class="grand-field__control">
@switch (attribute.AttributeControlType)
{
case AttributeControlType.DropdownList:
{
<select class="form-select" name="@(controlId)" id="@(controlId)">
@if (!attribute.IsRequired)
{
<option value="">---</option>
}
@foreach (var attributeValue in attribute.Values)
{
<option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">
@attributeValue.Name
</option>
}
</select>
}
break;
case AttributeControlType.RadioList:
case AttributeControlType.ColorSquares:
case AttributeControlType.ImageSquares:
{
<div class="radio-list">
@foreach (var attributeValue in attribute.Values)
{
<div>
<input id="@(controlId)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected"/>
<label for="@(controlId)">@attributeValue.Name</label>
</div>
}
</div>
}
break;
case AttributeControlType.Checkboxes:
case AttributeControlType.ReadonlyCheckboxes:
{
<div class="checkbox-list">
@foreach (var attributeValue in attribute.Values)
{
<div>
<input id="@(controlId)" type="checkbox" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null)/>
<label for="@(controlId)">@attributeValue.Name</label>
</div>
}
</div>
}
break;
case AttributeControlType.TextBox:
{
<input name="@(controlId)" type="text" id="@(controlId)" class="form-control"/>
}
break;
case AttributeControlType.MultilineTextbox:
{
<textarea cols="20" id="@(controlId)" name="@(controlId)" rows="2" class="form-control"></textarea>
}
break;
case AttributeControlType.Datepicker:
{
<date-picker-dropdown control-day="@(controlId + "_day")"
control-month="@(controlId + "_month")"
control-year="@(controlId + "_year")"
begin-year="@(DateTime.Now.Year)"
end-year="@(DateTime.Now.Year + 1)"
PartialViewName="Partials/DateDropDowns"
class="col-12 input-group"/>
}
break;
case AttributeControlType.FileUpload:
{
<input type="file" id="@(controlId)" name="@(controlId)" class="form-control"/>
}
break;
}
</div>
</div>
}
}