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; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Display(Name = "Team Number")]
|
||||||
[Display(Name = "Team Name")]
|
|
||||||
public int? Number { get; set; }
|
public int? Number { get; set; }
|
||||||
|
|
||||||
public EventDefinition Event
|
public EventDefinition Event
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<MudNavLink Href="/students" Icon="@Icons.Material.Filled.People">Students</MudNavLink>
|
<MudNavLink Href="/students" Icon="@Icons.Material.Filled.People">Students</MudNavLink>
|
||||||
|
|
||||||
<MudNavGroup Title="Teams" Icon="@Icons.Material.Outlined.Groups" Expanded="true">
|
<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/printout" Icon="@Icons.Material.Filled.Print">Print out</MudNavLink>
|
||||||
<MudNavLink Href="/teams/handout" Icon="@Icons.Material.Filled.Print">Handout</MudNavLink>
|
<MudNavLink Href="/teams/handout" Icon="@Icons.Material.Filled.Print">Handout</MudNavLink>
|
||||||
</MudNavGroup>
|
</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,7 +31,9 @@ else
|
|||||||
<MudSelectItem T="Student" Value="@student">@student.Name</MudSelectItem>
|
<MudSelectItem T="Student" Value="@student">@student.Name</MudSelectItem>
|
||||||
}
|
}
|
||||||
</MudSelect>
|
</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>
|
</MudPaper>
|
||||||
</MudItem>
|
</MudItem>
|
||||||
</MudGrid>
|
</MudGrid>
|
||||||
@@ -66,6 +68,17 @@ else
|
|||||||
{
|
{
|
||||||
NavigationManager.NavigateTo("notfound");
|
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.
|
// To protect from overposting attacks, enable the specific properties you want to bind to.
|
||||||
|
|||||||
@@ -16,8 +16,16 @@
|
|||||||
|
|
||||||
<MudDataGrid T="Team" ServerData="ServerReload" @ref="_dataGrid" Filterable="true" RowsPerPage="35">
|
<MudDataGrid T="Team" ServerData="ServerReload" @ref="_dataGrid" Filterable="true" RowsPerPage="35">
|
||||||
<Columns>
|
<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">
|
<TemplateColumn Title="Students">
|
||||||
<CellTemplate>
|
<CellTemplate>
|
||||||
@foreach (var student in
|
@foreach (var student in
|
||||||
@@ -31,9 +39,10 @@
|
|||||||
student.EventRankings
|
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 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};")">
|
<MudPaper Class="d-inline-flex pa-2 mx-2 my-1" Style="@($"background:{color};")">
|
||||||
@student.FirstName
|
@student.FirstName @if(captain){<span> *</span>}
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
}
|
}
|
||||||
</CellTemplate>
|
</CellTemplate>
|
||||||
@@ -48,15 +57,15 @@
|
|||||||
<MudStack Row>
|
<MudStack Row>
|
||||||
<MudButtonGroup Size="Size.Small">
|
<MudButtonGroup Size="Size.Small">
|
||||||
<MudTooltip Text="Details">
|
<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>
|
||||||
<MudTooltip Text="Edit">
|
<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>
|
||||||
<MudTooltip Text="Delete">
|
<MudTooltip Text="Delete">
|
||||||
<MudIconButton Icon="@Icons.Material.Outlined.Delete"
|
<MudIconButton Icon="@Icons.Material.Outlined.Delete"
|
||||||
Color="Color.Error"
|
Color="Color.Error"
|
||||||
OnClick="() => DeleteTeam(context.Item)" />
|
OnClick="() => DeleteTeam(context.Item!)"/>
|
||||||
</MudTooltip>
|
</MudTooltip>
|
||||||
</MudButtonGroup>
|
</MudButtonGroup>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ namespace WebApp.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*https://unicodeplus.com/search*/
|
/*https://unicodeplus.com/search*/
|
||||||
public static string OnSiteActivity = "𝔸";
|
public static string OnSiteActivity = "ⓐ";
|
||||||
public static string RegionalEvent = "ℝ";
|
public static string RegionalEvent = "ⓡ";
|
||||||
public static string IndividualEvent = "ⅈ";
|
public static string IndividualEvent = "ⓘ";
|
||||||
public static string PresubmissionEvent = "↩";
|
public static string PresubmissionEvent = "ⓟ";
|
||||||
public static string PresentationEvent = "ⓟ";
|
public static string PresentationEvent = "";
|
||||||
public static string QuestionMark = "❔";
|
public static string QuestionMark = "❔";
|
||||||
|
|
||||||
public static string EventEffort(EventDefinition eventDefinition)
|
public static string EventEffort(EventDefinition eventDefinition)
|
||||||
|
|||||||
Reference in New Issue
Block a user