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); + } + } + + }); +});