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

KrzysztofPajak748661884b6d
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
similarity index 79%
rename from src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
rename to src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
index e5d748de0..3a225905e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
@@ -1,20 +1,22 @@
-@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_recommended_top" additional-data="Model"/>
+ <partial name="Partials/WidgetZone.Recommended.Top" model="Model"/>
<div class="panel-heading">
- @Loc["Admin.Catalog.Products.Recommended"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Recommended"]
</div>
<div class="panel-body">
<div id="recommendedproducts-grid"></div>
</div>
<div class="panel-footer">
- <a id="btnAddNewRecommendedProduct" href="@(Url.Action("RecommendedProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshRecommendedProducts", formId = "product-form", area = Constants.AreaAdmin }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Catalog.Products.Recommended.AddNew"]</a>
+ <a id="btnAddNewRecommendedProduct" href="@(Url.Action("RecommendedProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshRecommendedProducts", formId = "product-form", area = area }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Recommended.AddNew"]</a>
<input type="submit" id="btnRefreshRecommendedProducts" style="display: none"/>
</div>
- <vc:admin-widget widget-zone="product_details_recommended_bottom" additional-data="Model"/>
+ <partial name="Partials/WidgetZone.Recommended.Bottom" model="Model"/>
</div>
<script>
@@ -36,13 +38,13 @@
dataSource: {
transport: {
read: {
- url: "@Html.Raw(Url.Action("RecommendedProductList", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("RecommendedProductList", "Product", new { productId = Model.Id, area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
destroy: {
- url: "@Html.Raw(Url.Action("RecommendedProductDelete", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("RecommendedProductDelete", "Product", new { productId = Model.Id, area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
@@ -84,11 +86,11 @@
columns: [
{
field: "Product2Name",
- title: "@Loc["Admin.Catalog.Products.Recommended.Fields.Product"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = Constants.AreaAdmin })/#=Id#">#=kendo.htmlEncode(Product2Name)#</a>',
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Recommended.Fields.Product"]",
+ template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = area })/#=Id#">#=kendo.htmlEncode(Product2Name)#</a>',
}, {
- 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"]",
}
]
});
@@ -111,6 +113,6 @@
else
{
<div class="note note-info">
- @Loc["Admin.Catalog.Products.Recommended.SaveBeforeEdit"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Recommended.SaveBeforeEdit"]
</div>
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.Recommended.Bottom.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.Recommended.Bottom.cshtml
new file mode 100644
index 000000000..b32a3fa65
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.Recommended.Bottom.cshtml
@@ -0,0 +1 @@
+<vc:admin-widget widget-zone="product_details_recommended_bottom" additional-data="Model"/>
diff --git a/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.Recommended.Top.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.Recommended.Top.cshtml
new file mode 100644
index 000000000..1694947c3
--- /dev/null
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/WidgetZone.Recommended.Top.cshtml
@@ -0,0 +1 @@
+<vc:admin-widget widget-zone="product_details_recommended_top" additional-data="Model"/>
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
deleted file mode 100644
index d061a6519..000000000
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
+++ /dev/null
@@ -1,116 +0,0 @@
-@model ProductModel
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_recommended_top" additional-data="Model"/>
- <div class="panel-heading">
- @Loc["Admin.Catalog.Products.Recommended"]
- </div>
- <div class="panel-body">
- <div id="recommendedproducts-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewRecommendedProduct" href="@(Url.Action("RecommendedProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshRecommendedProducts", formId = "product-form", area = Constants.AreaStore }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Catalog.Products.Recommended.AddNew"]</a>
- <input type="submit" id="btnRefreshRecommendedProducts" style="display: none"/>
- </div>
- <vc:admin-widget widget-zone="product_details_recommended_bottom" additional-data="Model"/>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewRecommendedProduct').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');
- }
- }
- });
- $("#recommendedproducts-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("RecommendedProductList", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("RecommendedProductDelete", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- ProductId: { editable: false, type: "string" },
- Product2Name: { editable: false, type: "string" },
- }
- }
- },
- 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: "Product2Name",
- title: "@Loc["Admin.Catalog.Products.Recommended.Fields.Product"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = Constants.AreaStore })/#=Id#">#=kendo.htmlEncode(Product2Name)#</a>',
- }, {
- command: { name: "destroy", text: "@Loc["Admin.Common.Delete"]" },
- title: "@Loc["Admin.Common.Delete"]",
- }
- ]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshRecommendedProducts').click(function () {
- //refresh grid
- var grid = $("#recommendedproducts-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.Recommended.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
deleted file mode 100644
index 1cc94c671..000000000
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
+++ /dev/null
@@ -1,116 +0,0 @@
-@model ProductModel
-
-@if (!string.IsNullOrEmpty(Model.Id))
-{
- <div class="panel panel-default">
- <vc:vendor-widget widget-zone="vendor_product_details_recommended_top" additional-data="Model"/>
- <div class="panel-heading">
- @Loc["Vendor.Catalog.Products.Recommended"]
- </div>
- <div class="panel-body">
- <div id="recommendedproducts-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewRecommendedProduct" href="@(Url.Action("RecommendedProductAddPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshRecommendedProducts", formId = "product-form", area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Vendor.Catalog.Products.Recommended.AddNew"]</a>
- <input type="submit" id="btnRefreshRecommendedProducts" style="display: none"/>
- </div>
- <vc:vendor-widget widget-zone="vendor_product_details_recommended_bottom" additional-data="Model"/>
- </div>
-
- <script>
- $(document).ready(function () {
- $('#btnAddNewRecommendedProduct').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');
- }
- }
- });
- $("#recommendedproducts-grid").kendoGrid({
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("RecommendedProductList", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("RecommendedProductDelete", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- ProductId: { editable: false, type: "string" },
- Product2Name: { editable: false, type: "string" },
- }
- }
- },
- 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: "Product2Name",
- title: "@Loc["Vendor.Catalog.Products.Recommended.Fields.Product"]",
- template: '<a class="k-link" href="@Url.Action("Edit", "Product", new { id = "", area = Constants.AreaVendor })/#=Id#">#=kendo.htmlEncode(Product2Name)#</a>',
- }, {
- command: { name: "destroy", text: "@Loc["Vendor.Common.Delete"]" },
- title: "@Loc["Vendor.Common.Delete"]",
- }
- ]
- });
- });
- </script>
-
- <script>
- $(document).ready(function () {
- $('#btnRefreshRecommendedProducts').click(function () {
- //refresh grid
- var grid = $("#recommendedproducts-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.Recommended.SaveBeforeEdit"]
- </div>
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.Recommended.Bottom.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.Recommended.Bottom.cshtml
new file mode 100644
index 000000000..9239fad11
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.Recommended.Bottom.cshtml
@@ -0,0 +1 @@
+<vc:vendor-widget widget-zone="vendor_product_details_recommended_bottom" additional-data="Model"/>
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.Recommended.Top.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.Recommended.Top.cshtml
new file mode 100644
index 000000000..fc738ef76
--- /dev/null
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/WidgetZone.Recommended.Top.cshtml
@@ -0,0 +1 @@
+<vc:vendor-widget widget-zone="vendor_product_details_recommended_top" additional-data="Model"/>