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

KrzysztofPajak2908cfec8548
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
similarity index 74%
rename from src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
rename to src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
index ad33ef35c..d665fb2e9 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
+++ b/src/Web/Grand.Web.AdminShared/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
@@ -1,25 +1,42 @@
@model ProductModel
@inject AdminAreaSettings adminAreaSettings
+@{
+ var area = ViewContext.RouteData.Values["area"]?.ToString();
+}
<div class="note note-info">
<p>
- <strong>@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Description"]</strong>
+ <strong>@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.Description"]</strong>
</p>
<p>
- @Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Description2"]
+ @Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.Description2"]
</p>
</div>
<div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_product_attributes_combinations_top" additional-data="Model"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_top" additional-data="Model"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_details_product_attributes_combinations_top" additional-data="Model"/>
+ }
<div class="panel-body">
<div id="attributecombinations-grid"></div>
</div>
<div class="panel-footer">
- <a id="btnAddNewCombination" href="@(Url.Action("AttributeCombinationPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshCombinations", formId = "product-form", area = Constants.AreaAdmin }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.AddNew"]</a>
- <button type="submit" id="btnGenerateAllCombinations" class="k-button"><span class="k-icon k-i-style-builder"></span>&nbsp;@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.GenerateAll"]</button>
- <button type="submit" id="btnClearAllCombinations" class="k-button"><span class="k-icon k-i-cut"></span>&nbsp;@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.ClearAll"]</button>
+ <a id="btnAddNewCombination" href="@(Url.Action("AttributeCombinationPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshCombinations", formId = "product-form", area = area }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.AddNew"]</a>
+ <button type="submit" id="btnGenerateAllCombinations" class="k-button"><span class="k-icon k-i-style-builder"></span>&nbsp;@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.GenerateAll"]</button>
+ <button type="submit" id="btnClearAllCombinations" class="k-button"><span class="k-icon k-i-cut"></span>&nbsp;@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.ClearAll"]</button>
<input type="submit" id="btnRefreshCombinations" style="display: none"/>
</div>
- <vc:admin-widget widget-zone="product_details_product_attributes_combinations_bottom" additional-data="Model"/>
+ @if (Scope.ResourceKeyPrefix == "Vendor")
+ {
+ <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_bottom" additional-data="Model"/>
+ }
+ else
+ {
+ <vc:admin-widget widget-zone="product_details_product_attributes_combinations_bottom" additional-data="Model"/>
+ }
</div>
<script>
@@ -56,13 +73,13 @@
dataSource: {
transport: {
read: {
- url: "@Html.Raw(Url.Action("ProductAttributeCombinationList", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("ProductAttributeCombinationList", "Product", new { productId = Model.Id, area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
},
destroy: {
- url: "@Html.Raw(Url.Action("ProductAttributeCombinationDelete", "Product", new { area = Constants.AreaAdmin }))",
+ url: "@Html.Raw(Url.Action("ProductAttributeCombinationDelete", "Product", new { area = area }))",
type: "POST",
dataType: "json",
data: addAntiForgeryToken
@@ -113,28 +130,28 @@
columns: [
{
field: "Attributes",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes"]",
encoded: false,
- template: "<a class='k-link editcombinationlink' href=\"@Url.Action("AttributeCombinationPopup", "Product", new { area = Constants.AreaAdmin })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshCombinations&formId=product-form\">#=Attributes#<br /> # if(Warnings !== null) {# <span style=\"color: red\">#=Warnings#</span> #} #</a>"
+ template: "<a class='k-link editcombinationlink' href=\"@Url.Action("AttributeCombinationPopup", "Product", new { area = area })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshCombinations&formId=product-form\">#=Attributes#<br /> # if(Warnings !== null) {# <span style=\"color: red\">#=Warnings#</span> #} #</a>"
}, {
field: "StockQuantity",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity"]",
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
//integer format
format: "{0:0}"
}, {
field: "AllowOutOfStockOrders",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders"]",
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
template: '# if(AllowOutOfStockOrders) {# <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: "Sku",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku"]",
}, {
field: "OverriddenPrice",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice"]",
+ title: "@Loc[$"{Scope.ResourceKeyPrefix}.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice"]",
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
editor: function (container, options) {
@@ -150,7 +167,7 @@
command: [
{
name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
+ text: "@Loc[$"{Scope.ResourceKeyPrefix}.Common.Delete"]"
}
],
width: 50
@@ -175,7 +192,7 @@
//generate combinations
$('#btnGenerateAllCombinations').click(function () {
- if (confirm('@Loc["Admin.Common.AreYouSure"]')) {
+ if (confirm('@Loc[$"{Scope.ResourceKeyPrefix}.Common.AreYouSure"]')) {
var postData = {
};
@@ -184,7 +201,7 @@
$.ajax({
cache: false,
type: 'POST',
- url: '@Url.Action("GenerateAllAttributeCombinations", "Product", new { productId = Model.Id, area = Constants.AreaAdmin })',
+ url: '@Url.Action("GenerateAllAttributeCombinations", "Product", new { productId = Model.Id, area = area })',
data: postData,
dataType: 'json',
success: function(data) {
@@ -202,7 +219,7 @@
//clear combinations
$('#btnClearAllCombinations').click(function () {
- if (confirm('@Loc["Admin.Common.AreYouSure"]')) {
+ if (confirm('@Loc[$"{Scope.ResourceKeyPrefix}.Common.AreYouSure"]')) {
var postData = {
};
@@ -211,7 +228,7 @@
$.ajax({
cache: false,
type: 'POST',
- url: '@Url.Action("ClearAllAttributeCombinations", "Product", new { productId = Model.Id, area = Constants.AreaAdmin })',
+ url: '@Url.Action("ClearAllAttributeCombinations", "Product", new { productId = Model.Id, area = area })',
data: postData,
dataType: 'json',
success: function(data) {
diff --git a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml b/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
deleted file mode 100644
index 078c62814..000000000
--- a/src/Web/Grand.Web.Store/Areas/Store/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
+++ /dev/null
@@ -1,231 +0,0 @@
-@model ProductModel
-@inject AdminAreaSettings adminAreaSettings
-<div class="note note-info">
- <p>
- <strong>@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Description"]</strong>
- </p>
- <p>
- @Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Description2"]
- </p>
-</div>
-<div class="panel panel-default">
- <vc:admin-widget widget-zone="product_details_product_attributes_combinations_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="attributecombinations-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewCombination" href="@(Url.Action("AttributeCombinationPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshCombinations", formId = "product-form", area = Constants.AreaStore }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.AddNew"]</a>
- <button type="submit" id="btnGenerateAllCombinations" class="k-button"><span class="k-icon k-i-style-builder"></span>&nbsp;@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.GenerateAll"]</button>
- <button type="submit" id="btnClearAllCombinations" class="k-button"><span class="k-icon k-i-cut"></span>&nbsp;@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.ClearAll"]</button>
- <input type="submit" id="btnRefreshCombinations" style="display: none"/>
- </div>
- <vc:admin-widget widget-zone="product_details_product_attributes_combinations_bottom" additional-data="Model"/>
-</div>
-
-<script>
- $(document).ready(function () {
- $('#btnAddNewCombination').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');
- }
- }
- });
- $("#attributecombinations-grid").kendoGrid({
- dataBound: function () {
- $('.editcombinationlink').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');
- }
- }
- });
- },
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductAttributeCombinationList", "Product", new { productId = Model.Id, area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ProductAttributeCombinationDelete", "Product", new { area = Constants.AreaStore }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- Attributes: { editable: false, type: "string" },
- Warnings: { editable: false, type: "string" },
- StockQuantity: { editable: true, type: "number" },
- AllowOutOfStockOrders: { editable: true, type: "boolean" },
- Sku: { editable: true, type: "string" },
- Mpn: { editable: true, type: "string" },
- Gtin: { editable: true, type: "string" },
- OverriddenPrice: { editable: true, type: "number" },
- NotifyAdminForQuantityBelow: { editable: true, type: "number" },
- 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();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- },
- autoBind: false,
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "Attributes",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes"]",
- encoded: false,
- template: "<a class='k-link editcombinationlink' href=\"@Url.Action("AttributeCombinationPopup", "Product", new { area = Constants.AreaStore })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshCombinations&formId=product-form\">#=Attributes#<br /> # if(Warnings !== null) {# <span style=\"color: red\">#=Warnings#</span> #} #</a>"
- }, {
- field: "StockQuantity",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- //integer format
- format: "{0:0}"
- }, {
- field: "AllowOutOfStockOrders",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(AllowOutOfStockOrders) {# <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: "Sku",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku"]",
- }, {
- field: "OverriddenPrice",
- title: "@Loc["Admin.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- editor: function (container, options) {
- $('<input name="' + options.field + '"/>')
- .appendTo(container)
- .kendoNumericTextBox({
- format: "{0:n4}",
- decimals: 4
- });
- }
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Admin.Common.Delete"]"
- }
- ],
- width: 50
- }
- ]
- });
- });
-</script>
-
-<script>
- $(document).ready(function () {
- //refresh button
- $('#btnRefreshCombinations').click(function () {
- //refresh grid
- var grid = $("#attributecombinations-grid").data('kendoGrid');
- grid.dataSource.read();
-
- //return false to don't reload a page
- return false;
- });
-
-
- //generate combinations
- $('#btnGenerateAllCombinations').click(function () {
- if (confirm('@Loc["Admin.Common.AreYouSure"]')) {
-
- var postData = {
- };
- addAntiForgeryToken(postData);
-
- $.ajax({
- cache: false,
- type: 'POST',
- url: '@Url.Action("GenerateAllAttributeCombinations", "Product", new { productId = Model.Id, area = Constants.AreaStore })',
- data: postData,
- dataType: 'json',
- success: function(data) {
- //refresh grid
- var grid = $("#attributecombinations-grid").data('kendoGrid');
- grid.dataSource.read();
- },
- error: function(xhr, ajaxOptions, thrownError) {
- alert('Error while generating attribute combinations');
- }
- });
- }
- return false;
- });
-
- //clear combinations
- $('#btnClearAllCombinations').click(function () {
- if (confirm('@Loc["Admin.Common.AreYouSure"]')) {
-
- var postData = {
- };
- addAntiForgeryToken(postData);
-
- $.ajax({
- cache: false,
- type: 'POST',
- url: '@Url.Action("ClearAllAttributeCombinations", "Product", new { productId = Model.Id, area = Constants.AreaStore })',
- data: postData,
- dataType: 'json',
- success: function(data) {
- //refresh grid
- var grid = $("#attributecombinations-grid").data('kendoGrid');
- grid.dataSource.read();
- },
- error: function(xhr, ajaxOptions, thrownError) {
- alert('Error while clearing attribute combinations');
- }
- });
- }
- return false;
- });
-
- });
-</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
deleted file mode 100644
index 0725feba0..000000000
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
+++ /dev/null
@@ -1,231 +0,0 @@
-@model ProductModel
-@inject AdminAreaSettings adminAreaSettings
-<div class="note note-info">
- <p>
- <strong>@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Description"]</strong>
- </p>
- <p>
- @Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Description2"]
- </p>
-</div>
-<div class="panel panel-default">
- <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_top" additional-data="Model"/>
- <div class="panel-body">
- <div id="attributecombinations-grid"></div>
- </div>
- <div class="panel-footer">
- <a id="btnAddNewCombination" href="@(Url.Action("AttributeCombinationPopup", "Product", new { productId = Model.Id, btnId = "btnRefreshCombinations", formId = "product-form", area = Constants.AreaVendor }))" class="k-button"><i class="fa fa-plus"></i>&nbsp;@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.AddNew"]</a>
- <button type="submit" id="btnGenerateAllCombinations" class="k-button"><span class="k-icon k-i-style-builder"></span>&nbsp;@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.GenerateAll"]</button>
- <button type="submit" id="btnClearAllCombinations" class="k-button"><span class="k-icon k-i-cut"></span>&nbsp;@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.ClearAll"]</button>
- <input type="submit" id="btnRefreshCombinations" style="display: none"/>
- </div>
- <vc:vendor-widget widget-zone="vendor_product_details_product_attributes_combinations_bottom" additional-data="Model"/>
-</div>
-
-<script>
- $(document).ready(function () {
- $('#btnAddNewCombination').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');
- }
- }
- });
- $("#attributecombinations-grid").kendoGrid({
- dataBound: function () {
- $('.editcombinationlink').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');
- }
- }
- });
- },
- dataSource: {
- transport: {
- read: {
- url: "@Html.Raw(Url.Action("ProductAttributeCombinationList", "Product", new { productId = Model.Id, area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- destroy: {
- url: "@Html.Raw(Url.Action("ProductAttributeCombinationDelete", "Product", new { area = Constants.AreaVendor }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- }
- },
- schema: {
- data: "Data",
- total: "Total",
- errors: "Errors",
- model: {
- id: "Id",
- fields: {
- Attributes: { editable: false, type: "string" },
- Warnings: { editable: false, type: "string" },
- StockQuantity: { editable: true, type: "number" },
- AllowOutOfStockOrders: { editable: true, type: "boolean" },
- Sku: { editable: true, type: "string" },
- Mpn: { editable: true, type: "string" },
- Gtin: { editable: true, type: "string" },
- OverriddenPrice: { editable: true, type: "number" },
- NotifyAdminForQuantityBelow: { editable: true, type: "number" },
- 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();
- },
- pageSize: @(adminAreaSettings.DefaultGridPageSize),
- },
- autoBind: false,
- pageable: {
- refresh: true,
- pageSizes: [@(adminAreaSettings.GridPageSizes)]
- },
- editable: {
- confirmation: true,
- mode: "inline"
- },
- scrollable: false,
- columns: [
- {
- field: "Attributes",
- title: "@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Attributes"]",
- encoded: false,
- template: "<a class='k-link editcombinationlink' href=\"@Url.Action("AttributeCombinationPopup", "Product", new { area = Constants.AreaVendor })/?productId=@(Model.Id)&Id=#=Id#&btnId=btnRefreshCombinations&formId=product-form\">#=Attributes#</a>"
- }, {
- field: "StockQuantity",
- title: "@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.StockQuantity"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- //integer format
- format: "{0:0}"
- }, {
- field: "AllowOutOfStockOrders",
- title: "@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.AllowOutOfStockOrders"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- template: '# if(AllowOutOfStockOrders) {# <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: "Sku",
- title: "@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.Sku"]",
- }, {
- field: "OverriddenPrice",
- title: "@Loc["Vendor.Catalog.Products.ProductAttributes.AttributeCombinations.Fields.OverriddenPrice"]",
- headerAttributes: { style: "text-align:center" },
- attributes: { style: "text-align:center" },
- editor: function (container, options) {
- $('<input name="' + options.field + '"/>')
- .appendTo(container)
- .kendoNumericTextBox({
- format: "{0:n4}",
- decimals: 4
- });
- }
- },
- {
- command: [
- {
- name: "destroy",
- text: "@Loc["Vendor.Common.Delete"]"
- }
- ],
- width: 50
- }
- ]
- });
- });
-</script>
-
-<script>
- $(document).ready(function () {
- //refresh button
- $('#btnRefreshCombinations').click(function () {
- //refresh grid
- var grid = $("#attributecombinations-grid").data('kendoGrid');
- grid.dataSource.read();
-
- //return false to don't reload a page
- return false;
- });
-
-
- //generate combinations
- $('#btnGenerateAllCombinations').click(function () {
- if (confirm('@Loc["Vendor.Common.AreYouSure"]')) {
-
- var postData = {
- };
- addAntiForgeryToken(postData);
-
- $.ajax({
- cache: false,
- type: 'POST',
- url: '@Url.Action("GenerateAllAttributeCombinations", "Product", new { productId = Model.Id, area = Constants.AreaVendor })',
- data: postData,
- dataType: 'json',
- success: function(data) {
- //refresh grid
- var grid = $("#attributecombinations-grid").data('kendoGrid');
- grid.dataSource.read();
- },
- error: function(xhr, ajaxOptions, thrownError) {
- alert('Error while generating attribute combinations');
- }
- });
- }
- return false;
- });
-
- //clear combinations
- $('#btnClearAllCombinations').click(function () {
- if (confirm('@Loc["Vendor.Common.AreYouSure"]')) {
-
- var postData = {
- };
- addAntiForgeryToken(postData);
-
- $.ajax({
- cache: false,
- type: 'POST',
- url: '@Url.Action("ClearAllAttributeCombinations", "Product", new { productId = Model.Id, area = Constants.AreaVendor })',
- data: postData,
- dataType: 'json',
- success: function(data) {
- //refresh grid
- var grid = $("#attributecombinations-grid").data('kendoGrid');
- grid.dataSource.read();
- },
- error: function(xhr, ajaxOptions, thrownError) {
- alert('Error while clearing attribute combinations');
- }
- });
- }
- return false;
- });
-
- });
-</script>
\ No newline at end of file