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