Skip to content

Commit

Permalink
magento#451 disabled sources tab content on manage_stock update
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksLi committed Mar 9, 2018
1 parent ab4fc02 commit 8ebfef0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="sources" sortOrder="5">
<fieldset name="sources" sortOrder="5" component="Magento_InventoryCatalog/js/form/components/fieldset/manage-stock">
<settings>
<label translate="true">Sources</label>
<collapsible>true</collapsible>
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}

});
});

0 comments on commit 8ebfef0

Please sign in to comment.