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 AffiliateListModel
@{
//page title
ViewBag.Title = Loc["Admin.Affiliates"];
}
@* the list screen's shape: Add new as the one primary action, the name search always visible
with the rest behind Filters, the grid in a flush card. The order dates are revealed by
LoadOnlyWithOrders and keep the pnl* ids its script toggles. *@
<admin-page title="@Loc["Admin.Affiliates"]" icon="bi-box">
<page-actions>
<vc:admin-widget widget-zone="affiliate_list_buttons" additional-data="null"/>
<a href="@Url.Action("Create", new { area = Constants.AreaAdmin })" class="btn btn-primary">
<i class="bi bi-plus-lg"></i> @Loc["Admin.Common.AddNew"]
</a>
</page-actions>
<admin-filters id="affiliate-filters" submit-id="search-affiliates" secondary-submit="true">
<filters-search>
<admin-input asp-for="SearchFirstName"/>
</filters-search>
<admin-field asp-for="SearchLastName"/>
<admin-field asp-for="SearchFriendlyUrlName"/>
<div class="grand-reveal">
<admin-field asp-for="LoadOnlyWithOrders"/>
<div class="grand-reveal__body grand-fields grand-fields--2col">
<admin-field asp-for="OrdersCreatedFromUtc" id="pnlOrdersCreatedFromUtc"/>
<admin-field asp-for="OrdersCreatedToUtc" id="pnlOrdersCreatedToUtc"/>
</div>
</div>
</admin-filters>
<admin-card flush>
<admin-grid id="affiliates-grid"
read-url="@Url.Action("List", "Affiliate", new { area = Constants.AreaAdmin })"
additional-data="additionalData">
<grid-column field="Address.Email" title="@Loc["Admin.Address.Fields.Email"]" width="200">
<cell-template>
<a class="text-decoration-none" href="Edit/{{ Id }}">{{ Address.Email }}</a>
</cell-template>
</grid-column>
<grid-column field="Address.FirstName" title="@Loc["Admin.Address.Fields.FirstName"]" width="200"/>
<grid-column field="Address.LastName" title="@Loc["Admin.Address.Fields.LastName"]" width="200"/>
<grid-column field="Active" title="@Loc["Admin.Affiliates.Fields.Active"]" width="100" align="Center">
<cell-template>
<i data-if="Active" 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>
</admin-grid>
</admin-card>
</admin-page>
<script>
$(document).ready(function () {
$("#@Html.IdFor(model => model.LoadOnlyWithOrders)").click(toggleLoadOnlyWithOrders);
toggleLoadOnlyWithOrders();
});
function toggleLoadOnlyWithOrders() {
if ($('#@Html.IdFor(model => model.LoadOnlyWithOrders)').is(':checked')) {
$('#pnlOrdersCreatedFromUtc').show();
$('#pnlOrdersCreatedToUtc').show();
} else {
$('#pnlOrdersCreatedFromUtc').hide();
$('#pnlOrdersCreatedToUtc').hide();
}
}
</script>
<script>
$(document).ready(function () {
$('#search-affiliates').click(function () {
var grid = GrandAdmin.grids.get('#affiliates-grid');
grid.dataSource.page(1); //new search. Set page size to 1
//grid.dataSource.read(); we already loaded the grid above using "page" function
return false;
});
});
$("#@Html.IdFor(model => model.SearchFirstName)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-affiliates").click();
return false;
}
});
$("#@Html.IdFor(model => model.SearchLastName)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-affiliates").click();
return false;
}
});
$("#@Html.IdFor(model => model.SearchFriendlyUrlName)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-affiliates").click();
return false;
}
});
function additionalData() {
var data = {
SearchFirstName: $('#@Html.IdFor(model => model.SearchFirstName)').val(),
SearchLastName: $('#@Html.IdFor(model => model.SearchLastName)').val(),
SearchFriendlyUrlName: $('#@Html.IdFor(model => model.SearchFriendlyUrlName)').val(),
LoadOnlyWithOrders: $('#@Html.IdFor(model => model.LoadOnlyWithOrders)').is(':checked'),
OrdersCreatedFromUtc: $('#@Html.IdFor(model => model.OrdersCreatedFromUtc)').val(),
OrdersCreatedToUtc: $('#@Html.IdFor(model => model.OrdersCreatedToUtc)').val()
};
addAntiForgeryToken(data);
return data;
}
</script>