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.ProductPrices.cshtml to AdminShared (ARCH-001 Phase 2)
KrzysztofPajak2c18fec94898
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtmldeleted file mode 100644index 0efbe81e5..000000000--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml+++ /dev/null@@ -1,147 +0,0 @@-@using Grand.Business.Core.Interfaces.Common.Directory-@model ProductModel-@inject ICurrencyService currencyService-@{- var currencies = await currencyService.GetAllCurrencies();- var defaultCurrency = await currencyService.GetPrimaryStoreCurrency();- currencies = currencies.Where(x => x.Id != defaultCurrency.Id).ToList();-}-@if (!string.IsNullOrEmpty(Model.Id) && currencies.Count > 0)-{- if (currencies.Count > 0)- {- <div class="panel panel-default">- <div class="panel-body">- <div id="productprices-grid"></div>- </div>- </div>- <script>- $(document).ready(function () {- $("#productprices-grid").kendoGrid({- dataSource: {- transport: {- read: {- url: "@Html.Raw(Url.Action("ProductPriceList", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- create: {- url: "@Html.Raw(Url.Action("ProductPriceInsert", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- update: {- url:"@Html.Raw(Url.Action("ProductPriceUpdate", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- destroy: {- url: "@Html.Raw(Url.Action("ProductPriceDelete", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- }- },- schema: {- data: "Data",- total: "Total",- errors: "Errors",- model: {- id: "Id",- fields: {- CurrencyCode: { editable: true, type: "string" },- Price: { 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"]" }],- editable: {- confirmation: true,- mode: "inline"- },- scrollable: false,- columns: [{- field: "CurrencyCode",- title: "@Loc["Admin.Catalog.Products.ProductPrices.Fields.CurrencyCode"]",- width: 200,- editor: currencyDropDownEditor,- template: '#:CurrencyCode#'- },- {- field: "Price",- title: "@Loc["Admin.Catalog.Products.ProductPrices.Fields.Price"]",- width: 100,- headerAttributes: { style: "text-align:center" },- attributes: { style: "text-align:center" },- format: "{0:n2}"- }, {- 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- }]- });- });-- //local datasource- var allCurrencies = [- @for (var i = 0; i < currencies.Count; i++)- {- var currencyItem = currencies[i];- <text>- {- Id: '@(currencyItem.CurrencyCode)',- Name: "@(currencyItem.CurrencyCode)"- }- </text>- if (i != currencies.Count - 1)- {- <text>,</text>- }- }- ];-- function currencyDropDownEditor(container, options) {- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CurrencyCode"/>')- .appendTo(container)- .kendoDropDownList({- autoBind: true,- dataSource: allCurrencies- });- }- </script>- }-}\ No newline at end of filediff --git a/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtmlnew file mode 100644index 000000000..fd6f81b0e--- /dev/null+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml@@ -0,0 +1,145 @@+@using Grand.Business.Core.Interfaces.Common.Directory+@model ProductModel+@inject ICurrencyService currencyService+@{+ var currencies = await currencyService.GetAllCurrencies();+ var defaultCurrency = await currencyService.GetPrimaryStoreCurrency();+ currencies = currencies.Where(x => x.Id != defaultCurrency.Id).ToList();+ var area = ViewContext.RouteData.Values["area"]?.ToString();+}+@if (!string.IsNullOrEmpty(Model.Id) && currencies.Count > 0)+{+ <div class="panel panel-default">+ <div class="panel-body">+ <div id="productprices-grid"></div>+ </div>+ </div>+ <script>+ $(document).ready(function () {+ $("#productprices-grid").kendoGrid({+ dataSource: {+ transport: {+ read: {+ url: "@Html.Raw(Url.Action("ProductPriceList", "Product", new { productId = Model.Id, area = area }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ },+ create: {+ url: "@Html.Raw(Url.Action("ProductPriceInsert", "Product", new { productId = Model.Id, area = area }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ },+ update: {+ url:"@Html.Raw(Url.Action("ProductPriceUpdate", "Product", new { productId = Model.Id, area = area }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ },+ destroy: {+ url: "@Html.Raw(Url.Action("ProductPriceDelete", "Product", new { productId = Model.Id, area = area }))",+ type: "POST",+ dataType: "json",+ data: addAntiForgeryToken+ }+ },+ schema: {+ data: "Data",+ total: "Total",+ errors: "Errors",+ model: {+ id: "Id",+ fields: {+ CurrencyCode: { editable: true, type: "string" },+ Price: { 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[$"{Scope.ResourceKeyPrefix}.Common.AddNewRecord"]" }],+ editable: {+ confirmation: true,+ mode: "inline"+ },+ scrollable: false,+ columns: [{+ field: "CurrencyCode",+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductPrices.Fields.CurrencyCode"]",+ width: 200,+ editor: currencyDropDownEditor,+ template: '#:CurrencyCode#'+ },+ {+ field: "Price",+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductPrices.Fields.Price"]",+ width: 100,+ headerAttributes: { style: "text-align:center" },+ attributes: { style: "text-align:center" },+ format: "{0:n2}"+ }, {+ command: [{+ name: "edit",+ text: {+ edit: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Edit"]",+ update: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Update"]",+ cancel: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Cancel"]"+ }+ }, {+ name: "destroy",+ text: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Delete"]"+ }],+ width: 200+ }]+ });+ });++ //local datasource+ var allCurrencies = [+ @for (var i = 0; i < currencies.Count; i++)+ {+ var currencyItem = currencies[i];+ <text>+ {+ Id: '@(currencyItem.CurrencyCode)',+ Name: "@(currencyItem.CurrencyCode)"+ }+ </text>+ if (i != currencies.Count - 1)+ {+ <text>,</text>+ }+ }+ ];++ function currencyDropDownEditor(container, options) {+ $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CurrencyCode"/>')+ .appendTo(container)+ .kendoDropDownList({+ autoBind: true,+ dataSource: allCurrencies+ });+ }+ </script>+}\ No newline at end of filediff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtmldeleted file mode 100644index 3a2355db7..000000000--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml+++ /dev/null@@ -1,147 +0,0 @@-@using Grand.Business.Core.Interfaces.Common.Directory-@model ProductModel-@inject ICurrencyService currencyService-@{- var currencies = await currencyService.GetAllCurrencies();- var defaultCurrency = await currencyService.GetPrimaryStoreCurrency();- currencies = currencies.Where(x => x.Id != defaultCurrency.Id).ToList();-}-@if (!string.IsNullOrEmpty(Model.Id) && currencies.Count > 0)-{- if (currencies.Count > 0)- {- <div class="panel panel-default">- <div class="panel-body">- <div id="productprices-grid"></div>- </div>- </div>- <script>- $(document).ready(function () {- $("#productprices-grid").kendoGrid({- dataSource: {- transport: {- read: {- url: "@Html.Raw(Url.Action("ProductPriceList", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- create: {- url: "@Html.Raw(Url.Action("ProductPriceInsert", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- update: {- url:"@Html.Raw(Url.Action("ProductPriceUpdate", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- destroy: {- url: "@Html.Raw(Url.Action("ProductPriceDelete", "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: {- CurrencyCode: { editable: true, type: "string" },- Price: { 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"]" }],- editable: {- confirmation: true,- mode: "inline"- },- scrollable: false,- columns: [{- field: "CurrencyCode",- title: "@Loc["Admin.Catalog.Products.ProductPrices.Fields.CurrencyCode"]",- width: 200,- editor: currencyDropDownEditor,- template: '#:CurrencyCode#'- },- {- field: "Price",- title: "@Loc["Admin.Catalog.Products.ProductPrices.Fields.Price"]",- width: 100,- headerAttributes: { style: "text-align:center" },- attributes: { style: "text-align:center" },- format: "{0:n2}"- }, {- 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- }]- });- });-- //local datasource- var allCurrencies = [- @for (var i = 0; i < currencies.Count; i++)- {- var currencyItem = currencies[i];- <text>- {- Id: '@(currencyItem.CurrencyCode)',- Name: "@(currencyItem.CurrencyCode)"- }- </text>- if (i != currencies.Count - 1)- {- <text>,</text>- }- }- ];-- function currencyDropDownEditor(container, options) {- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CurrencyCode"/>')- .appendTo(container)- .kendoDropDownList({- autoBind: true,- dataSource: allCurrencies- });- }- </script>- }-}\ No newline at end of filediff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtmldeleted file mode 100644index b22e91491..000000000--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml+++ /dev/null@@ -1,144 +0,0 @@-@using Grand.Business.Core.Interfaces.Common.Directory-@model ProductModel-@inject ICurrencyService currencyService-@{- var currencies = await currencyService.GetAllCurrencies();- var defaultCurrency = await currencyService.GetPrimaryStoreCurrency();- currencies = currencies.Where(x => x.Id != defaultCurrency.Id).ToList();-}-@if (!string.IsNullOrEmpty(Model.Id) && currencies.Any())-{- <div class="panel panel-default">- <div class="panel-body">- <div id="productprices-grid"></div>- </div>- </div>- <script>- $(document).ready(function () {- $("#productprices-grid").kendoGrid({- dataSource: {- transport: {- read: {- url: "@Html.Raw(Url.Action("ProductPriceList", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- create: {- url: "@Html.Raw(Url.Action("ProductPriceInsert", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- update: {- url:"@Html.Raw(Url.Action("ProductPriceUpdate", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",- type: "POST",- dataType: "json",- data: addAntiForgeryToken- },- destroy: {- url: "@Html.Raw(Url.Action("ProductPriceDelete", "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: {- CurrencyCode: { editable: true, type: "string" },- Price: { 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"]" }],- editable: {- confirmation: true,- mode: "inline"- },- scrollable: false,- columns: [{- field: "CurrencyCode",- title: "@Loc["Vendor.Catalog.Products.ProductPrices.Fields.CurrencyCode"]",- width: 200,- editor: currencyDropDownEditor,- template: '#:CurrencyCode#'- },- {- field: "Price",- title: "@Loc["Vendor.Catalog.Products.ProductPrices.Fields.Price"]",- width: 100,- headerAttributes: { style: "text-align:center" },- attributes: { style: "text-align:center" },- format: "{0:n2}"- }, {- 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- }]- });- });-- //local datasource- var allCurrencies = [- @for (var i = 0; i < currencies.Count; i++)- {- var currencyItem = currencies[i];-- <text>{- Id: '@currencyItem.CurrencyCode',- Name: "@currencyItem.CurrencyCode"- }</text>-- if (i != currencies.Count - 1)- {- @:,- }- }- ];-- function currencyDropDownEditor(container, options) {- $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:CurrencyCode"/>')- .appendTo(container)- .kendoDropDownList({- autoBind: true,- dataSource: allCurrencies- });- }- </script>-}\ No newline at end of file