f8c22690d4
This commit introduces two new utility classes: StudentNameFormatter and TeamStudentNameFormatter, which provide methods for formatting student names with options for indicating absence and overlaps. The Team class has been updated to remove the StudentsFirstNames property, and various components across the WebApp have been refactored to utilize the new formatting utilities. This enhances the maintainability and readability of the code while improving the presentation of student names in the UI.
79 lines
3.1 KiB
Plaintext
79 lines
3.1 KiB
Plaintext
@page "/teams/goals"
|
|
@attribute [Authorize]
|
|
@using Microsoft.EntityFrameworkCore
|
|
@using WebApp.Models
|
|
@using WebApp.Components.Shared.Components
|
|
@using Core.Utility
|
|
@inject IConfiguration Configuration
|
|
@inject AppDbContext Context
|
|
|
|
<PageHeader
|
|
Title="@($"{Configuration["ChapterSettings:Shortname"]} TSA Student Goals {Configuration["ChapterSettings:CompetitionYear"]}")"
|
|
Description="Set Your Goals for Success" />
|
|
|
|
@if (_students == null)
|
|
{
|
|
<p><em>Loading...</em></p>
|
|
}
|
|
else
|
|
{
|
|
<MudPaper Elevation="2" Class="pa-3 pa-md-6">
|
|
@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: @TeamStudentNameFormatter.FormatStudentList(
|
|
team,
|
|
new TeamStudentNameFormatter.FormatOptions
|
|
{
|
|
Ordering = TeamStudentNameFormatter.OrderingStyle.GradeDescending
|
|
}))
|
|
</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>
|
|
}
|
|
</MudPaper>
|
|
}
|
|
|
|
@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();
|
|
}
|
|
}
|