<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/**@var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $block */
?>
<?php $_element = $block->getElement() ?>
<?php $_jsObjectName = $block->getFieldSetId() != null ? $block->getFieldSetId() : $_element->getHtmlId() ?>
<div class="rule-tree">
    <fieldset id="<?php /* @escapeNotVerified */ echo $_jsObjectName ?>" <?php /* @escapeNotVerified */ echo $_element->serialize(['class']) ?> class="fieldset">
        <legend class="legend"><span><?php /* @escapeNotVerified */ echo $_element->getLegend() ?></span></legend>
        <br>
    <?php if ($_element->getComment()): ?>
        <div class="messages">
            <div class="message message-notice"><?php echo $block->escapeHtml($_element->getComment()) ?></div>
        </div>
    <?php endif; ?>
    <div class="rule-tree-wrapper">
        <?php echo $_element->getChildrenHtml() ?>
    </div>
    </fieldset>
</div>
<script>
require([
    "Magento_Rule/rules",
    "prototype"
], function(VarienRulesForm){

window.<?php /* @escapeNotVerified */ echo $_jsObjectName ?> = new VarienRulesForm('<?php /* @escapeNotVerified */ echo $_jsObjectName ?>', '<?php /* @escapeNotVerified */ echo $block->getNewChildUrl() ?>');
<?php if ($_element->getReadonly()): ?>
    <?php echo $_element->getHtmlId() ?>.setReadonly(true);
<?php endif; ?>

});
</script>
