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 CustomerAttributeModel
<partial name="Partials/WidgetZone.Values.Top" model="Model"/>
@{
var isReadOnly = Model.IsGlobalAttribute;
var area = ViewContext.RouteData.Values["area"]?.ToString();
if (!string.IsNullOrEmpty(Model.Id))
{
@* the grid in a hand-written card so its Add new sits in the header; the hidden refresh
button the value popups click stays beside it *@
<div class="grand-card">
<div class="grand-card__header">
<h2 class="grand-card__title">@Loc["Admin.Customers.CustomerAttributes.Values"]</h2>
@if (!isReadOnly)
{
<a id="btnAddNewValue" href="@(Url.Action("ValueCreatePopup", "CustomerAttribute", new { customerAttributeId = Model.Id, btnId = "btnRefresh", formId = "customerattribute-form", area }))" class="btn btn-outline-secondary btn-sm"><i class="bi bi-plus-lg"></i> @Loc["Admin.Customers.CustomerAttributes.Values.AddNew"]</a>
}
<input type="submit" id="btnRefresh" style="display: none"/>
</div>
<div class="grand-card__body grand-card__body--flush">
<admin-grid id="customerattributevalues-grid"
read-url="@Url.Action("ValueList", "CustomerAttribute", new { customerAttributeId = Model.Id, area })"
destroy-url="@(isReadOnly ? null : Url.Action("ValueDelete", "CustomerAttribute", new { area }))"
pager="Compact"
confirm-destroy="true"
on-data-bound="@(isReadOnly ? null : "bindCustomerAttributeValuePopups")">
<grid-column field="Name" title="@Loc["Admin.Customers.CustomerAttributes.Values.Fields.Name"]">
<cell-template>
@if (!isReadOnly)
{
<a class="text-decoration-none editvalue" href="@Url.Action("ValueEditPopup", "CustomerAttribute", new { area })/{{ Id }}[email protected]&btnId=btnRefresh&formId=customerattribute-form">{{ Name }}</a>
}
else
{
@:{{ Name }}
}
</cell-template>
</grid-column>
<grid-column field="IsPreSelected" title="@Loc["Admin.Customers.CustomerAttributes.Values.Fields.IsPreSelected"]" width="100" align="Center" min-screen-width="500">
<cell-template>
<i data-if="IsPreSelected" class="bi bi-check-lg text-success" aria-hidden="true"></i>
<i data-else class="bi bi-x-lg text-danger" aria-hidden="true"></i>
</cell-template>
</grid-column>
<grid-column field="DisplayOrder" title="@Loc["Admin.Customers.CustomerAttributes.Values.Fields.DisplayOrder"]" width="100" align="Center"/>
@if (!isReadOnly)
{
<grid-commands destroy="true" title="@Loc["Admin.Common.Delete"]" width="100"/>
}
</admin-grid>
</div>
</div>
if (!isReadOnly)
{
<script>
$(document).ready(function () {
$('#btnAddNewValue').magnificPopup({
type: 'ajax',
settings: { cache: false, async: false },
midClick: true,
callbacks: {
parseAjax: function (mfpResponse) {
mfpResponse.data = $('<div></div>').html(mfpResponse.data);
},
ajaxContentAdded: function () {
$('.mfp-wrap').removeAttr('tabindex');
}
}
});
$('#btnRefresh').click(function () {
var grid = GrandAdmin.grids.get("#customerattributevalues-grid");
grid.dataSource.read();
return false;
});
});
function bindCustomerAttributeValuePopups() {
$('.editvalue').magnificPopup({
type: 'ajax',
settings: { cache: false, async: false },
midClick: true,
callbacks: {
parseAjax: function (mfpResponse) {
mfpResponse.data = $('<div></div>').html(mfpResponse.data);
},
ajaxContentAdded: function () {
$('.mfp-wrap').removeAttr('tabindex');
}
}
});
}
</script>
}
}
else
{
<div class="note note-info">
@Loc["Admin.Customers.CustomerAttributes.Values.SaveBeforeEdit"]
</div>
}
}
<partial name="Partials/WidgetZone.Values.Bottom" model="Model"/>