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 (masterCheckbox && container) {
const passwordContainer = document.getElementById("PasswordContainer");
const dattoContainer = document.getElementById("dattoRmmContainer");
if (master && container) { function updateDisplay(checked) {
// Toggle visibility + check state container.style.display = checked ? 'block' : 'none';
const toggleSubs = () => { if (passwordContainer) passwordContainer.style.display = checked ? 'block' : 'none';
const show = master.checked; if (dattoContainer) dattoContainer.style.display = checked ? 'block' : 'none';
container.style.display = show ? 'block' : 'none'; container.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = checked);
subCheckboxes.forEach(cb => cb.checked = show); }
};
// Bind event masterCheckbox.addEventListener('change', function () {
master.addEventListener('change', toggleSubs); updateDisplay(this.checked);
});
// Handle page load if pre-checked // Initial state on load
if (master.checked) toggleSubs(); updateDisplay(masterCheckbox.checked);
} }
}); });
</script> </script>
"@ "@
} }