Skip to content

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.

Admin panel - fix delete selected customer

KrzysztofPajak7f6cc14a9ac6
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml
index a1a56006d..6fd83b9ca 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml
@@ -16,7 +16,7 @@
@Loc["Admin.Customers.Customers"]
</div>
<div class="actions btn-group btn-group-devided">
- <a href="@Url.Action("Create", new { area = Constants.AreaAdmin })" class="btn green"><i class="fa fa-plus"></i><span class="d-none d-sm-inline"> @Loc["Admin.Common.AddNew"] </span></a>
+ <a href="@Url.Action("Create", new { area = Constants.AreaAdmin })" class="btn green"><i class="fa fa-plus"></i><span class="d-none d-sm-inline">@Loc["Admin.Common.AddNew"] </span></a>
<div class="btn-group btn-group-devided">
<a class="btn default" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
@@ -34,7 +34,7 @@
</ul>
<vc:admin-widget widget-zone="customer_list_buttons" additional-data="null" />
</div>
- <button type="button" name="delete-selected" id="delete-selected" class="btn red" onclick=" return confirm('@Loc["Admin.Common.AreYouSure"]'); ">
+ <button type="button" name="delete-selected" id="delete-selected" class="btn red">
<i class="fa fa-trash-o"></i>
@Loc["Admin.Common.Delete.Selected"]
</button>
@@ -343,29 +343,28 @@
//delete selected
$('#delete-selected').click(function(e) {
-
- e.preventDefault();
-
- var postData = {
- selectedIds: selectedIds
- };
- addAntiForgeryToken(postData);
-
- $.ajax({
- cache: false,
- type: "POST",
- url: "@(Url.Action("DeleteSelected", "Customer", new { area = Constants.AreaAdmin }))",
- data: postData,
- complete: function(data) {
- //reload grid
- var grid = $('#customers-grid').data('kendoGrid');
- grid.dataSource.read();
- },
- error: function(xhr, ajaxOptions, thrownError) {
- alert(thrownError);
- },
- traditional: true
- });
+ if (confirm('@Loc["Admin.Common.AreYouSure"]')) {
+ var postData = {
+ selectedIds: selectedIds
+ };
+ addAntiForgeryToken(postData);
+
+ $.ajax({
+ cache: false,
+ type: "POST",
+ url: "@(Url.Action("DeleteSelected", "Customer", new { area = Constants.AreaAdmin }))",
+ data: postData,
+ complete: function (data) {
+ //reload grid
+ var grid = $('#customers-grid').data('kendoGrid');
+ grid.dataSource.read();
+ },
+ error: function (xhr, ajaxOptions, thrownError) {
+ alert(thrownError);
+ },
+ traditional: true
+ });
+ }
return false;
});