<?php
// Copyright 1999-2021. Plesk International GmbH. All rights reserved.
?>
<div class='form-row'>
    <div class='single-row'>
        <?php echo $this->elementPart($this->element->getElement('retainEnabled'))->content() ?>
        <?php echo $this->elementPart($this->element->getElement('retainEnabled'))->label() ?>
        <span>
        <?php echo $this->elementPart($this->element->getElement('retain'))->content() ?>
        <?php echo $this->elementPart($this->element->getElement('retain'))->label() ?>
        </span>
        <span class="field-errors" style="display: none;"></span>
    </div>
</div>

<script type="text/javascript">
//<![CDATA[
(function () {
    var updateControlsState = function () {
        if (document.getElementById('<?php echo $this->element->getElement('retainEnabled')->getId() ?>').checked) {
            document.getElementById('<?php echo $this->element->getElement('retain')->getId() ?>').disabled = false;
        } else {
            document.getElementById('<?php echo $this->element->getElement('retain')->getId() ?>').disabled = true;
        }
    };

    document.getElementById('<?php echo $this->element->getElement('retainEnabled')->getId() ?>').addEventListener('click', updateControlsState);
    updateControlsState();
})();
//]]>
</script>
