controls/tag-edit-modal.ps1
function Edit-UDTagModal { param ( [Parameter(Mandatory = $true)] $Tag ) Show-UDModal -Width "75%" -Content { New-UDPageHeader -Text ("Edit Tag") New-UDParagraph -Text "Updating Tag: $($Tag.Name)" New-UDTextbox -Id "EditTagModalTextBoxName" -Label "Name" -Type text -Value $Tag.Name New-UDTextbox -Id "EditTagModalTextBoxDescription" -Label "Description" -Type text -Value $Tag.Description New-UDTextbox -Id "EditTagModalTextBoxColor" -Type text -Label "Color" -Value $Tag.Color New-UDElement -Tag div -Attributes @{ style = @{ textAlign = "right" } } -Content { New-UDButton -Text "Save Changes" -Icon edit -OnClick { # Get Input Data $Name = ((Get-UDElement -Id 'EditTagModalTextBoxName').Attributes["value"]) $Description = ((Get-UDElement -Id 'EditTagModalTextBoxDescription').Attributes["value"]) $Color = ((Get-UDElement -Id 'EditTagModalTextBoxColor').Attributes["value"]) # Null Checks if (!$Description -or $Description -eq "" -or $Description -eq "null") {$Description = ""} # Update Script $Tag | Set-UATag -Name $Name -Description $Description -Color $Color # Grid Sync Sync-UDElement -Id "TagGrid" -Broadcast Hide-UDModal } } } } |