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 NewsLetterSubscriptionListModel
@inject AdminAreaSettings adminAreaSettings
@{
ViewBag.Title = Loc["admin.marketing.newsLetterSubscriptions"];
}
<form asp-area="@Constants.AreaAdmin" asp-controller="NewsletterSubscription" asp-action="List" method="post">
@* The product list's shape: export and import in the overflow menu, the e-mail as the quick
search with the rest of the criteria behind the Filters toggle, and the inline-edit grid in
a flush card. There is no Add new - a subscription comes from the storefront or an import -
so Search is the one primary action. The ids the script below looks up are unchanged. *@
<admin-page title="@Loc["admin.marketing.NewsLetterSubscriptions"]" icon="bi-envelope">
<page-actions>
<admin-action-menu text="@Loc["Admin.Common.Export"]">
<admin-action submit="true" name="exportcsv"
url="@Url.Action("ExportCsv", new { area = Constants.AreaAdmin })"
icon="bi-download" text="@Loc["Admin.Common.ExportToCsv"]"/>
<admin-action id="importcsv" name="importcsv" icon="bi-upload" text="@Loc["Admin.Common.ImportFromCsv"]"/>
</admin-action-menu>
<vc:admin-widget widget-zone="newsletter_subscription_list_buttons" additional-data="null"/>
</page-actions>
<admin-filters id="newsletter-subscription-filters" submit-id="search-subscriptions">
<filters-search>
<admin-input asp-for="SearchEmail"/>
</filters-search>
<admin-field asp-for="ActiveId" asp-items="Model.ActiveList"/>
<admin-field asp-for="StoreId" asp-items="Model.AvailableStores"/>
<admin-field asp-for="SearchCategoryIds">
<admin-input asp-for="SearchCategoryIds" asp-template="MultiSelect" asp-selectitem="Model.AvailableCategories"/>
</admin-field>
</admin-filters>
<admin-card flush>
<admin-grid id="newsletter-subscriptions-grid"
read-url="@Url.Action("SubscriptionList", "NewsLetterSubscription", new { area = Constants.AreaAdmin })"
update-url="@Url.Action("SubscriptionUpdate", "NewsLetterSubscription", new { area = Constants.AreaAdmin })"
destroy-url="@Url.Action("SubscriptionDelete", "NewsLetterSubscription", new { area = Constants.AreaAdmin })"
additional-data="additionalData"
edit-mode="Inline">
<grid-column field="Email" title="@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Email"]" width="300" editor="Text"/>
<grid-column field="Active" title="@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Active"]" width="100" align="Center" editor="Checkbox">
<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>
@if (!adminAreaSettings.HideStoreColumn)
{
<grid-column field="StoreName" title="@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Store"]" width="150"/>
}
<grid-column field="Categories" title="@Loc["admin.marketing.NewsLetterSubscriptions.Fields.Categories"]" width="300"/>
<grid-column field="CreatedOn" title="@Loc["admin.marketing.NewsLetterSubscriptions.Fields.CreatedOn"]" width="150"/>
<grid-commands edit="true" destroy="true" width="200"/>
</admin-grid>
</admin-card>
</admin-page>
<script>
$(document).ready(function() {
$('#search-subscriptions').click(function() {
var grid = GrandAdmin.grids.get('#newsletter-subscriptions-grid');
grid.dataSource.page(1);
return false;
});
$("#@Html.IdFor(model => model.SearchEmail)").keydown(function(event) {
if (event.keyCode == 13) {
$("#search-subscriptions").click();
return false;
}
});
});
function additionalData() {
var categoryIds = [];
if($('#@Html.IdFor(model => model.SearchCategoryIds)').val()!=null){
categoryIds = $('#@Html.IdFor(model => model.SearchCategoryIds)').val();
}
var data = {
SearchCategoryIds: categoryIds,
ActiveId: $('#@Html.IdFor(model => model.ActiveId)').val(),
StoreId: $('#@Html.IdFor(model => model.StoreId)').val(),
SearchEmail: $('#@Html.IdFor(model => model.SearchEmail)').val()
};
addAntiForgeryToken(data);
return data;
}
</script>
</form>
<admin-import-window id="importcsv-window" button-id="importcsv"
title="@Loc["Admin.Common.ImportFromCsv"]"
controller="NewsLetterSubscription" action="ImportCsv"
file-name="importcsvfile" file-label="@Loc["Admin.Common.CsvFile"]"
accept=".csv,.txt"
submit-text="@Loc["Admin.Common.ImportFromCsv"]"/>