-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source Entity expansion with Pickup Location attributes #2182.
Show/Hide the pickup location fieldset depending from `is_pickup_location_active` value
- Loading branch information
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...e/Magento/InventoryInStorePickupAdminUi/view/adminhtml/web/js/form/components/fieldset.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
define([ | ||
'Magento_Ui/js/form/components/fieldset', | ||
'ko' | ||
], function (Fieldset, ko) { | ||
'use strict'; | ||
|
||
return Fieldset.extend(ko).extend( | ||
{ | ||
/** | ||
* Convert visible value from string ('1', '0') to bool (true, false) | ||
*/ | ||
initialize: function () { | ||
this._super(); | ||
|
||
let visible = ko.observable(this.visible()); | ||
|
||
this.visible = ko.computed({ | ||
read: function () { | ||
return visible(); | ||
}, | ||
write: function (value) { | ||
visible(Boolean(parseInt(value))); | ||
}, | ||
owner: this | ||
}); | ||
this.visible(visible()); | ||
} | ||
} | ||
); | ||
}); |