@using System.Globalization @using ErsatzTV.Application.Playouts @using ErsatzTV.Application.Playouts.Commands @inject IMediator _mediator @inject ISnackbar _snackbar @inject ILogger _logger @FormatText() Do not automatically rebuild @for (var i = 1; i < 48; i++) { var time = TimeSpan.FromHours(i * 0.5); string formatted = DateTime.Today.Add(time).ToShortTimeString(); @formatted } Cancel Save Changes @code { [CascadingParameter] MudDialogInstance MudDialog { get; set; } [Parameter] public int PlayoutId { get; set; } [Parameter] public string ChannelName { get; set; } [Parameter] public string ScheduleName { get; set; } [Parameter] public Option DailyRebuildTime { get; set; } private string FormatText() => $"Enter the time that the playout on channel {ChannelName} with schedule {ScheduleName} should rebuild every day"; private record DummyModel; private readonly DummyModel _dummyModel = new(); private Option _rebuildTime; protected override void OnParametersSet() { _rebuildTime = DailyRebuildTime; } private async Task Submit() { Either maybeResult = await _mediator.Send(new UpdatePlayout(PlayoutId, _rebuildTime)); maybeResult.Match( playout => { MudDialog.Close(DialogResult.Ok(playout)); }, error => { _snackbar.Add(error.Value, Severity.Error); _logger.LogError("Error updating Playout: {Error}", error.Value); MudDialog.Close(DialogResult.Cancel()); }); } private void Cancel(MouseEventArgs e) => MudDialog.Cancel(); }