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.
130 lines
5.4 KiB
Plaintext
130 lines
5.4 KiB
Plaintext
@page "/teams/handout"
|
|
@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 Teams {Configuration["ChapterSettings:CompetitionYear"]}")"
|
|
Description="Yearly theme: Unity Through Community" />
|
|
|
|
@if (_teams == null || _students == null)
|
|
{
|
|
<p><em>Loading...</em></p>
|
|
}
|
|
else
|
|
{
|
|
<MudContainer>
|
|
@foreach (var studentForEvents in _students)
|
|
{
|
|
<MudContainer Class="pagebreak">
|
|
<MudText Typo="Typo.h4">@studentForEvents.Name</MudText>
|
|
@foreach (var team in studentForEvents.Teams)
|
|
{
|
|
<MudContainer Class="mt-3 mb-1 nobrk">
|
|
<MudGrid>
|
|
<MudItem xs="6">
|
|
<MudStack>
|
|
<MudItem>
|
|
<MudText Class="d-flex py-1" Typo="Typo.h5">
|
|
@team.ToString()
|
|
</MudText>
|
|
</MudItem>
|
|
|
|
@if (team.Event.RegionalEvent)
|
|
{
|
|
<MudItem>
|
|
<MudText Class="d-flex" Typo="Typo.caption"><i>Regional Event</i></MudText>
|
|
</MudItem>
|
|
}
|
|
</MudStack>
|
|
</MudItem>
|
|
<MudItem xs="2">
|
|
<MudText>
|
|
<strong>@team.Event.EventFormat</strong>
|
|
</MudText>
|
|
|
|
</MudItem>
|
|
<MudItem xs="1">
|
|
<strong>Effort</strong>: @AppIcons.LevelOfEffortIcon(@team.Event.LevelOfEffort)
|
|
</MudItem>
|
|
<MudItem xs="3">
|
|
<strong>Activity</strong>: @team.Event.SemifinalistActivity
|
|
</MudItem>
|
|
@if (team.Event.EventFormat == EventFormat.Team)
|
|
{
|
|
<MudItem xs="12">
|
|
<MudText Class="d-flex py-1" Typo="Typo.h6">
|
|
Team Members: @TeamStudentNameFormatter.FormatStudentList(
|
|
team,
|
|
new TeamStudentNameFormatter.FormatOptions
|
|
{
|
|
Ordering = TeamStudentNameFormatter.OrderingStyle.GradeDescending
|
|
})
|
|
</MudText>
|
|
</MudItem>
|
|
}
|
|
<MudItem xs="12">
|
|
<MudText Class="d-flex py-1 pre-wrap-text">@team.Event.Description</MudText>
|
|
</MudItem>
|
|
@if (!string.IsNullOrEmpty(team.Event.Theme))
|
|
{
|
|
<MudItem xs="3">
|
|
<MudText Class="d-flex py-1">
|
|
<i>Theme for 2025-26:</i>
|
|
</MudText>
|
|
</MudItem>
|
|
<MudItem xs="8">
|
|
<MudText Class="d-flex py-1 pre-wrap-text">@team.Event.Theme</MudText>
|
|
</MudItem>
|
|
}
|
|
|
|
@if (!string.IsNullOrEmpty(team.Event.Documentation))
|
|
{
|
|
<MudItem xs="3">
|
|
<MudText Class="d-flex py-1">
|
|
<i>Materials:</i>
|
|
</MudText>
|
|
</MudItem>
|
|
<MudItem xs="8">
|
|
<MudText Class="d-flex py-1 pre-wrap-text">@team.Event.Documentation</MudText>
|
|
</MudItem>
|
|
}
|
|
|
|
</MudGrid>
|
|
</MudContainer>
|
|
<MudDivider/>
|
|
}
|
|
</MudContainer>
|
|
}
|
|
</MudContainer>
|
|
}
|
|
@code {
|
|
private Team[]? _teams;
|
|
private int _maxTeamSize;
|
|
private Student[]? _students;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
_teams
|
|
= await Context.Teams
|
|
.Include(e => e.Event)
|
|
.Include(e => e.Students)
|
|
.OrderBy(e => e.Event.Name)
|
|
.ThenBy(e => e.Identifier)
|
|
.ToArrayAsync();
|
|
|
|
_maxTeamSize = _teams.Max(t => t.Students.Count);
|
|
_students =
|
|
await Context.Students
|
|
.Include(e => e.Teams)
|
|
.ThenInclude(e => e.Captain)
|
|
.Include(e => e.EventRankings)
|
|
.ThenInclude(e => e.EventDefinition)
|
|
.OrderBy(e => e.FirstName).ToArrayAsync();
|
|
}
|
|
}
|