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 QueuedEmailListModel
@{
//page title
ViewBag.Title = Loc["Admin.System.QueuedEmails"];
}
<form asp-area="@Constants.AreaAdmin" asp-controller="QueuedEmail" asp-action="List" method="post">
@* The SeNames list's shape: the sender as the quick search with the rest behind Filters,
Delete selected in the bulk bar that appears while rows are ticked, Delete all in the
overflow menu behind the panel's confirm, and the grid in a flush card. There is no Add new,
so Search is the screen's one primary button. The ids the script below looks up are
unchanged. *@
<admin-page title="@Loc["Admin.System.QueuedEmails"]" icon="bi-envelope">
<page-actions>
<admin-action-menu>
<admin-action submit="true" name="delete-all" destructive="true" icon="bi-trash"
url="@Url.Action("DeleteAll", new { area = Constants.AreaAdmin })"
text="@Loc["Admin.System.QueuedEmails.DeleteAll"]"
data-grand-confirm="@Loc["Admin.Common.AreYouSure"]"
data-confirm-title="@Loc["Admin.System.QueuedEmails.DeleteAll"]"/>
</admin-action-menu>
<vc:admin-widget widget-zone="queued_email_list_buttons" additional-data="null"/>
</page-actions>
<admin-filters id="queuedemails-filters" submit-id="search-queuedemails">
<filters-search>
<admin-input asp-for="SearchFromEmail"/>
</filters-search>
<admin-field asp-for="SearchToEmail"/>
<admin-field asp-for="SearchText"/>
<div class="grand-range">
<admin-field asp-for="SearchStartDate"/>
<admin-field asp-for="SearchEndDate"/>
</div>
<admin-field asp-for="SearchMaxSentTries" size="sm"/>
<admin-field asp-for="SearchLoadNotSent"/>
</admin-filters>
<admin-card flush>
<admin-bulkbar grid-id="queuedEmails-grid">
<button type="button" id="delete-selected" class="btn btn-outline-danger btn-sm">
<i class="bi bi-trash"></i> @Loc["Admin.System.QueuedEmails.DeleteSelected"]
</button>
</admin-bulkbar>
<admin-grid id="queuedEmails-grid"
read-url="@Url.Action("QueuedEmailList", "QueuedEmail", new { area = Constants.AreaAdmin })"
additional-data="additionalData"
selectable="Checkbox"
on-change="onQueuedEmailsSelectionChange">
<grid-column field="Subject" title="@Loc["Admin.System.QueuedEmails.Fields.Subject"]" width="300">
<cell-template>
<a class="text-decoration-none" href="Edit/{{ Id }}">{{ Subject }}</a>
</cell-template>
</grid-column>
<grid-column field="From" title="@Loc["Admin.System.QueuedEmails.Fields.From"]" width="100"/>
<grid-column field="To" title="@Loc["Admin.System.QueuedEmails.Fields.To"]" width="100"/>
<grid-column field="CreatedOn" title="@Loc["Admin.System.QueuedEmails.Fields.CreatedOn"]" width="100" format="{0:G}"/>
<grid-column field="SentOn" title="@Loc["Admin.System.QueuedEmails.Fields.SentOn"]" width="100" format="{0:G}"/>
<grid-column field="PriorityName" title="@Loc["Admin.System.QueuedEmails.Fields.Priority"]" width="50"/>
</admin-grid>
</admin-card>
</admin-page>
<script>
var selectedIds = [];
function onQueuedEmailsSelectionChange(e) {
selectedIds = e.selectedIds;
}
$(document).ready(function () {
//search button
$('#search-queuedemails').click(function () {
//search
var grid = GrandAdmin.grids.get('#queuedEmails-grid');
grid.dataSource.page(1); //new search. Set page size to 1
//grid.dataSource.read(); we already loaded the grid above using "page" function
GrandAdmin.grids.get('#queuedEmails-grid').clearSelection();
return false;
});
$("#@Html.IdFor(model => model.SearchFromEmail)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-queuedemails").click();
return false;
}
});
$("#@Html.IdFor(model => model.SearchToEmail)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-queuedemails").click();
return false;
}
});
$("#@Html.IdFor(model => model.SearchText)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-queuedemails").click();
return false;
}
});
//"delete selected" button
$('#delete-selected').click(function (e) {
e.preventDefault();
var postData = {
selectedIds: selectedIds
};
addAntiForgeryToken(postData);
$.ajax({
cache:false,
type: "POST",
url: "@(Url.Action("DeleteSelected", "QueuedEmail", new { area = Constants.AreaAdmin }))",
data: postData,
complete: function (data) {
//reload grid
var grid = GrandAdmin.grids.get('#queuedEmails-grid');
grid.dataSource.page(1); //new search. Set page size to 1
//grid.dataSource.read(); we already loaded the grid above using "page" function
GrandAdmin.grids.get('#queuedEmails-grid').clearSelection();
},
error:function (xhr, ajaxOptions, thrownError){
alert(thrownError);
},
traditional: true
});
return false;
});
});
function additionalData() {
var data = {
SearchStartDate: $('#@Html.IdFor(model => model.SearchStartDate)').val(),
SearchEndDate: $('#@Html.IdFor(model => model.SearchEndDate)').val(),
SearchFromEmail: $('#@Html.IdFor(model => model.SearchFromEmail)').val(),
SearchToEmail: $('#@Html.IdFor(model => model.SearchToEmail)').val(),
SearchText: $('#@Html.IdFor(model => model.SearchText)').val(),
SearchLoadNotSent: $('#@Html.IdFor(model => model.SearchLoadNotSent)').is(':checked'),
SearchMaxSentTries: $('#@Html.IdFor(model => model.SearchMaxSentTries)').val()
};
addAntiForgeryToken(data);
return data;
}
</script>
</form>