<?php
// Copyright 1999-2022. Plesk International GmbH. All rights reserved.
?>
<table cellspacing="0" width="100%" class="form-table form-limits">
    <tbody>
        <tr class="form-row">
            <td class="field-name">
                <?php echo $this->elementPart($this->element->getElement('quota'))->label(); ?>
            </td>
            <td class="field-value nowrap">
                <?php echo $this->elementPart($this->element->getElement('quota'))->content(); ?>
                <?php echo isset($this->units) ? $this->units : $this->lmsg('smb.components.forms.web.edit.limitMbUnits'); ?>
                <span class="field-errors" style="display: none;"></span>
            </td>
            <td class="nowrap">
                <?php echo $this->elementPart($this->element->getElement('noLimit'))->content(); ?>
                <?php echo $this->elementPart($this->element->getElement('noLimit'))->label(); ?>
            </td>
        </tr>
    </tbody>
</table>

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

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