<?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('webMailEnabled'))->content() ?>
        <?php echo $this->elementPart($this->element->getElement('webMailEnabled'))->label() ?>
        <span><?php echo $this->elementPart($this->element->getElement('webMail'))->content() ?></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('webMailEnabled')->getId() ?>').checked) {
            document.getElementById('<?php echo $this->element->getElement('webMail')->getId() ?>').disabled = false;
        } else {
            document.getElementById('<?php echo $this->element->getElement('webMail')->getId() ?>').disabled = true;
        }
    }

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