+
break;
diff --git a/src/iRLeagueManager.Web/Components/EditEventModal.razor b/src/iRLeagueManager.Web/Components/EditEventModal.razor
index a1c04bee..a5855fd1 100644
--- a/src/iRLeagueManager.Web/Components/EditEventModal.razor
+++ b/src/iRLeagueManager.Web/Components/EditEventModal.razor
@@ -9,7 +9,7 @@
@inject TrackListService trackListService
-
+
@@ -97,20 +97,19 @@
-
- @config?.Name
+ @GetReferencedResultConfigName(config)
- @config.Name
+ @GetReferencedResultConfigName(config)
@name not found!
@@ -118,6 +117,7 @@
+
@@ -196,9 +196,19 @@
private async Task
> SearchResultConfigs(string name)
{
return await Task.FromResult(ResultConfigs
+ .Where(x => Event.ResultConfigs.Any(y => y.ResultConfigId == x.ResultConfigId) == false)
.Where(x => x.Name.Contains(name, StringComparison.OrdinalIgnoreCase) || x.DisplayName.Contains(name, StringComparison.OrdinalIgnoreCase)));
}
+ private string GetReferencedResultConfigName(ResultConfigInfoModel config)
+ {
+ if (string.IsNullOrEmpty(config.ChampionshipName))
+ {
+ return config.Name;
+ }
+ return $"{config.ChampionshipName} - {config.Name}";
+ }
+
private async Task Submit()
{
//var status = await Event.SaveChangesAsync(cts.Token);
diff --git a/src/iRLeagueManager.Web/Components/EditModalBase.razor.cs b/src/iRLeagueManager.Web/Components/EditModalBase.razor.cs
index 2d6c8c39..93c689cf 100644
--- a/src/iRLeagueManager.Web/Components/EditModalBase.razor.cs
+++ b/src/iRLeagueManager.Web/Components/EditModalBase.razor.cs
@@ -10,7 +10,7 @@
namespace iRLeagueManager.Web.Components;
-public class EditModalBase : MvvmComponentBase where TViewModel : LeagueViewModelBase
+public class EditModalBase : MvvmComponentBase where TViewModel : LeagueViewModelBase where TModel : class
{
[Inject]
protected TViewModel Vm { get; set; } = default!;
diff --git a/src/iRLeagueManager.Web/Components/Settings/ChampSeasonPreview.razor b/src/iRLeagueManager.Web/Components/Settings/ChampSeasonPreview.razor
new file mode 100644
index 00000000..7c0c5c92
--- /dev/null
+++ b/src/iRLeagueManager.Web/Components/Settings/ChampSeasonPreview.razor
@@ -0,0 +1,38 @@
+@using iRLeagueManager.Web.ViewModels
+
+
+
+
@ChampSeason.ChampionshipName
+
+
+
ResultConfigs
+
+ @foreach(var config in ChampSeason.ResultConfigs)
+ {
+
+ @config.Name
+
+ }
+
+
+
+
Standing Config
+
+ @ChampSeason.StandingConfig?.Name
+
+
+
+
+
+@code {
+ [Parameter(CaptureUnmatchedValues=true)]
+ public IDictionary? AdditionalAttributes { get; set; }
+
+ [Parameter, EditorRequired]
+ public ChampSeasonViewModel ChampSeason { get; set; } = default!;
+
+ protected override void OnParametersSet()
+ {
+ _ = ChampSeason ?? throw BlazorParameterNullException.New(this, ChampSeason);
+ }
+}
diff --git a/src/iRLeagueManager.Web/Components/Settings/ChampionshipPreview.razor b/src/iRLeagueManager.Web/Components/Settings/ChampionshipPreview.razor
new file mode 100644
index 00000000..5c072bee
--- /dev/null
+++ b/src/iRLeagueManager.Web/Components/Settings/ChampionshipPreview.razor
@@ -0,0 +1,52 @@
+@using iRLeagueManager.Web.ViewModels
+
+
+ @{
+ var name = ChampSeason?.ChampionshipName ?? Championship.Name;
+ var displayName = ChampSeason?.ChampionshipDisplayName ?? Championship.DisplayName;
+ }
+
+
@name
+ @if (string.IsNullOrEmpty(displayName) == false && displayName != name)
+ {
+ => "@displayName"
+ }
+
+ @if (ChampSeason is not null)
+ {
+
+
+
Result Configurations
+
+ @foreach(var config in ChampSeason.ResultConfigs)
+ {
+ - @config.Name
+ }
+
+
+
+
Standings
+
+ - Count @ChampSeason.StandingConfig?.WeeksCounted weeks
+
+
+
+ }
+
+
+
+@code {
+ [Parameter(CaptureUnmatchedValues=true)]
+ public IDictionary? AdditionalAttributes { get; set; }
+
+ [Parameter, EditorRequired]
+ public ChampionshipViewModel Championship { get; set; } = default!;
+
+ [Parameter, EditorRequired]
+ public ChampSeasonViewModel? ChampSeason { get; set; }
+
+ protected override void OnParametersSet()
+ {
+ _ = Championship ?? throw BlazorParameterNullException.New(this, Championship);
+ }
+}
diff --git a/src/iRLeagueManager.Web/Components/Settings/EditChampSeasonModal.razor b/src/iRLeagueManager.Web/Components/Settings/EditChampSeasonModal.razor
new file mode 100644
index 00000000..08f6af50
--- /dev/null
+++ b/src/iRLeagueManager.Web/Components/Settings/EditChampSeasonModal.razor
@@ -0,0 +1,126 @@
+@using iRLeagueApiCore.Common.Models;
+@inherits EditModalBase
+
+
+
+
+
+
+
+
+ @foreach(var resultConfig in Vm.ResultConfigViewModels)
+ {
+
OnResultConfigClick(resultConfig))>
+
+
+
+
+
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+@code {
+ private IEnumerable ResultConfigs { get; set; } = Array.Empty();
+
+ protected override async Task OnAfterRenderAsync(bool firstRender)
+ {
+ await base.OnAfterRenderAsync(firstRender);
+ if (firstRender == false) return;
+
+ await Vm.LoadResultConfigs(Cts.Token);
+ await InvokeAsync(StateHasChanged);
+ }
+
+ private async Task OnResultConfigClick(ResultConfigViewModel config)
+ {
+ var parameters = new ModalParameters()
+ .Add(x => x.Model, config.CopyModel())
+ .Add(x => x.OnSubmit, (configVm, cancellationToken) => configVm.SaveChangesAsync(cancellationToken));
+ var result = await ModalService.Show("Edit result config", parameters).Result;
+ if (result.Confirmed && result.Data is ResultConfigModel model)
+ {
+ config.SetModel(model);
+ }
+ }
+
+ private async Task OnAddResultConfigClick()
+ {
+ var parameters = new ModalParameters()
+ .Add(x => x.Model, CreateResultConfig())
+ .Add(x => x.OnSubmit, (x, c) => Vm.AddResultConfig(x.GetModel(), c));
+ await ModalService.Show("Add result config", parameters).Result;
+ }
+
+ private async Task OnDeleteResultConfigClick(ResultConfigViewModel config)
+ {
+ var parameters = new ModalParameters()
+ .Add(x => x.Text, $"Really delete result config \"{config.Name}\"?")
+ .Add(x => x.ButtonTypes, ButtonTypes.YesNo);
+ var result = await ModalService.Show("Delete Result Config", parameters).Result;
+ if (result.Confirmed)
+ {
+ await Vm.DeleteResultConfig(config.GetModel());
+ }
+ }
+
+ private ResultConfigModel CreateResultConfig()
+ {
+ return new ResultConfigModel();
+ }
+}
diff --git a/src/iRLeagueManager.Web/Components/Settings/EditResultConfigModal.razor b/src/iRLeagueManager.Web/Components/Settings/EditResultConfigModal.razor
index 8eb9a0d6..01163145 100644
--- a/src/iRLeagueManager.Web/Components/Settings/EditResultConfigModal.razor
+++ b/src/iRLeagueManager.Web/Components/Settings/EditResultConfigModal.razor
@@ -13,13 +13,10 @@
General Settings
-