controls/schedule-remove-modal.ps1

function New-ScheduleRemoveModal 
{
    param (
        [Parameter(Mandatory = $true)]
        $Schedule
    )

    Show-UDModal -Content {
        New-UDPageHeader -Text ("Removing Schedule: $($Schedule.ID)")
        New-UDHtml -Markup ("<b>Description</b>: $($Schedule.Description)")
        New-UDHtml -Markup ("<b>Next Execution</b>: $($Schedule.NextExecution) $($Schedule.TimeZoneString)")
        New-UDParagraph -Text "Are you sure you wish to remove this Schedule?"
        
        New-UDElement -Tag div -Attributes @{
            style = @{
                textAlign = "right"
            }
        } -Content {
        
            New-UDButton -Text "Confirm" -Icon check -OnClick {
                Get-UASchedule -Id $Schedule.Id | Remove-UASchedule
                Sync-UDElement -Id "schedule-grid" -Broadcast
                Sync-UDElement -Id "JobUpcomingGrid" -Broadcast
                Hide-UDModal
            }

        }

    } -Width '50%'

}