controls/job-cancel-modal.ps1

function New-JobCancelModal 
{
    param (
        [Parameter(Mandatory = $true)]
        $Job
    )

    $Script = Get-UAScript -Id $($Job.Script.Id)
    Show-UDModal -Content {
        New-UDPageHeader -Text ("Cancel Job: $($Job.ID)")
        New-UDParagraph -Text "Job for Script: $($Script.Name) - ID: $($Script.Id)"
        New-UDParagraph -Text "Are you sure you wish to Cancel this Job?"
        New-UDElement -Tag div -Attributes @{
            style = @{
                textAlign = "right"
            }
        } -Content {
            New-UDButton -Text "Confirm" -Icon check -OnClick{
                    Get-UAJob -Id $Job.Id | Stop-UAJob 
                    Sync-UDElement -Id "JobGrid" -Broadcast
                    Sync-UDElement -Id "JobUpcomingGrid" -Broadcast
                    Sync-UDElement -Id "JobHistoricalGrid" -Broadcast
                    Hide-UDModal
            }
        }
    }
}