changes for the password field

This commit is contained in:
2025-05-26 21:45:09 -04:00
parent 01886c2230
commit 27d4fdcdaf

View File

@@ -290,26 +290,30 @@ $subHtml
</div> </div>
<script> <script>
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
const master = document.getElementById('$taskId'); const masterCheckbox = document.getElementById('${($_.Id)}');
const container = document.getElementById('${taskId}OptionsContainer'); const container = document.getElementById('${($_.Id)}OptionsContainer');
const subCheckboxes = container.querySelectorAll('.sub-option-$taskId');
if (master && container) { if (masterCheckbox && container) {
// Toggle visibility + check state const passwordContainer = document.getElementById("PasswordContainer");
const toggleSubs = () => { const dattoContainer = document.getElementById("dattoRmmContainer");
const show = master.checked;
container.style.display = show ? 'block' : 'none';
subCheckboxes.forEach(cb => cb.checked = show);
};
// Bind event function updateDisplay(checked) {
master.addEventListener('change', toggleSubs); container.style.display = checked ? 'block' : 'none';
if (passwordContainer) passwordContainer.style.display = checked ? 'block' : 'none';
if (dattoContainer) dattoContainer.style.display = checked ? 'block' : 'none';
container.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = checked);
}
// Handle page load if pre-checked masterCheckbox.addEventListener('change', function () {
if (master.checked) toggleSubs(); updateDisplay(this.checked);
});
// Initial state on load
updateDisplay(masterCheckbox.checked);
} }
}); });
</script> </script>
"@ "@
} }