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 LanguageModel
@{
var cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
.OrderBy(x => x.EnglishName)
.Select(x => new SelectListItem
{
Value = x.IetfLanguageTag,
Text = $"{x.EnglishName}. {x.IetfLanguageTag}"
});
}
<vc:admin-widget widget-zone="language_details_info_top" additional-data="Model"/>
@* the language and its culture, then how the storefront shows it; the flag picker keeps its own
select, whose options carry the image the script below previews *@
<admin-card>
<div class="grand-fields grand-fields--2col">
<admin-field asp-for="Name"/>
<admin-field asp-for="LanguageCulture" asp-items="cultures" size="lg"/>
<admin-field asp-for="UniqueSeoCode" size="sm"/>
<admin-field asp-for="FlagImageFileName" size="md">
<div class="d-flex align-items-center gap-2">
<select id="FlagImageFileName" class="form-select" Name="FlagImageFileName">
@foreach (var fileName in Model.FlagFileNames.OrderBy(x => x))
{
<option value="@fileName" img="@Url.Content("~/assets/images/flags/" + fileName)">
@fileName
</option>
}
</select>
<img id="FlagDisplay" class="img-fluid"/>
</div>
</admin-field>
<admin-field asp-for="DefaultCurrencyId" asp-items="Model.AvailableCurrencies" size="md"/>
<admin-field asp-for="DisplayOrder" size="sm"/>
<admin-field asp-for="Rtl"/>
<admin-field asp-for="Published"/>
<admin-field asp-for="Stores"/>
</div>
</admin-card>
<vc:admin-widget widget-zone="language_details_info_bottom" additional-data="Model"/>
<script>
$().ready(function () {
$("#@Html.IdFor(x => x.FlagImageFileName)").change(function (e) {
var img = $(e.target).find(":selected").attr("img");
$("#FlagDisplay").attr("src", img);
}).val('@Model.FlagImageFileName').change();
$("#@Html.IdFor(x => x.LanguageCulture)").change(function (e) {
var val = $(e.target).find(":selected").val();
var parts = val.split("-");
if (parts.length > 1) {
$("#@Html.IdFor(x => x.UniqueSeoCode)").val(parts[1]);
}
});
})
</script>