@using ErsatzTV.Application.Playouts @implements IDisposable @inject IMediator Mediator @inject ISnackbar Snackbar @inject ILogger Logger @FormatText() Do not automatically reset @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 { private readonly CancellationTokenSource _cts = new(); [CascadingParameter] IMudDialogInstance MudDialog { get; set; } [Parameter] public int PlayoutId { get; set; } [Parameter] public string ChannelName { get; set; } [Parameter] public string ScheduleName { get; set; } [Parameter] public Option DailyResetTime { get; set; } private string FormatText() => $"Enter the time that the playout on channel {ChannelName} with schedule {ScheduleName} should reset every day"; private record DummyModel; private readonly DummyModel _dummyModel = new(); private Option _resetTime; public void Dispose() { _cts?.Cancel(); _cts?.Dispose(); } protected override void OnParametersSet() => _resetTime = DailyResetTime; private async Task Submit() { Either maybeResult = await Mediator.Send(new UpdatePlayout(PlayoutId, _resetTime), _cts.Token); 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(); }