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 CreateOrUpdate.BundleProducts.cshtml to AdminShared (ARCH-001 Phase 2)

KrzysztofPajak25d5a8e7bc3e
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
similarity index 72%
rename from src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
rename to src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
index d024ae10d..c2f1f6ef2 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
@@ -1,20 +1,36 @@
-@model ProductModel
-
+@model ProductModel
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_bundle_products_top" additional-data="Model"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_top" additional-data="Model"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_details_bundle_products_top" additional-data="Model"/>
+ }
<div class="panel-body">
<div id="bundleproducts-grid"></div>
</div>
<div class="panel-footer">
- <a id="btnAddNewBundleProduct" href="@(Url.Action("BundleProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshBundleProducts", formId = "product-form", area = Constants.AreaAdmin }))" class="k-button">
- @Loc["Admin.Catalog.Products.BundleProducts.AddNew"]
+ <a id="btnAddNewBundleProduct" href="@(Url.Action("BundleProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshBundleProducts", formId = "product-form", area = area }))" class="k-button">
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.BundleProducts.AddNew"]
</a>
<input type="submit" id="btnRefreshBundleProducts" style="display: none"/>
</div>
- <vc:admin-widget widget-zone="product_details_bundle_products_bottom" additional-data="Model"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_bottom" additional-data="Model"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_details_bundle_products_bottom" additional-data="Model"/>
+ }
</div>
<script>
@@ -36,19 +52,19 @@
dataSource: {
transport: {
read: {
- url: "@Html.Raw(Url.Action("BundleProductList", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("BundleProductList", "Product", new { productId = Model.Id, area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
update: {
- url:"@Html.Raw(Url.Action("BundleProductUpdate", "Product", new { area = Constants.AreaAdmin }))",
+ url:"@Html.Raw(Url.Action("BundleProductUpdate", "Product", new { area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
destroy: {
- url: "@Html.Raw(Url.Action("BundleProductDelete", "Product", new { area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("BundleProductDelete", "Product", new { area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
@@ -96,15 +112,15 @@
scrollable: false,
columns: [{
field: "ProductName",
- title: "@Loc["Admin.Catalog.Products.BundleProducts.Fields.Product"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = Constants.AreaAdmin })/#=ProductId#">#=kendo.htmlEncode(ProductName)#</a>',
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.BundleProducts.Fields.Product"]",
+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = area })/#=ProductId#">#=kendo.htmlEncode(ProductName)#</a>',
},{
field: "Quantity",
- title: "@Loc["Admin.Catalog.Products.BundleProducts.Fields.Quantity"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.BundleProducts.Fields.Quantity"]",
format: "{0:0}",
},{
field: "DisplayOrder",
- title: "@Loc["Admin.Catalog.Products.BundleProducts.Fields.DisplayOrder"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.BundleProducts.Fields.DisplayOrder"]",
format: "{0:0}",
width: 120,
headerAttributes: { style: "text-align:center" },
@@ -115,13 +131,13 @@
command: [{
name: "edit",
text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
+ edit: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Edit"]",
+ update: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Update"]",
+ cancel: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Cancel"]"
}
}, {
name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
+ text: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Delete"]"
}]
}]
});
@@ -144,6 +160,6 @@
else
{
<div class="note note-info">
- @Loc["Admin.Catalog.Products.BundleProducts.SaveBeforeEdit"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.BundleProducts.SaveBeforeEdit"]
</div>
-}
\ No newline at end of file
+}
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
deleted file mode 100644
index 82728fbe1..000000000
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
+++ /dev/null
@@ -1,149 +0,0 @@
-@model ProductModel
-
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_bundle_products_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="bundleproducts-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewBundleProduct" href="@(Url.Action("BundleProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshBundleProducts", formId = "product-form", area = Constants.AreaStore }))" class="k-button">
- @Loc["Admin.Catalog.Products.BundleProducts.AddNew"]
- </a>
- <input type="submit" id="btnRefreshBundleProducts" style="display: none"/>
- </div>
- <vc:admin-widget widget-zone="product_details_bundle_products_bottom" additional-data="Model"/>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewBundleProduct').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#bundleproducts-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("BundleProductList", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url:"@Html.Raw(Url.Action("BundleProductUpdate", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("BundleProductDelete", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- ProductName: { editable: false, type: "string" },
- DisplayOrder: {editable: true, type: "number" },
- Quantity: { editable: true, type: "number" },
- ProductId: { 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();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- autoBind: false,
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "ProductName",
- title: "@Loc["Admin.Catalog.Products.BundleProducts.Fields.Product"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = Constants.AreaStore })/#=ProductId#">#=kendo.htmlEncode(ProductName)#</a>',
- },{
- field: "Quantity",
- title: "@Loc["Admin.Catalog.Products.BundleProducts.Fields.Quantity"]",
- format: "{0:0}",
- },{
- field: "DisplayOrder",
- title: "@Loc["Admin.Catalog.Products.BundleProducts.Fields.DisplayOrder"]",
- format: "{0:0}",
- width: 120,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- minScreenWidth: 750,
-
- }, {
- command: [{
- name: "edit",
- text: {
- edit: "@Loc["Admin.Common.Edit"]",
- update: "@Loc["Admin.Common.Update"]",
- cancel: "@Loc["Admin.Common.Cancel"]"
- }
- }, {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }]
- }]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshBundleProducts').click(function () {
- //refresh grid
- var grid = $("#bundleproducts-grid").data('kendoGrid');
- grid.dataSource.read();
-
- //return false to don't reload a page
- return false;
- });
- });
- </script>
-}
-else
-{
- <div class="note note-info">
- @Loc["Admin.Catalog.Products.BundleProducts.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
deleted file mode 100644
index 63c4c4c22..000000000
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
+++ /dev/null
@@ -1,149 +0,0 @@
-@model ProductModel
-
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="bundleproducts-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewBundleProduct" href="@(Url.Action("BundleProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshBundleProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button">
- @Loc["Vendor.Catalog.Products.BundleProducts.AddNew"]
- </a>
- <input type="submit" id="btnRefreshBundleProducts" style="display: none"/>
- </div>
- <vc:vendor-widget widget-zone="vendor_product_details_bundle_products_bottom" additional-data="Model"/>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewBundleProduct').magnificPopup({
- type: 'ajax',
- settings: { cache: false, async: false },
- midClick: true,
- callbacks: {
- parseAjax: function (mfpResponse) {
- mfpResponse.data = $('<div></div>').html(mfpResponse.data);
- },
- ajaxContentAdded: function () {
- $('.mfp-wrap').removeAttr('tabindex');
- }
- }
- });
- $("#bundleproducts-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("BundleProductList", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url:"@Html.Raw(Url.Action("BundleProductUpdate", "Product", new { area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("BundleProductDelete", "Product", new { area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- ProductName: { editable: false, type: "string" },
- DisplayOrder: {editable: true, type: "number" },
- Quantity: { editable: true, type: "number" },
- ProductId: { 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();
- },
- serverPaging: true,
- serverFiltering: true,
- serverSorting: true
- },
- autoBind: false,
- pageable: {
- refresh: true,
- numeric: false,
- previousNext: false,
- info: false
- },
- editable: {
- confirmation: false,
- mode: "inline"
- },
- scrollable: false,
- columns: [{
- field: "ProductName",
- title: "@Loc["Vendor.Catalog.Products.BundleProducts.Fields.Product"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = Constants.AreaVendor })/#=ProductId#">#=kendo.htmlEncode(ProductName)#</a>',
- },{
- field: "Quantity",
- title: "@Loc["Vendor.Catalog.Products.BundleProducts.Fields.Quantity"]",
- format: "{0:0}",
- },{
- field: "DisplayOrder",
- title: "@Loc["Vendor.Catalog.Products.BundleProducts.Fields.DisplayOrder"]",
- format: "{0:0}",
- width: 120,
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- minScreenWidth: 750,
-
- }, {
- command: [{
- name: "edit",
- text: {
- edit: "@Loc["Vendor.Common.Edit"]",
- update: "@Loc["Vendor.Common.Update"]",
- cancel: "@Loc["Vendor.Common.Cancel"]"
- }
- }, {
- name: "destroy",
- text: "@Loc["Vendor.Common.Delete"]"
- }]
- }]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshBundleProducts').click(function () {
- //refresh grid
- var grid = $("#bundleproducts-grid").data('kendoGrid');
- grid.dataSource.read();
-
- //return false to don't reload a page
- return false;
- });
- });
- </script>
-}
-else
-{
- <div class="note note-info">
- @Loc["Vendor.Catalog.Products.BundleProducts.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file