controls/job-feedback-modal.ps1

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

    $Script = $Job.Script
    $Feedback = (Get-UAJobFeedback -JobId $Job.id)

    Show-UDModal -Content {
        New-UDPageHeader -Text ("Feedback for Job: $($Job.ID)")
        if ($null -eq $Feedback)
        {
            New-UDHeading -Text "This job does not require feedback."
        }
        else
        {
            $Feedback | ForEach-Object {

                If($_.Complete -ne $true)
                {
                    New-UDInput -Title $_.Message -SubmitText "Submit Feedback" -Endpoint {
                        param(
                            $Response
                            )
        
                        Set-UAJobFeedback -JobFeedback $_ -Response $Response
                                
                        Sync-UDElement -Id "JobRunningGrid" -Broadcast
                        Sync-UDElement -Id "ScriptsGrid" -Broadcast
                        Sync-UDElement -Id "JobGrid" -Broadcast
                        Hide-UDModal
                    }
                }

                


            }
            
        }
    }
}