Clean up Team page
Add an EventAttributes display
This commit is contained in:
@@ -5,9 +5,9 @@ public class Team
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Team Name")]
|
||||
[Display(Name = "Team Number")]
|
||||
public int? Number { get; set; }
|
||||
|
||||
public EventDefinition Event
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<MudNavLink Href="/students" Icon="@Icons.Material.Filled.People">Students</MudNavLink>
|
||||
|
||||
<MudNavGroup Title="Teams" Icon="@Icons.Material.Outlined.Groups" Expanded="true">
|
||||
<MudNavLink Href="/teams" Icon="@AppIcons.Teams">Teams</MudNavLink>
|
||||
<MudNavLink Href="/teams" Match="NavLinkMatch.All" Icon="@AppIcons.Teams">Teams</MudNavLink>
|
||||
<MudNavLink Href="/teams/printout" Icon="@Icons.Material.Filled.Print">Print out</MudNavLink>
|
||||
<MudNavLink Href="/teams/handout" Icon="@Icons.Material.Filled.Print">Handout</MudNavLink>
|
||||
</MudNavGroup>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
@using WebApp.Models
|
||||
|
||||
@if(EventDefinition.EventFormat == EventFormat.Individual) {
|
||||
<MudTooltip Text="Individual">@AppIcons.IndividualEvent</MudTooltip>
|
||||
}
|
||||
@if (EventDefinition.OnSiteActivity)
|
||||
{
|
||||
<MudTooltip Text="On-site Activity">@AppIcons.OnSiteActivity</MudTooltip>
|
||||
}
|
||||
|
||||
@if (EventDefinition.RegionalEvent)
|
||||
{
|
||||
<MudTooltip Text="Regional Event">@AppIcons.RegionalEvent</MudTooltip>
|
||||
}
|
||||
|
||||
@if (EventDefinition.Presubmission)
|
||||
{
|
||||
<MudTooltip Text="Presubmission Event">@AppIcons.PresubmissionEvent</MudTooltip>
|
||||
}
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public EventDefinition EventDefinition { get; set; }
|
||||
}
|
||||
@@ -31,12 +31,14 @@ else
|
||||
<MudSelectItem T="Student" Value="@student">@student.Name</MudSelectItem>
|
||||
}
|
||||
</MudSelect>
|
||||
<MudTextField T="int?" Label="Number" @bind-Value="Team.Number" For="@(() => Team.Number)" Required="false" Clearable="true"></MudTextField>
|
||||
<MudTextField T="Student" Label="Captain" @bind-Value="Team.Captain" For="@(() => Team.Captain)" Required="false" Clearable="true"></MudTextField>
|
||||
<MudNumericField T="int?" Label="Number" @bind-Value="Team.Number" For="@(() => Team.Number)" Required="false" Clearable="true"></MudNumericField>
|
||||
<MudTextField T="string?" Label="TeamId" @bind-Value="Team.TeamId" For="@(() => Team.TeamId)" Required="false" Clearable="true"></MudTextField>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="teams">Back</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Save" OnClick="UpdateTeam">Save</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Save" OnClick="UpdateTeam">Save</MudButton>
|
||||
</EditForm>
|
||||
}
|
||||
|
||||
@@ -66,6 +68,17 @@ else
|
||||
{
|
||||
NavigationManager.NavigateTo("notfound");
|
||||
}
|
||||
|
||||
switch (Team!.Event.EventFormat)
|
||||
{
|
||||
case EventFormat.Individual when Team.Students.Count == 1:
|
||||
Team.Captain ??= Team.Students[0];
|
||||
Team.TeamId ??= Team.Captain.FirstName;
|
||||
break;
|
||||
case EventFormat.Team when Team.Number != null && Team.TeamId == null:
|
||||
Team.TeamId = Team.Number.ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// To protect from overposting attacks, enable the specific properties you want to bind to.
|
||||
|
||||
@@ -16,28 +16,37 @@
|
||||
|
||||
<MudDataGrid T="Team" ServerData="ServerReload" @ref="_dataGrid" Filterable="true" RowsPerPage="35">
|
||||
<Columns>
|
||||
<PropertyColumn Property="@(e => e.ToString())" Title="Event" />
|
||||
|
||||
<TemplateColumn Title="Event">
|
||||
<CellTemplate>
|
||||
@context.Item.ToString()
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Attributes">
|
||||
<CellTemplate>
|
||||
<EventAttributes EventDefinition="@context.Item.Event"></EventAttributes>
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
<TemplateColumn Title="Students">
|
||||
<CellTemplate>
|
||||
@foreach (var student in
|
||||
context.Item.Students
|
||||
.OrderBy(e =>
|
||||
e.EventRankings
|
||||
.Find(er => er.EventDefinition == context.Item.Event)?.Rank ?? 10)
|
||||
.Find(er => er.EventDefinition == context.Item.Event)?.Rank ?? 10)
|
||||
.ThenBy(s => s.Grade + s.TsaYear))
|
||||
{
|
||||
var eventRank =
|
||||
var eventRank =
|
||||
student.EventRankings
|
||||
.Find(e => e.EventDefinition == context.Item.Event)?.Rank;
|
||||
.Find(e => e.EventDefinition == context.Item.Event)?.Rank;
|
||||
var color = AppIcons.RankedEventColor(eventRank ?? 0);
|
||||
var captain = context.Item.Captain != null && context.Item.Captain.Equals(student);
|
||||
|
||||
<MudPaper Class="d-inline-flex pa-2 mx-2 my-1" Style="@($"background:{color};")">
|
||||
@student.FirstName
|
||||
@student.FirstName @if(captain){<span> *</span>}
|
||||
</MudPaper>
|
||||
}
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</TemplateColumn>
|
||||
@* <TemplateColumn Title="Grade (TSA Year)" SortBy="e => e.Grade" Sortable="true">
|
||||
<CellTemplate>
|
||||
@context.Item.Grade (@context.Item.TsaYear)
|
||||
@@ -48,15 +57,15 @@
|
||||
<MudStack Row>
|
||||
<MudButtonGroup Size="Size.Small">
|
||||
<MudTooltip Text="Details">
|
||||
<MudIconButton Href="@($"/teams/details?id={context.Item.Id}")" Icon="@Icons.Material.Filled.Description">Details</MudIconButton>
|
||||
<MudIconButton Href="@($"/teams/details?id={context.Item!.Id}")" Icon="@Icons.Material.Filled.Description">Details</MudIconButton>
|
||||
</MudTooltip>
|
||||
<MudTooltip Text="Edit">
|
||||
<MudIconButton Href="@($"/teams/edit?id={context.Item.Id}")" Icon="@Icons.Material.Filled.Edit">Edit</MudIconButton>
|
||||
<MudIconButton Href="@($"/teams/edit?id={context.Item!.Id}")" Icon="@Icons.Material.Filled.Edit">Edit</MudIconButton>
|
||||
</MudTooltip>
|
||||
<MudTooltip Text="Delete">
|
||||
<MudIconButton Icon="@Icons.Material.Outlined.Delete"
|
||||
Color="Color.Error"
|
||||
OnClick="() => DeleteTeam(context.Item)" />
|
||||
OnClick="() => DeleteTeam(context.Item!)"/>
|
||||
</MudTooltip>
|
||||
</MudButtonGroup>
|
||||
</MudStack>
|
||||
|
||||
@@ -24,11 +24,11 @@ namespace WebApp.Models
|
||||
}
|
||||
|
||||
/*https://unicodeplus.com/search*/
|
||||
public static string OnSiteActivity = "𝔸";
|
||||
public static string RegionalEvent = "ℝ";
|
||||
public static string IndividualEvent = "ⅈ";
|
||||
public static string PresubmissionEvent = "↩";
|
||||
public static string PresentationEvent = "ⓟ";
|
||||
public static string OnSiteActivity = "ⓐ";
|
||||
public static string RegionalEvent = "ⓡ";
|
||||
public static string IndividualEvent = "ⓘ";
|
||||
public static string PresubmissionEvent = "ⓟ";
|
||||
public static string PresentationEvent = "";
|
||||
public static string QuestionMark = "❔";
|
||||
|
||||
public static string EventEffort(EventDefinition eventDefinition)
|
||||
|
||||
Reference in New Issue
Block a user