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.

Migrate BulkEdit.cshtml to AdminShared (ARCH-001 Phase 2)

KrzysztofPajak8fb8dd600923
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/BulkEdit.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/BulkEdit.cshtml
similarity index 82%
rename from src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/BulkEdit.cshtml
rename to src/Web/Grand.Web.AdminShared/Views/Product/BulkEdit.cshtml
index 12a09140c..30c22771a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/BulkEdit.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/BulkEdit.cshtml
@@ -1,11 +1,12 @@
-@using System.Text.Encodings.Web
+@using System.Text.Encodings.Web
@model BulkEditListModel
@inject AdminAreaSettings adminAreaSettings
@{
//page title
- ViewBag.Title = Loc["Admin.Catalog.BulkEdit"];
+ ViewBag.Title = Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit"];
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
}
-<form asp-area="@Constants.AreaAdmin" asp-controller="Product" asp-action="BulkEdit" method="post">
+<form asp-area="@area" asp-controller="Product" asp-action="BulkEdit" method="post">
<div class="row">
<div class="col-md-12">
@@ -13,9 +14,16 @@
<div class="x_title">
<div class="caption level-caption">
<i class="fa fa-cubes"></i>
- @Loc["Admin.Catalog.BulkEdit"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit"]
</div>
- <vc:admin-widget widget-zone="product_bulk_edit_buttons" additional-data="null"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_bulk_edit_buttons" additional-data="null"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_bulk_edit_buttons" additional-data="null"/>
+ }
</div>
<div class="x_content form">
<div class="form-horizontal">
@@ -32,10 +40,10 @@
<div class="form-actions">
<div class="btn-group">
<button class="btn btn-success filter-submit" id="search-products">
- <i class="fa fa-search"></i> @Loc["Admin.Common.Search"]
+ <i class="fa fa-search"></i> @Loc[$"{Scope.ResourceKeyPrefix}.Common.Search"]
</button>
<button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
- <i class="fa fa-filter"></i>&nbsp; @Loc["Admin.Common.Filters"]
+ <i class="fa fa-filter"></i>&nbsp; @Loc[$"{Scope.ResourceKeyPrefix}.Common.Filters"]
</button>
</div>
</div>
@@ -68,12 +76,15 @@
<admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/>
</div>
</div>
- <div class="form-group">
- <admin-label asp-for="SearchStoreId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchStoreId" asp-items="Model.AvailableStores"/>
+ @if (area == "Admin")
+ {
+ <div class="form-group">
+ <admin-label asp-for="SearchStoreId" class="col-sm-3 control-label"/>
+ <div class="col-md-9 col-sm-9">
+ <admin-select asp-for="SearchStoreId" asp-items="Model.AvailableStores"/>
+ </div>
</div>
- </div>
+ }
</div>
</div>
<div class="x_content">
@@ -107,18 +118,18 @@
dataSource: {
transport: {
read: {
- url: "@Html.Raw(Url.Action("BulkEditSelect", "Product", new { area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("BulkEditSelect", "Product", new { area = area }))",
type: "POST",
dataType: "json",
data: additionalData
},
update: {
- url: "@Html.Raw(Url.Action("BulkEditUpdate", "Product", new { area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("BulkEditUpdate", "Product", new { area = area }))",
type: "POST",
dataType: "json"
},
destroy: {
- url: "@Html.Raw(Url.Action("BulkEditDelete", "Product", new { area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("BulkEditDelete", "Product", new { area = area }))",
type: "POST",
dataType: "json"
},
@@ -198,20 +209,20 @@
scrollable: true,
columns: [ {
field: "Name",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Name"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit.Fields.Name"]",
width: 200
}, {
field: "ProductId",
- title: "@Loc["Admin.Common.View"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.View"]",
width: 80,
- template: '<a href="@Url.Action("Edit", "Product", new { area = Constants.AreaAdmin })/#=Id#">@Loc["Admin.Common.View"]</a>'
+ template: '<a href="@Url.Action("Edit", "Product", new { area = area })/#=Id#">@Loc[$"{Scope.ResourceKeyPrefix}.Common.View"]</a>'
},{
field: "Sku",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Sku"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit.Fields.Sku"]",
width: 100
}, {
field: "Price",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Price"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit.Fields.Price"]",
width: 100,
editor: function (container, options) {
$('<input name="' + options.field + '"/>')
@@ -223,7 +234,7 @@
}
}, {
field: "OldPrice",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.OldPrice"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit.Fields.OldPrice"]",
width: 100,
editor: function (container, options) {
$('<input name="' + options.field + '"/>')
@@ -235,13 +246,13 @@
}
}, {
field: "StockQuantity",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.StockQuantity"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit.Fields.StockQuantity"]",
//integer format
format: "{0:0}",
width: 100
}, {
field: "ManageInventoryMethod",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.ManageInventoryMethod"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit.Fields.ManageInventoryMethod"]",
width: 150,
editor: function (container, options) {
$("<input data-bind='value:ManageInventoryMethod' />")
@@ -260,11 +271,11 @@
}
},{
field: "Published",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Published"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.BulkEdit.Fields.Published"]",
width: 90
}, {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
+ command: { name: "destroy", text: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Delete"]" },
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Delete"]",
width: 100
}
]
@@ -297,10 +308,13 @@
SearchBrandId: $('#SearchBrandId').val(),
SearchCollectionId: $('#SearchCollectionId').val(),
SearchProductTypeId: $('#SearchProductTypeId').val(),
- SearchStoreId: $('#SearchStoreId').val(),
+ @if (area == "Admin")
+ {
+ <text>SearchStoreId: $('#SearchStoreId').val(),</text>
+ }
};
addAntiForgeryToken(data);
return data;
}
</script>
-</form>
\ No newline at end of file
+</form>
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/BulkEdit.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/BulkEdit.cshtml
deleted file mode 100644
index 1a586280c..000000000
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/BulkEdit.cshtml
+++ /dev/null
@@ -1,299 +0,0 @@
-@using System.Text.Encodings.Web
-@model BulkEditListModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- //page title
- ViewBag.Title = Loc["Admin.Catalog.BulkEdit"];
-}
-<form asp-area="@Constants.AreaStore" asp-controller="Product" asp-action="BulkEdit" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit popup-window">
- <div class="x_title">
- <div class="caption level-caption">
- <i class="fa fa-cubes"></i>
- @Loc["Admin.Catalog.BulkEdit"]
- </div>
- <vc:admin-widget widget-zone="product_bulk_edit_buttons" additional-data="null"/>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0">
- <div class="row align-items-end">
- <div class="col-md-8 col-ms-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchProductName" class="control-label"/>
- <admin-input asp-for="SearchProductName"/>
- </div>
- </div>
- <div class="col-md-4 col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group">
- <button class="btn btn-success filter-submit" id="search-products">
- <i class="fa fa-search"></i> @Loc["Admin.Common.Search"]
- </button>
- <button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
- <i class="fa fa-filter"></i>&nbsp; @Loc["Admin.Common.Filters"]
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="collapse" id="filterCollapse">
- <div class="drop-filters-container w-100">
- <div class="form-group">
- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCategoryId" class="col-sm-3 control-label"/>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchBrandId"/>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCollectionId"/>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/>
- </div>
- </div>
- </div>
- </div>
- <div class="x_content">
- <div id="products-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- @{
- var methods = EnumTranslationService.ToSelectList(ManageInventoryMethod.DontManageStock);
- }
- var allInventoryMethod = [
- @foreach (var method in methods)
- {
- <text>
- {
- Id: '@(method.Value)',
- Name: "@Html.Raw(JavaScriptEncoder.Default.Encode(method.Text))"
- },
- </text>
- }
- ];
-
- $(document).ready(function() {
- var _grid = $("#products-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("BulkEditSelect", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- },
- update: {
- url: "@Html.Raw(Url.Action("BulkEditUpdate", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json"
- },
- destroy: {
- url: "@Html.Raw(Url.Action("BulkEditDelete", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json"
- },
- parameterMap: function(data, operation) {
- if (operation != "read") {
-
- var result = {};
-
- for (var i = 0; i < data.models.length; i++) {
- var entity = data.models[i];
-
- for (var member in entity) {
- result["products[" + i + "]." + member] = entity[member];
- if (member == 'Price' || member == 'OldPrice') {
- result["products[" + i + "]." + member] = kendo.toString(entity[member], "n4");
- }
-
- }
- }
-
- addAntiForgeryToken(result);
- return result;
- } else {
- addAntiForgeryToken(data);
- //return JSON.stringify(data);
- return data;
- }
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- Name: { editable: true, type: "string" },
- ProductId: { editable: false, type: "string" },
- Sku: { editable: true, type: "string" },
- Price: { editable: true, type: "number" },
- OldPrice: { editable: true, type: "number" },
- ManageInventoryMethodId: { editable: true, type: "int" },
- ManageInventoryMethod: { editable: true, type: "string" },
- StockQuantity: { editable: true, type: "number" },
- Published: { editable: true, type: "boolean" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "update") {
- this.read();
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- //bulk editing
- batch: true,
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- toolbar: ["save", "cancel"],
- editable: {
- confirmation: true,
- //bulk editing
- mode: "incell"
- },
- scrollable: true,
- columns: [ {
- field: "Name",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Name"]",
- width: 200
- }, {
- field: "ProductId",
- title: "@Loc["Admin.Common.View"]",
- width: 80,
- template: '<a href="@Url.Action("Edit", "Product", new { area = Constants.AreaStore })/#=Id#">@Loc["Admin.Common.View"]</a>'
- },{
- field: "Sku",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Sku"]",
- width: 100
- }, {
- field: "Price",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Price"]",
- width: 100,
- editor: function (container, options) {
- $('<input name="' + options.field + '"/>')
- .appendTo(container)
- .kendoNumericTextBox({
- format: "{0:n4}",
- decimals: 4
- });
- }
- }, {
- field: "OldPrice",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.OldPrice"]",
- width: 100,
- editor: function (container, options) {
- $('<input name="' + options.field + '"/>')
- .appendTo(container)
- .kendoNumericTextBox({
- format: "{0:n4}",
- decimals: 4
- });
- }
- }, {
- field: "StockQuantity",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.StockQuantity"]",
- //integer format
- format: "{0:0}",
- width: 100
- }, {
- field: "ManageInventoryMethod",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.ManageInventoryMethod"]",
- width: 150,
- editor: function (container, options) {
- $("<input data-bind='value:ManageInventoryMethod' />")
- .attr("id", "ddl_ManageInventoryMethod")
- .appendTo(container)
- .kendoDropDownList({
- dataSource: allInventoryMethod,
- dataTextField: "Name",
- dataValueField: "Name",
- template: "<span data-id='${data.id}'>${data.Name}</span>",
- select: function (e) {
- var product = _grid.dataItem($(e.sender.element).closest("tr"));
- product.ManageInventoryMethodId = e.dataItem.Id;
- }
- });
- }
- },{
- field: "Published",
- title: "@Loc["Admin.Catalog.BulkEdit.Fields.Published"]",
- width: 90
- }, {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
- width: 100
- }
- ]
- }).data("kendoGrid");
- });
- </script>
-
- <script>
-
- $(document).ready(function () {
- $('#search-products').click(function () {
- var grid = $('#products-grid').data('kendoGrid');
- 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.SearchProductName)").keydown(function (event) {
- if (event.keyCode == 13) {
- $("#search-products").click();
- return false;
- }
- });
- });
-
- function additionalData() {
- var data = {
- SearchProductName: $('#@Html.IdFor(model => model.SearchProductName)').val(),
- SearchCategoryId: $('#SearchCategoryId').val(),
- SearchBrandId: $('#SearchBrandId').val(),
- SearchCollectionId: $('#SearchCollectionId').val(),
- SearchProductTypeId: $('#SearchProductTypeId').val()
- };
- addAntiForgeryToken(data);
- return data;
- }
- </script>
-</form>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BulkEdit.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BulkEdit.cshtml
deleted file mode 100644
index 307256c14..000000000
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/BulkEdit.cshtml
+++ /dev/null
@@ -1,299 +0,0 @@
-@using System.Text.Encodings.Web
-@model BulkEditListModel
-@inject AdminAreaSettings adminAreaSettings
-@{
- //page title
- ViewBag.Title = Loc["Vendor.Catalog.BulkEdit"];
-}
-<form asp-area="@Constants.AreaVendor" asp-controller="Product" asp-action="BulkEdit" method="post">
-
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit popup-window">
- <div class="x_title">
- <div class="caption level-caption">
- <i class="fa fa-cubes"></i>
- @Loc["Vendor.Catalog.BulkEdit"]
- </div>
- <vc:vendor-widget widget-zone="vendor_product_bulk_edit_buttons" additional-data="null"/>
- </div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="main-header col-12 px-0">
- <div class="row align-items-end">
- <div class="col-md-8 col-ms-12 col-12">
- <div class="form-group mb-0">
- <admin-label asp-for="SearchProductName" class="control-label"/>
- <admin-input asp-for="SearchProductName"/>
- </div>
- </div>
- <div class="col-md-4 col-sm-12 col-12">
- <div class="form-actions">
- <div class="btn-group">
- <button class="btn btn-success filter-submit" id="search-products">
- <i class="fa fa-search"></i> @Loc["Vendor.Common.Search"]
- </button>
- <button class="btn btn-info" type="button" data-toggle="collapse" data-target="#filterCollapse" aria-expanded="false" aria-controls="filterCollapse">
- <i class="fa fa-filter"></i>&nbsp; @Loc["Vendor.Common.Filters"]
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="collapse" id="filterCollapse">
- <div class="drop-filters-container w-100">
- <div class="form-group">
- <admin-label asp-for="SearchCategoryId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCategoryId" class="col-sm-3 control-label"/>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchBrandId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchBrandId"/>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchCollectionId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-input asp-for="SearchCollectionId"/>
- </div>
- </div>
- <div class="form-group">
- <admin-label asp-for="SearchProductTypeId" class="col-sm-3 control-label"/>
- <div class="col-md-9 col-sm-9">
- <admin-select asp-for="SearchProductTypeId" asp-items="Model.AvailableProductTypes"/>
- </div>
- </div>
- </div>
- </div>
- <div class="x_content">
- <div id="products-grid"></div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- @{
- var methods = EnumTranslationService.ToSelectList(ManageInventoryMethod.DontManageStock);
- }
- var allInventoryMethod = [
- @foreach (var method in methods)
- {
- <text>
- {
- Id: '@(method.Value)',
- Name: "@Html.Raw(JavaScriptEncoder.Default.Encode(method.Text))"
- },
- </text>
- }
- ];
-
- $(document).ready(function() {
- var _grid = $("#products-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("BulkEditSelect", "Product", new { area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: additionalData
- },
- update: {
- url: "@Html.Raw(Url.Action("BulkEditUpdate", "Product", new { area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json"
- },
- destroy: {
- url: "@Html.Raw(Url.Action("BulkEditDelete", "Product", new { area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json"
- },
- parameterMap: function(data, operation) {
- if (operation != "read") {
-
- var result = {};
-
- for (var i = 0; i < data.models.length; i++) {
- var entity = data.models[i];
-
- for (var member in entity) {
- result["products[" + i + "]." + member] = entity[member];
- if (member == 'Price' || member == 'OldPrice') {
- result["products[" + i + "]." + member] = kendo.toString(entity[member], "n4");
- }
-
- }
- }
-
- addAntiForgeryToken(result);
- return result;
- } else {
- addAntiForgeryToken(data);
- //return JSON.stringify(data);
- return data;
- }
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- Name: { editable: true, type: "string" },
- ProductId: { editable: false, type: "string" },
- Sku: { editable: true, type: "string" },
- Price: { editable: true, type: "number" },
- OldPrice: { editable: true, type: "number" },
- ManageInventoryMethodId: { editable: true, type: "int" },
- ManageInventoryMethod: { editable: true, type: "string" },
- StockQuantity: { editable: true, type: "number" },
- Published: { editable: true, type: "boolean" },
- Id: { editable: false, type: "string" }
- }
- }
- },
- requestEnd: function (e) {
- if (e.type == "update") {
- this.read();
- }
- },
- error: function(e) {
- display_kendoui_grid_error(e);
- // Cancel the changes
- this.cancelChanges();
- },
- //bulk editing
- batch: true,
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- toolbar: ["save", "cancel"],
- editable: {
- confirmation: true,
- //bulk editing
- mode: "incell"
- },
- scrollable: true,
- columns: [ {
- field: "Name",
- title: "@Loc["Vendor.Catalog.BulkEdit.Fields.Name"]",
- width: 200
- }, {
- field: "ProductId",
- title: "@Loc["Vendor.Common.View"]",
- width: 80,
- template: '<a href="@Url.Action("Edit", "Product", new { area = Constants.AreaVendor })/#=Id#">@Loc["Vendor.Common.View"]</a>'
- },{
- field: "Sku",
- title: "@Loc["Vendor.Catalog.BulkEdit.Fields.Sku"]",
- width: 100
- }, {
- field: "Price",
- title: "@Loc["Vendor.Catalog.BulkEdit.Fields.Price"]",
- width: 100,
- editor: function (container, options) {
- $('<input name="' + options.field + '"/>')
- .appendTo(container)
- .kendoNumericTextBox({
- format: "{0:n4}",
- decimals: 4
- });
- }
- }, {
- field: "OldPrice",
- title: "@Loc["Vendor.Catalog.BulkEdit.Fields.OldPrice"]",
- width: 100,
- editor: function (container, options) {
- $('<input name="' + options.field + '"/>')
- .appendTo(container)
- .kendoNumericTextBox({
- format: "{0:n4}",
- decimals: 4
- });
- }
- }, {
- field: "StockQuantity",
- title: "@Loc["Vendor.Catalog.BulkEdit.Fields.StockQuantity"]",
- //integer format
- format: "{0:0}",
- width: 100
- }, {
- field: "ManageInventoryMethod",
- title: "@Loc["Vendor.Catalog.BulkEdit.Fields.ManageInventoryMethod"]",
- width: 150,
- editor: function (container, options) {
- $("<input data-bind='value:ManageInventoryMethod' />")
- .attr("id", "ddl_ManageInventoryMethod")
- .appendTo(container)
- .kendoDropDownList({
- dataSource: allInventoryMethod,
- dataTextField: "Name",
- dataValueField: "Name",
- template: "<span data-id='${data.id}'>${data.Name}</span>",
- select: function (e) {
- var product = _grid.dataItem($(e.sender.element).closest("tr"));
- product.ManageInventoryMethodId = e.dataItem.Id;
- }
- });
- }
- },{
- field: "Published",
- title: "@Loc["Vendor.Catalog.BulkEdit.Fields.Published"]",
- width: 90
- }, {
- command: { name: "destroy", text: "@Loc["Vendor.Common.Delete"]" },
- title: "@Loc["Vendor.Common.Delete"]",
- width: 100
- }
- ]
- }).data("kendoGrid");
- });
- </script>
-
- <script>
-
- $(document).ready(function () {
- $('#search-products').click(function () {
- var grid = $('#products-grid').data('kendoGrid');
- 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.SearchProductName)").keydown(function (event) {
- if (event.keyCode == 13) {
- $("#search-products").click();
- return false;
- }
- });
- });
-
- function additionalData() {
- var data = {
- SearchProductName: $('#@Html.IdFor(model => model.SearchProductName)').val(),
- SearchCategoryId: $('#SearchCategoryId').val(),
- SearchBrandId: $('#SearchBrandId').val(),
- SearchCollectionId: $('#SearchCollectionId').val(),
- SearchProductTypeId: $('#SearchProductTypeId').val(),
- };
- addAntiForgeryToken(data);
- return data;
- }
- </script>
-</form>
\ No newline at end of file