change some code in the Build-Checkboxes function
This commit is contained in:
@@ -268,12 +268,9 @@ function Build-Checkboxes {
|
||||
Where-Object Page -EQ $Page |
|
||||
Where-Object Column -EQ $Column |
|
||||
ForEach-Object {
|
||||
# 1) render the main checkbox
|
||||
$html = "<label><input type='checkbox' id='$($_.Id)' name='$($_.Name)' data-column='$Column'> $($_.Label)</label>"
|
||||
|
||||
# 2) if this task has SubOptions, render them in a hidden container
|
||||
if ($_.SubOptions) {
|
||||
|
||||
Write-Host "👉 Rendering SubOptions for task $($_.Id)"
|
||||
|
||||
$subHtml = (
|
||||
@@ -293,18 +290,19 @@ function Build-Checkboxes {
|
||||
const masterCheckbox = document.getElementById('${($_.Id)}');
|
||||
const container = document.getElementById('${($_.Id)}OptionsContainer');
|
||||
if (masterCheckbox && container) {
|
||||
const subCheckboxes = container.querySelectorAll('input[type="checkbox"]');
|
||||
masterCheckbox.addEventListener('change', function () {
|
||||
container.style.display = this.checked ? 'block' : 'none';
|
||||
subCheckboxes.forEach(cb => cb.checked = this.checked);
|
||||
});
|
||||
// Auto-show if already checked (e.g. page reload with checkbox checked)
|
||||
if (masterCheckbox.checked) {
|
||||
container.style.display = 'block';
|
||||
subCheckboxes.forEach(cb => cb.checked = true);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
"@
|
||||
|
||||
}
|
||||
|
||||
$html
|
||||
@@ -314,6 +312,7 @@ function Build-Checkboxes {
|
||||
|
||||
|
||||
|
||||
|
||||
function Get-UIHtml {
|
||||
param([string]$Page = 'onboard')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user