Skip to content

Commit 48082ba

Browse files
committed
magento#451 disabled sources tab content on manage_stock update
1 parent 19eb5d5 commit 48082ba

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

app/code/Magento/InventoryCatalog/view/adminhtml/ui_component/product_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
9-
<fieldset name="sources" sortOrder="5">
9+
<fieldset name="sources" sortOrder="5" component="Magento_InventoryCatalog/js/form/components/fieldset/manage-stock">
1010
<settings>
1111
<label translate="true">Sources</label>
1212
<collapsible>true</collapsible>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/**
7+
* @api
8+
*/
9+
define([
10+
'Magento_Ui/js/form/components/fieldset'
11+
], function (Fieldset) {
12+
'use strict';
13+
14+
return Fieldset.extend({
15+
defaults: {
16+
additionalClasses: {},
17+
imports: {
18+
onStockChange: '${ $.provider }:data.product.stock_data.manage_stock'
19+
}
20+
},
21+
22+
/**
23+
* Disable all child elements if manage stock is zero
24+
* @param manageStockValue
25+
*/
26+
onStockChange: function(manageStockValue) {
27+
if (manageStockValue === 0) {
28+
this.delegate('disabled', true);
29+
}
30+
}
31+
32+
});
33+
});

0 commit comments

Comments
 (0)