From 48082ba94289ba9285172acce37022735a929f95 Mon Sep 17 00:00:00 2001 From: AleksLi Date: Tue, 13 Feb 2018 08:09:09 +0200 Subject: [PATCH 1/9] #451 disabled sources tab content on manage_stock update --- .../adminhtml/ui_component/product_form.xml | 2 +- .../form/components/fieldset/manage-stock.js | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml index 477bd1df73279..1f2eba35b372e 100644 --- a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml @@ -6,7 +6,7 @@ */ -->
-
+
true diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js new file mode 100644 index 0000000000000..bd263b9166d73 --- /dev/null +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js @@ -0,0 +1,33 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** + * @api + */ +define([ + 'Magento_Ui/js/form/components/fieldset' +], function (Fieldset) { + 'use strict'; + + return Fieldset.extend({ + defaults: { + additionalClasses: {}, + imports: { + onStockChange: '${ $.provider }:data.product.stock_data.manage_stock' + } + }, + + /** + * Disable all child elements if manage stock is zero + * @param manageStockValue + */ + onStockChange: function(manageStockValue) { + if (manageStockValue === 0) { + this.delegate('disabled', true); + } + } + + }); +}); From 52f2d21f442ae725b5e01a71e0be8d7c5e605018 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 22 Feb 2018 16:57:25 +0200 Subject: [PATCH 2/9] MSI-451: disabled sources tab content on manage_stock update --- .../view/adminhtml/ui_component/product_form.xml | 2 +- .../form/components/source-items.js} | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) rename app/code/Magento/InventoryCatalog/view/adminhtml/web/js/{form/components/fieldset/manage-stock.js => product/form/components/source-items.js} (75%) diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml index 1f2eba35b372e..5f642d90d40db 100644 --- a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml @@ -6,7 +6,7 @@ */ --> -
+
true diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/product/form/components/source-items.js similarity index 75% rename from app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js rename to app/code/Magento/InventoryCatalog/view/adminhtml/web/js/product/form/components/source-items.js index bd263b9166d73..acb4d9227afe9 100644 --- a/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/product/form/components/source-items.js @@ -3,9 +3,6 @@ * See COPYING.txt for license details. */ -/** - * @api - */ define([ 'Magento_Ui/js/form/components/fieldset' ], function (Fieldset) { @@ -13,7 +10,6 @@ define([ return Fieldset.extend({ defaults: { - additionalClasses: {}, imports: { onStockChange: '${ $.provider }:data.product.stock_data.manage_stock' } @@ -21,13 +17,12 @@ define([ /** * Disable all child elements if manage stock is zero - * @param manageStockValue + * @param {Integer} canManageStock */ - onStockChange: function(manageStockValue) { - if (manageStockValue === 0) { + onStockChange: function (canManageStock) { + if (canManageStock === 0) { this.delegate('disabled', true); } } - }); }); From 8ebfef009c345f8c0c87a30e03753b231a7e36e5 Mon Sep 17 00:00:00 2001 From: AleksLi Date: Tue, 13 Feb 2018 08:09:09 +0200 Subject: [PATCH 3/9] #451 disabled sources tab content on manage_stock update --- .../adminhtml/ui_component/product_form.xml | 2 +- .../form/components/fieldset/manage-stock.js | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml index 9ae1199e2cc3a..f8589c291f516 100644 --- a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml @@ -6,7 +6,7 @@ */ --> -
+
true diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js new file mode 100644 index 0000000000000..bd263b9166d73 --- /dev/null +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js @@ -0,0 +1,33 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/** + * @api + */ +define([ + 'Magento_Ui/js/form/components/fieldset' +], function (Fieldset) { + 'use strict'; + + return Fieldset.extend({ + defaults: { + additionalClasses: {}, + imports: { + onStockChange: '${ $.provider }:data.product.stock_data.manage_stock' + } + }, + + /** + * Disable all child elements if manage stock is zero + * @param manageStockValue + */ + onStockChange: function(manageStockValue) { + if (manageStockValue === 0) { + this.delegate('disabled', true); + } + } + + }); +}); From 4d3c5350b8008bc0757ce9ec95404dab78832f85 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 22 Feb 2018 16:57:25 +0200 Subject: [PATCH 4/9] MSI-451: disabled sources tab content on manage_stock update --- .../view/adminhtml/ui_component/product_form.xml | 2 +- .../form/components/source-items.js} | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) rename app/code/Magento/InventoryCatalog/view/adminhtml/web/js/{form/components/fieldset/manage-stock.js => product/form/components/source-items.js} (75%) diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml index f8589c291f516..bfc9230e6c1b0 100644 --- a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml @@ -6,7 +6,7 @@ */ --> -
+
true diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/product/form/components/source-items.js similarity index 75% rename from app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js rename to app/code/Magento/InventoryCatalog/view/adminhtml/web/js/product/form/components/source-items.js index bd263b9166d73..acb4d9227afe9 100644 --- a/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/form/components/fieldset/manage-stock.js +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/web/js/product/form/components/source-items.js @@ -3,9 +3,6 @@ * See COPYING.txt for license details. */ -/** - * @api - */ define([ 'Magento_Ui/js/form/components/fieldset' ], function (Fieldset) { @@ -13,7 +10,6 @@ define([ return Fieldset.extend({ defaults: { - additionalClasses: {}, imports: { onStockChange: '${ $.provider }:data.product.stock_data.manage_stock' } @@ -21,13 +17,12 @@ define([ /** * Disable all child elements if manage stock is zero - * @param manageStockValue + * @param {Integer} canManageStock */ - onStockChange: function(manageStockValue) { - if (manageStockValue === 0) { + onStockChange: function (canManageStock) { + if (canManageStock === 0) { this.delegate('disabled', true); } } - }); }); From a21ae3688ef237c757c8c8cfc028fb64326f5a56 Mon Sep 17 00:00:00 2001 From: AleksLi Date: Sat, 3 Mar 2018 22:18:17 +0200 Subject: [PATCH 5/9] MSI-451 - set disabled attr by imports in xml config --- .../adminhtml/ui_component/product_form.xml | 20 ++++++++++++- .../product/form/components/source-items.js | 28 ------------------- .../adminhtml/ui_component/product_form.xml | 4 +++ 3 files changed, 23 insertions(+), 29 deletions(-) delete mode 100644 app/code/Magento/InventoryCatalog/view/adminhtml/web/js/product/form/components/source-items.js diff --git a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml index bfc9230e6c1b0..8b573dcb04b1f 100644 --- a/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml @@ -6,7 +6,7 @@ */ --> -
+
true @@ -37,6 +37,9 @@ true admin__field-medium + + !${ $.provider }:data.product.stock_data.manage_stock + @@ -99,6 +102,9 @@ text source_code + + !${ $.provider }:data.product.stock_data.manage_stock + @@ -107,6 +113,9 @@ text name + + !${ $.provider }:data.product.stock_data.manage_stock + @@ -122,6 +131,9 @@ text status + + !${ $.provider }:data.product.stock_data.manage_stock +