attempt to get the password field to show up

This commit is contained in:
2025-05-26 21:52:15 -04:00
parent 27d4fdcdaf
commit c282f1bb09

View File

@@ -274,7 +274,6 @@ function Build-Checkboxes {
if ($_.SubOptions) {
Write-Host "👉 Rendering SubOptions for task $taskId"
# Build the sub-checkboxes
$subHtml = (
$_.SubOptions | ForEach-Object {
"<label style='margin-left:20px; display:block;'>
@@ -283,37 +282,32 @@ function Build-Checkboxes {
}
) -join "`n"
# Append HTML + inline script
$html += @"
<div id='${taskId}OptionsContainer' style='display:none; margin-top:4px;'>
$subHtml
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const masterCheckbox = document.getElementById('${($_.Id)}');
const container = document.getElementById('${($_.Id)}OptionsContainer');
if (masterCheckbox && container) {
const passwordContainer = document.getElementById("PasswordContainer");
const dattoContainer = document.getElementById("dattoRmmContainer");
(function() {
const masterCheckbox = document.getElementById('${taskId}');
const container = document.getElementById('${taskId}OptionsContainer');
function updateDisplay(checked) {
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);
}
if (masterCheckbox && container) {
const passwordContainer = document.getElementById("PasswordContainer");
const dattoContainer = document.getElementById("dattoRmmContainer");
masterCheckbox.addEventListener('change', function () {
updateDisplay(this.checked);
});
function updateDisplay(checked) {
container.style.display = checked ? 'block' : 'none';
container.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = checked);
// Initial state on load
updateDisplay(masterCheckbox.checked);
if (passwordContainer) passwordContainer.style.display = checked ? 'block' : 'none';
if (dattoContainer) dattoContainer.style.display = checked ? 'block' : 'none';
}
});
</script>
masterCheckbox.addEventListener('change', () => updateDisplay(masterCheckbox.checked));
updateDisplay(masterCheckbox.checked);
}
})();
</script>
"@
}