Add goals page

This commit is contained in:
2025-12-25 20:03:19 -05:00
parent c77d2117cd
commit 1f5aba7f04
@@ -0,0 +1,72 @@
@page "/teams/goals"
@attribute [Authorize]
@using Microsoft.EntityFrameworkCore
@using WebApp.Models
@inject IConfiguration Configuration
@inject AppDbContext Context
<PageTitle>@Configuration["ChapterSettings:Shortname"] TSA Student Goals @Configuration["ChapterSettings:CompetitionYear"]</PageTitle>
<MudText Typo="Typo.h3">@Configuration["ChapterSettings:Shortname"] TSA Student Goals @Configuration["ChapterSettings:CompetitionYear"]</MudText>
<MudText Typo="Typo.h5" Class="mb-4">Set Your Goals for Success</MudText>
@if (_students == null)
{
<p><em>Loading...</em></p>
}
else
{
<MudContainer>
@foreach (var student in _students)
{
<MudContainer Class="pagebreak">
<MudText Typo="Typo.h4" Class="mb-4">@student.Name</MudText>
<MudText Typo="Typo.body2" Class="mb-3">
For each of your events, write down your goals for this competition year.
</MudText>
@foreach (var team in student.Teams.OrderBy(t => t.Event.Name))
{
<MudContainer Class="mb-4 nobrk">
<MudGrid>
<MudItem xs="12">
<MudText Typo="Typo.h6" Class="mb-2">
@team.Event.Name
@if (team.Event.EventFormat == EventFormat.Team)
{
<span style="font-weight: normal; font-size: 0.9em;">
(Team: @string.Join(", ", team.Students.OrderByDescending(e => e.Grade + e.TsaYear).Select(e => e.FirstName)))
</span>
}
</MudText>
</MudItem>
<MudItem xs="12">
<MudText Typo="Typo.caption" Class="mb-1">
<strong>Goal:</strong>
</MudText>
<div style="border-bottom: 1px solid #ccc; min-height: 30px; margin-bottom: 8px;"></div>
<div style="border-bottom: 1px solid #ccc; min-height: 30px; margin-bottom: 8px;"></div>
</MudItem>
</MudGrid>
</MudContainer>
}
</MudContainer>
}
</MudContainer>
}
@code {
private Student[]? _students;
protected override async Task OnInitializedAsync()
{
_students =
await Context.Students
.Include(e => e.Teams)
.ThenInclude(e => e.Event)
.Include(e => e.Teams)
.ThenInclude(e => e.Students)
.OrderBy(e => e.FirstName)
.ToArrayAsync();
}
}