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
Migrate CreateOrUpdate.Categories.cshtml to AdminShared (ARCH-001 Phase 2)
KrzysztofPajak4c32d0c5ded2
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Categories.cshtmlsimilarity index 66%rename from src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtmlrename to src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Categories.cshtmlindex 00ddb4736..5b2518820 100644--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.Categories.cshtml@@ -1,17 +1,33 @@-@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_categories_top" additional-data="Model"/>+ @if (Scope.ResourceKeyPrefix == "Vendor")+ {+ <vc:vendor-widget widget-zone="vendor_product_details_categories_top" additional-data="Model"/>+ }+ else+ {+ <vc:admin-widget widget-zone="product_details_categories_top" additional-data="Model"/>+ }<div class="panel-heading">- @Loc["Admin.Catalog.Products.Categories.Fields.Category"]+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.Category"]</div><div class="panel-body"><div id="productcategories-grid"></div></div>- <vc:admin-widget widget-zone="product_details_categories_bottom" additional-data="Model"/>+ @if (Scope.ResourceKeyPrefix == "Vendor")+ {+ <vc:vendor-widget widget-zone="vendor_product_details_categories_bottom" additional-data="Model"/>+ }+ else+ {+ <vc:admin-widget widget-zone="product_details_categories_bottom" additional-data="Model"/>+ }</div><script>$(document).ready(function () {@@ -19,25 +35,25 @@dataSource: {transport: {read: {- url: "@Html.Raw(Url.Action("ProductCategoryList", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",+ url: "@Html.Raw(Url.Action("ProductCategoryList", "Product", new { productId = Model.Id, area = area }))",type: "POST",dataType: "json",data: addAntiForgeryToken},create: {- url: "@Html.Raw(Url.Action("ProductCategoryInsert", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",+ url: "@Html.Raw(Url.Action("ProductCategoryInsert", "Product", new { productId = Model.Id, area = area }))",type: "POST",dataType: "json",data: addAntiForgeryToken},update: {- url:"@Html.Raw(Url.Action("ProductCategoryUpdate", "Product", new { area = Constants.AreaAdmin }))",+ url:"@Html.Raw(Url.Action("ProductCategoryUpdate", "Product", new { area = area }))",type: "POST",dataType: "json",data: addAntiForgeryToken},destroy: {- url: "@Html.Raw(Url.Action("ProductCategoryDelete", "Product", new { area = Constants.AreaAdmin }))",+ url: "@Html.Raw(Url.Action("ProductCategoryDelete", "Product", new { area = area }))",type: "POST",dataType: "json",data: addAntiForgeryToken@@ -79,7 +95,7 @@previousNext: false,info: false},- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],+ toolbar: [{ name: "create", text: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.AddNewRecord"]" }],edit: function(e) {if (e.model.isNew()) {e.model.CategoryId = "";@@ -92,22 +108,34 @@scrollable: false,columns: [{field: "CategoryId",- title: "@Loc["Admin.Catalog.Products.Categories.Fields.Category"]",+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.Category"]",width: 200,editor: categoryDropDownEditor,- template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = Constants.AreaAdmin })/#=CategoryId#">#:Category#</a>'+ @if (Scope.ResourceKeyPrefix == "Vendor")+ {+ <text>template: '#:Category#'</text>+ }+ else+ {+ <text>template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = area })/#=CategoryId#">#:Category#</a>'</text>+ }},+ @if (Scope.ResourceKeyPrefix != "Vendor"){- field: "IsFeaturedProduct",- title: "@Loc["Admin.Catalog.Products.Categories.Fields.IsFeaturedProduct"]",- width: 100,- headerAttributes: { style: "text-align:center" },- attributes: { style: "text-align:center" },- template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'- },+ <text>+ {+ field: "IsFeaturedProduct",+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.IsFeaturedProduct"]",+ width: 100,+ headerAttributes: { style: "text-align:center" },+ attributes: { style: "text-align:center" },+ template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'+ },+ </text>+ }{field: "DisplayOrder",- title: "@Loc["Admin.Catalog.Products.Categories.Fields.DisplayOrder"]",+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.Fields.DisplayOrder"]",width: 100,minScreenWidth: 500,headerAttributes: { style: "text-align:center" },@@ -118,13 +146,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"]"}],width: 200}]@@ -148,7 +176,7 @@dataSource: {transport: {read: {- url: "@Html.Raw(Url.Action("Category", "Search", new { area = Constants.AreaAdmin }))"+ url: "@Html.Raw(Url.Action("Category", "Search", new { area = area }))"}},schema: {@@ -165,6 +193,6 @@else{<div class="note note-info">- @Loc["Admin.Catalog.Products.Categories.SaveBeforeEdit"]+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.Categories.SaveBeforeEdit"]</div>-}\ No newline at end of file+}diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Categories.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Categories.cshtmldeleted file mode 100644index 82c8ca020..000000000--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.Categories.cshtml+++ /dev/null@@ -1,170 +0,0 @@-@model ProductModel---@if (!string.IsNullOrEmpty(Model.Id))-{- <div class="panel panel-default">- <vc:admin-widget widget-zone="product_details_categories_top" additional-data="Model"/>- <div class="panel-heading">- @Loc["Admin.Catalog.Products.Categories.Fields.Category"]- </div>- <div class="panel-body">- <div id="productcategories-grid"></div>- </div>- <vc:admin-widget widget-zone="product_details_categories_bottom" additional-data="Model"/>- </div>- <script>- $(document).ready(function () {- $("#productcategories-grid").kendoGrid({- dataSource: {- transport: {- read: {- url: "@Html.Raw(Url.Action("ProductCategoryList", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- create: {- url: "@Html.Raw(Url.Action("ProductCategoryInsert", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- update: {- url:"@Html.Raw(Url.Action("ProductCategoryUpdate", "Product", new { area = Constants.AreaStore }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- destroy: {- url: "@Html.Raw(Url.Action("ProductCategoryDelete", "Product", new { area = Constants.AreaStore }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- }- },- schema: {- data: "Data",- total: "Total",- errors: "Errors",- model: {- id: "Id",- fields: {- Category: { editable: true, type: "string" },- CategoryId: { editable: true, type: "string" },- IsFeaturedProduct: { editable: true, type: "boolean" },- DisplayOrder: { editable: true, type: "number" },- Id: { editable: false, type: "string" }- }- }- },- requestEnd: function (e) {- if (e.type == "create" || 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- },- toolbar: [{ name: "create", text: "@Loc["Admin.Common.AddNewRecord"]" }],- edit: function(e) {- if (e.model.isNew()) {- e.model.CategoryId = "";- }- },- editable: {- confirmation: true,- mode: "inline"- },- scrollable: false,- columns: [{- field: "CategoryId",- title: "@Loc["Admin.Catalog.Products.Categories.Fields.Category"]",- width: 200,- editor: categoryDropDownEditor,- template: '<a class="k-link" href="@Url.Action("Edit", "Category", new { area = Constants.AreaStore })/#=CategoryId#">#:Category#</a>'- },- {- field: "IsFeaturedProduct",- title: "@Loc["Admin.Catalog.Products.Categories.Fields.IsFeaturedProduct"]",- width: 100,- headerAttributes: { style: "text-align:center" },- attributes: { style: "text-align:center" },- template: '# if(IsFeaturedProduct) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'- },- {- field: "DisplayOrder",- title: "@Loc["Admin.Catalog.Products.Categories.Fields.DisplayOrder"]",- width: 100,- minScreenWidth: 500,- headerAttributes: { style: "text-align:center" },- attributes: { style: "text-align:center" },- //integer format- format: "{0:0}"- }, {- 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"]"- }],- width: 200- }]- });- });-- function categoryDropDownEditor(container, options) {- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CategoryId"/>')- .appendTo(container)- .kendoDropDownList({- autobind: false,- optionLabel: "Select category...",- filter: "startswith",- filtering: function (e) {- var filter = e.filter;- if (!filter.value) {- //prevent filtering if the filter does not value- e.preventDefault();- }- },- dataSource: {- transport: {- read: {- url: "@Html.Raw(Url.Action("Category", "Search", new { area = Constants.AreaStore }))"- }- },- schema: {- data: "Data"- },- serverFiltering: true- },- dataTextField: "Name",- dataValueField: "Id",- });- }- </script>-}-else-{- <div class="note note-info">- @Loc["Admin.Catalog.Products.Categories.SaveBeforeEdit"]- </div>-}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Categories.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Categories.cshtmldeleted file mode 100644index caa71acdd..000000000--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.Categories.cshtml+++ /dev/null@@ -1,164 +0,0 @@-@model ProductModel---@if (!string.IsNullOrEmpty(Model.Id))-{- <div class="panel panel-default">- <vc:vendor-widget widget-zone="vendor_product_details_categories_top" additional-data="Model"/>- <div class="panel-heading">- @Loc["Vendor.Catalog.Products.Categories.Fields.Category"]- </div>- <div class="panel-body">- <div id="productcategories-grid"></div>- </div>- <vc:vendor-widget widget-zone="vendor_product_details_categories_bottom" additional-data="Model"/>- </div>- <script>- $(document).ready(function () {- $("#productcategories-grid").kendoGrid({- dataSource: {- transport: {- read: {- url: "@Html.Raw(Url.Action("ProductCategoryList", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- create: {- url: "@Html.Raw(Url.Action("ProductCategoryInsert", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- update: {- url:"@Html.Raw(Url.Action("ProductCategoryUpdate", "Product", new { area = Constants.AreaVendor }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- destroy: {- url: "@Html.Raw(Url.Action("ProductCategoryDelete", "Product", new { area = Constants.AreaVendor }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- }- },- schema: {- data: "Data",- total: "Total",- errors: "Errors",- model: {- id: "Id",- fields: {- Category: { editable: true, type: "string" },- CategoryId: { editable: true, type: "string" },- IsFeaturedProduct: { editable: true, type: "boolean" },- DisplayOrder: { editable: true, type: "number" },- Id: { editable: false, type: "string" }- }- }- },- requestEnd: function (e) {- if (e.type == "create" || 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- },- toolbar: [{ name: "create", text: "@Loc["Vendor.Common.AddNewRecord"]" }],- edit: function(e) {- if (e.model.isNew()) {- e.model.CategoryId = "";- }- },- editable: {- confirmation: true,- mode: "inline"- },- scrollable: false,- columns: [{- field: "CategoryId",- title: "@Loc["Vendor.Catalog.Products.Categories.Fields.Category"]",- width: 200,- editor: categoryDropDownEditor,- template: '#:Category#'- },- {- field: "DisplayOrder",- title: "@Loc["Vendor.Catalog.Products.Categories.Fields.DisplayOrder"]",- width: 100,- minScreenWidth: 500,- headerAttributes: { style: "text-align:center" },- attributes: { style: "text-align:center" },- //integer format- format: "{0:0}"- },- {- 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"]"- }],- width: 200- }- ]- });- });-- function categoryDropDownEditor(container, options) {- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CategoryId"/>')- .appendTo(container)- .kendoDropDownList({- autobind: false,- optionLabel: "Select category...",- filter: "startswith",- filtering: function (e) {- var filter = e.filter;- if (!filter.value) {- //prevent filtering if the filter does not value- e.preventDefault();- }- },- dataSource: {- transport: {- read: {- url: "@Html.Raw(Url.Action("Category", "Search", new { area = Constants.AreaVendor }))"- }- },- schema: {- data: "Data"- },- serverFiltering: true- },- dataTextField: "Name",- dataValueField: "Id",- });- }- </script>-}-else-{- <div class="note note-info">- @Loc["Vendor.Catalog.Products.Categories.SaveBeforeEdit"]- </div>-}\ No newline at end of file