diff --git a/WebApp/Components/Features/Events/Create.razor b/WebApp/Components/Features/Events/Create.razor index 70e6042..59f6111 100644 --- a/WebApp/Components/Features/Events/Create.razor +++ b/WebApp/Components/Features/Events/Create.razor @@ -8,50 +8,100 @@ Title="Create" Subtitle="Event" ShowBackButton="true" - BackButtonUrl="/events" /> + BackButtonUrl="@(ReturnUrl ?? "/events")" /> - - - - - - Format - - @foreach (EventFormat format in Enum.GetValues(typeof(EventFormat))) - { - @format.ToString() - } - + + + Basic Information + + + + + + + + + Event Format + + @foreach (EventFormat format in Enum.GetValues(typeof(EventFormat))) + { + @format.ToString() + } + + + + + + + - - - - - - - - - - - - - - - - - - - Create - Cancel - + + Event Details + + + + + + + + + + + + + + + Team Configuration + + + + + + + + + + + + + + + + + + + + + Competition Details + + + + + + + + + + + + + + Create + Cancel + + + @code { + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + [SupplyParameterFromForm] private EventDefinition EventDefinition { get; set; } = new(); @@ -63,12 +113,12 @@ context.Events.Add(EventDefinition); context.SaveChanges(); - NavigationManager.NavigateTo("/events"); + NavigationManager.NavigateTo(ReturnUrl ?? "/events"); } private void HandleCancel() { _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/events"); + NavigationManager.NavigateTo(ReturnUrl ?? "/events"); } } diff --git a/WebApp/Components/Features/Events/Details.razor b/WebApp/Components/Features/Events/Details.razor index f2b3ffd..aa3b245 100644 --- a/WebApp/Components/Features/Events/Details.razor +++ b/WebApp/Components/Features/Events/Details.razor @@ -16,14 +16,13 @@ Title="Details" Subtitle="Event Definition" ShowBackButton="true" - BackButtonUrl="/events"> + BackButtonUrl="@(ReturnUrl ?? "/events")">
Print Edit - Back to List
@@ -112,6 +111,9 @@ [SupplyParameterFromQuery] private int Id { get; set; } + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + protected override async Task OnInitializedAsync() { eventdefinition = await context.Events.FirstOrDefaultAsync(m => m.Id == Id); diff --git a/WebApp/Components/Features/Events/Edit.razor b/WebApp/Components/Features/Events/Edit.razor index e5b1d20..c0df30d 100644 --- a/WebApp/Components/Features/Events/Edit.razor +++ b/WebApp/Components/Features/Events/Edit.razor @@ -15,53 +15,103 @@ Title="Edit" Subtitle="Event" ShowBackButton="true" - BackButtonUrl="/events" /> + BackButtonUrl="@(ReturnUrl ?? "/events")" /> - - - - - - Format - - @foreach (EventFormat format in Enum.GetValues(typeof(EventFormat))) - { - @format.ToString() - } - + + + Basic Information + + + + + + + + + Event Format + + @foreach (EventFormat format in Enum.GetValues(typeof(EventFormat))) + { + @format.ToString() + } + + + + + + + - - - - - - - - - - - - - - - - - - - Save - Cancel - + + Event Details + + + + + + + + + + + + + + + Team Configuration + + + + + + + + + + + + + + + + + + + + + Competition Details + + + + + + + + + + + + + + Save + Cancel + + + @code { [SupplyParameterFromQuery] private int Id { get; set; } + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + [SupplyParameterFromForm] private EventDefinition? EventDefinition { get; set; } @@ -87,7 +137,7 @@ { context.SaveChangesAsync(); _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/events"); + NavigationManager.NavigateTo(ReturnUrl ?? "/events"); } catch (DbUpdateConcurrencyException) { @@ -111,7 +161,7 @@ } _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/events"); + NavigationManager.NavigateTo(ReturnUrl ?? "/events"); } private bool EventDefinitionExists(int id) diff --git a/WebApp/Components/Features/Students/Create.razor b/WebApp/Components/Features/Students/Create.razor index dc29273..5e5989a 100644 --- a/WebApp/Components/Features/Students/Create.razor +++ b/WebApp/Components/Features/Students/Create.razor @@ -8,31 +8,47 @@ Title="Create" Subtitle="Student" ShowBackButton="true" - BackButtonUrl="/students" /> + BackButtonUrl="@(ReturnUrl ?? "/students")" /> - - - - - - - - - - - - - - Create - Cancel - + + + Student Information + + + + + + + + + + + + + + + + + + + + + + + Create + Cancel + + @code { + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + [SupplyParameterFromForm] private Student Student { get; set; } = new() { TsaYear = 1 }; @@ -44,12 +60,12 @@ Context.Students.Add(Student); Context.SaveChanges(); - NavigationManager.NavigateTo("/students"); + NavigationManager.NavigateTo(ReturnUrl ?? "/students"); } private void HandleCancel() { _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/students"); + NavigationManager.NavigateTo(ReturnUrl ?? "/students"); } } diff --git a/WebApp/Components/Features/Teams/Create.razor b/WebApp/Components/Features/Teams/Create.razor index c057f0e..1240f65 100644 --- a/WebApp/Components/Features/Teams/Create.razor +++ b/WebApp/Components/Features/Teams/Create.razor @@ -15,7 +15,7 @@ Title="Create" Subtitle="Team" ShowBackButton="true" - BackButtonUrl="/teams" /> + BackButtonUrl="@(ReturnUrl ?? "/teams")" /> @@ -72,6 +72,9 @@ @code { + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + [SupplyParameterFromForm] private Team Team { get; set; } = new(); @@ -162,12 +165,12 @@ await Context.SaveChangesAsync(); _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/teams"); + NavigationManager.NavigateTo(ReturnUrl ?? "/teams"); } private void HandleCancel() { _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/teams"); + NavigationManager.NavigateTo(ReturnUrl ?? "/teams"); } } \ No newline at end of file diff --git a/WebApp/Components/Features/Teams/Details.razor b/WebApp/Components/Features/Teams/Details.razor index 5609633..2b98d65 100644 --- a/WebApp/Components/Features/Teams/Details.razor +++ b/WebApp/Components/Features/Teams/Details.razor @@ -16,16 +16,16 @@ + BackButtonUrl="@(ReturnUrl ?? "/teams")">
Print Edit - Back to List + Back to List
@@ -60,6 +60,9 @@ [SupplyParameterFromQuery] private int Id { get; set; } + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + private Team? Team { get; set; } protected override async Task OnInitializedAsync() diff --git a/WebApp/Components/Features/Teams/Edit.razor b/WebApp/Components/Features/Teams/Edit.razor index a8cfc0e..31bb50e 100644 --- a/WebApp/Components/Features/Teams/Edit.razor +++ b/WebApp/Components/Features/Teams/Edit.razor @@ -14,7 +14,7 @@ + BackButtonUrl="@(ReturnUrl ?? "/teams")" /> @@ -46,6 +46,9 @@ [SupplyParameterFromQuery] private int Id { get; set; } + [SupplyParameterFromQuery] + private string? ReturnUrl { get; set; } + [SupplyParameterFromForm] private Team? Team { get; set; } @@ -103,7 +106,7 @@ { await Context.SaveChangesAsync(); _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/teams"); + NavigationManager.NavigateTo(ReturnUrl ?? "/teams"); } catch (DbUpdateConcurrencyException) { @@ -127,7 +130,7 @@ } _formChangeTracker?.AllowNavigation(); - NavigationManager.NavigateTo("/teams"); + NavigationManager.NavigateTo(ReturnUrl ?? "/teams"); } private bool TeamExists(int id) diff --git a/docs/plans/style-improvements.md b/docs/plans/style-improvements.md index ad120fb..9df1c6f 100644 --- a/docs/plans/style-improvements.md +++ b/docs/plans/style-improvements.md @@ -250,7 +250,7 @@ Consider using MudChip components with rank colors for better visual distinction --- -### 9. Improve Form Layout +### 9. Improve Form Layout ✅ COMPLETED **Locations**: Create.razor and Edit.razor pages **Recommendations**: @@ -337,7 +337,7 @@ Consider using MudChip components with rank colors for better visual distinction ### Phase 3: Enhancements (Nice to Have) 7. Audit and ensure button hierarchy consistency 8. ✅ Enhance event rank visualization -9. Improve form layout grouping +9. ✅ Improve form layout grouping 10. Add micro-interactions and transitions ---