Use PageHeader throughout the system
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
@page "/events/create"
|
||||
@attribute [Authorize]
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Create Event - TSA Chapter Organizer</PageTitle>
|
||||
<PageHeader
|
||||
Title="Create"
|
||||
Subtitle="Event"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="/events">
|
||||
<ActionButtons>
|
||||
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary" Form="create-event-form">Create</MudButton>
|
||||
<MudButton Href="/events" Variant="Variant.Text">Cancel</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<MudText Typo="Typo.h3">Create</MudText>
|
||||
<MudText Typo="Typo.h4">Event</MudText>
|
||||
<MudDivider />
|
||||
|
||||
|
||||
<EditForm Model="EventDefinition" OnValidSubmit="OnValidSubmit" Enhance>
|
||||
<EditForm id="create-event-form" Model="EventDefinition" OnValidSubmit="OnValidSubmit" Enhance>
|
||||
<AntiforgeryToken />
|
||||
<DataAnnotationsValidator />
|
||||
<MudGrid>
|
||||
@@ -44,8 +49,6 @@
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="events">Back</MudButton>
|
||||
<MudButton ButtonType="ButtonType.Submit" StartIcon="@Icons.Material.Filled.Save">Save</MudButton>
|
||||
</EditForm>
|
||||
|
||||
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
@page "/events/details"
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Event Details - TSA Chapter Organizer</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">Details</MudText>
|
||||
<MudText Typo="Typo.h4">Event Definition</MudText>
|
||||
<MudDivider />
|
||||
|
||||
@if (eventdefinition is null)
|
||||
{
|
||||
<MudText><em>Loading...</em></MudText>
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudPaper Class="pa-4 mt-4">
|
||||
|
||||
<PageHeader
|
||||
Title="Details"
|
||||
Subtitle="Event Definition"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="/events">
|
||||
<ActionButtons>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Edit" Href="@($"/events/edit?id={eventdefinition.Id}")" Variant="Variant.Outlined">Edit</MudButton>
|
||||
<MudButton Href="/events" Variant="Variant.Text">Back to List</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<MudPaper Class="pa-4 mt-4">
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6" md="4">
|
||||
<MudText Typo="Typo.subtitle2">Name</MudText>
|
||||
@@ -79,13 +85,7 @@ else
|
||||
<MudText>@eventdefinition.Description</MudText>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
|
||||
<div class="mt-4">
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Edit" Href="@($"/events/edit?id={eventdefinition.Id}")" Variant="Variant.Filled" Color="Color.Primary">Edit</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="/events" Variant="Variant.Text">Back to List</MudButton>
|
||||
</div>
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
private EventDefinition? eventdefinition;
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
@page "/events/edit"
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Edit Event - TSA Chapter Organizer</PageTitle>
|
||||
@if (EventDefinition is null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
return;
|
||||
}
|
||||
|
||||
<MudText Typo="Typo.h3">Edit</MudText>
|
||||
<MudText Typo="Typo.h4">Event</MudText>
|
||||
<MudDivider />
|
||||
<PageHeader
|
||||
Title="Edit"
|
||||
Subtitle="Event"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="/events">
|
||||
<ActionButtons>
|
||||
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary" Form="edit-event-form">Save</MudButton>
|
||||
<MudButton Href="/events" Variant="Variant.Text">Cancel</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
|
||||
<EditForm Model="EventDefinition" OnValidSubmit="OnValidSubmit" Enhance>
|
||||
<EditForm id="edit-event-form" Model="EventDefinition" OnValidSubmit="OnValidSubmit" Enhance>
|
||||
<AntiforgeryToken />
|
||||
<DataAnnotationsValidator />
|
||||
<MudGrid>
|
||||
@@ -45,11 +56,8 @@
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="events">Back</MudButton>
|
||||
<MudButton ButtonType="ButtonType.Submit" StartIcon="@Icons.Material.Filled.Save">Save</MudButton>
|
||||
</EditForm>
|
||||
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
private int Id { get; set; }
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@attribute [Authorize]
|
||||
@page "/events/printout"
|
||||
@inject IConfiguration Configuration
|
||||
@inject AppDbContext Context
|
||||
|
||||
<PageTitle>TSA Events @Configuration["ChapterSettings:CompetitionYear"]</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">TSA Events @Configuration["ChapterSettings:CompetitionYear"]</MudText>
|
||||
<MudText Typo="Typo.h5" Class="mb-4">Yearly theme: Unity Through Community</MudText>
|
||||
<PageHeader
|
||||
Title="@($"TSA Events {Configuration["ChapterSettings:CompetitionYear"]}")"
|
||||
Description="Yearly theme: Unity Through Community" />
|
||||
|
||||
@if (_events == null)
|
||||
{
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
@using System.Text
|
||||
@using Core.Calculation
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject IConfiguration Configuration
|
||||
@inject AppDbContext Context
|
||||
@inject ClipboardService ClipboardService
|
||||
@inject LocalStorageService LocalStorage
|
||||
|
||||
<PageTitle>@Configuration["ChapterSettings:Shortname"] TSA Schedule @Configuration["ChapterSettings:CompetitionYear"]</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">@Configuration["ChapterSettings:Shortname"] TSA Schedule @Configuration["ChapterSettings:CompetitionYear"]</MudText>
|
||||
<PageHeader Title="@($"{Configuration["ChapterSettings:Shortname"]} TSA Schedule {Configuration["ChapterSettings:CompetitionYear"]}")" />
|
||||
|
||||
<MudPaper Class="pa-4 mt-5">
|
||||
<MudGrid>
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
@page "/students/create"
|
||||
@attribute [Authorize]
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext Context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Create Student - TSA Chapter Organizer</PageTitle>
|
||||
<PageHeader
|
||||
Title="Create"
|
||||
Subtitle="Student"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="/students">
|
||||
<ActionButtons>
|
||||
<MudButton ButtonType="ButtonType.Submit" Variant="Variant.Filled" Color="Color.Primary" Form="create-student-form">Create</MudButton>
|
||||
<MudButton Href="/students" Variant="Variant.Text">Cancel</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<MudText Typo="Typo.h3">Create</MudText>
|
||||
<MudText Typo="Typo.h4">Student</MudText>
|
||||
<MudDivider />
|
||||
|
||||
|
||||
<EditForm Model="Student" OnValidSubmit="OnValidSubmit" Enhance>
|
||||
<EditForm id="create-student-form" Model="Student" OnValidSubmit="OnValidSubmit" Enhance>
|
||||
<AntiforgeryToken />
|
||||
<DataAnnotationsValidator />
|
||||
<MudGrid>
|
||||
@@ -25,8 +30,6 @@
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="students">Back</MudButton>
|
||||
<MudButton ButtonType="ButtonType.Submit" StartIcon="@Icons.Material.Filled.Save">Save</MudButton>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
@page "/students/details"
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using Core.Entities
|
||||
@using Data
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Student Details - TSA Chapter Organizer</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">Details</MudText>
|
||||
<MudText Typo="Typo.h4">Student</MudText>
|
||||
<MudDivider />
|
||||
|
||||
@if (student is null)
|
||||
{
|
||||
<MudText><em>Loading...</em></MudText>
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudPaper Class="pa-4 mt-4">
|
||||
|
||||
<PageHeader
|
||||
Title="Student Details"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="@(ReturnUrl ?? "/students")">
|
||||
<ActionButtons>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Edit" Href="@($"/students/edit?id={student.Id}&returnUrl={ReturnUrl ?? "/students"}")" Variant="Variant.Outlined">Edit</MudButton>
|
||||
<MudButton Href="@(ReturnUrl ?? "/students")" Variant="Variant.Text">Back to List</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<MudPaper Class="pa-4 mt-4">
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6" md="4">
|
||||
<MudText Typo="Typo.subtitle2">First Name</MudText>
|
||||
@@ -61,13 +64,7 @@ else
|
||||
<MudText>@student.OfficerRole</MudText>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
|
||||
<div class="mt-4">
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Edit" Href="@($"/students/edit?id={student.Id}&returnUrl={ReturnUrl ?? "/students"}")" Variant="Variant.Filled" Color="Color.Primary">Edit</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="@(ReturnUrl ?? "/students")" Variant="Variant.Text">Back to List</MudButton>
|
||||
</div>
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
private Student? student;
|
||||
|
||||
@@ -1,25 +1,30 @@
|
||||
@page "/students/edit"
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext Context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Edit Student - TSA Chapter Organizer</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">Edit</MudText>
|
||||
<MudText Typo="Typo.h4">Student@(@Student == null ? "" : $" ({Student.Name})")</MudText>
|
||||
|
||||
|
||||
|
||||
@if (Student is null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* https://www.mudblazor.com/components/form */
|
||||
/* https://medium.com/@husainalbar/applying-mudblazor-for-crud-operations-in-our-blazor-project-a343037a52ef */
|
||||
<EditForm method="post" Model="Student" OnValidSubmit="UpdateStudent" FormName="edit" Enhance>
|
||||
|
||||
<PageHeader
|
||||
Title="Edit Student"
|
||||
Subtitle="@($"{Student.FirstNameLastName}")"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="@(ReturnUrl ?? "/students")">
|
||||
<ActionButtons>
|
||||
<MudButton OnClick="UpdateStudent" Variant="Variant.Filled" Color="Color.Primary">Save</MudButton>
|
||||
<MudButton Href="@(ReturnUrl ?? "/students")" Variant="Variant.Text">Cancel</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
@* https://www.mudblazor.com/components/form *@
|
||||
@* https://medium.com/@husainalbar/applying-mudblazor-for-crud-operations-in-our-blazor-project-a343037a52ef *@
|
||||
<EditForm method="post" Model="Student" OnValidSubmit="UpdateStudent" FormName="edit" Enhance>
|
||||
<AntiforgeryToken />
|
||||
<DataAnnotationsValidator/>
|
||||
<MudGrid>
|
||||
@@ -45,10 +50,7 @@ else
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="@(ReturnUrl ?? "/students")">Back</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Save" OnClick="UpdateStudent">Save</MudButton>
|
||||
</EditForm>
|
||||
}
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
@@ -74,7 +76,7 @@ else
|
||||
// For more information, see https://learn.microsoft.com/aspnet/core/blazor/forms/#mitigate-overposting-attacks.
|
||||
private async Task UpdateStudent()
|
||||
{
|
||||
if (Student.OfficerRole == 0)
|
||||
if (Student?.OfficerRole == 0)
|
||||
Student.OfficerRole = null;
|
||||
|
||||
Context.Attach(Student!).State = EntityState.Modified;
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@using Core.Validation
|
||||
@inject AppDbContext Context
|
||||
@inject ValidationService ValidationService
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Student Event Ranks - TSA Chapter Organizer</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3"><MudIcon Icon="@AppIcons.EventRank"></MudIcon> Student Event Ranks</MudText>
|
||||
<PageHeader
|
||||
Title="Student Event Ranks"
|
||||
Icon="@AppIcons.EventRank" />
|
||||
|
||||
@if (_students == null)
|
||||
{
|
||||
|
||||
@@ -2,23 +2,22 @@
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@using Core.Validation
|
||||
@inject AppDbContext Context
|
||||
@inject WebApp.LocalStorageService LocalStorage
|
||||
@inject ValidationService ValidationService
|
||||
|
||||
<PageTitle>Registration - TSA Chapter Organizer</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">Registration</MudText>
|
||||
|
||||
<MudButtonGroup>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.FilterAlt"
|
||||
Variant="@(_showRegionalOnly ? Variant.Filled : Variant.Outlined)"
|
||||
Color="Color.Primary"
|
||||
OnClick="ToggleRegionalFilter">
|
||||
@(_showRegionalOnly ? "Showing Regional Only" : "Show Regional Only")
|
||||
</MudButton>
|
||||
</MudButtonGroup>
|
||||
<PageHeader Title="Registration">
|
||||
<ActionButtons>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.FilterAlt"
|
||||
Variant="@(_showRegionalOnly ? Variant.Filled : Variant.Outlined)"
|
||||
Color="Color.Primary"
|
||||
OnClick="ToggleRegionalFilter">
|
||||
@(_showRegionalOnly ? "Showing Regional Only" : "Show Regional Only")
|
||||
</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<MudText Typo="Typo.body2" Style="margin-top: 8px; margin-bottom: 4px;">
|
||||
<MudIcon Icon="@AppIcons.Captain" Size="Size.Small" /> = Team Captain
|
||||
|
||||
@@ -4,20 +4,22 @@
|
||||
@using Core.Validation
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@using EventAssignment = Core.Calculation.EventAssignment
|
||||
@inject AppDbContext Context
|
||||
@inject IDialogService DialogService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ValidationService ValidationService
|
||||
|
||||
<PageTitle>Event Assignment - TSA Chapter Organizer</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">Assignment</MudText>
|
||||
|
||||
<MudGrid>
|
||||
<MudItem><MudText>Optimized team assignments based on the student event rankings</MudText></MudItem>
|
||||
<MudItem><MudButton StartIcon="@Icons.Material.Filled.Edit" Href="students/event-ranking">Edit Student Event Rankings</MudButton></MudItem>
|
||||
</MudGrid>
|
||||
<PageHeader
|
||||
Title="Assignment"
|
||||
Description="Optimized team assignments based on the student event rankings">
|
||||
<ActionButtons>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Edit" Href="students/event-ranking" Variant="Variant.Outlined">
|
||||
Edit Student Event Rankings
|
||||
</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<MudPaper Class="pa-4 mt-5">
|
||||
<MudGrid>
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
@page "/teams/create"
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext Context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Create Team - TSA Chapter Organizer</PageTitle>
|
||||
@if (_events is null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
return;
|
||||
}
|
||||
|
||||
<MudText Typo="Typo.h3">Create</MudText>
|
||||
<MudText Typo="Typo.h4">Team</MudText>
|
||||
<MudDivider />
|
||||
<PageHeader
|
||||
Title="Create"
|
||||
Subtitle="Team"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="/teams">
|
||||
<ActionButtons>
|
||||
<MudButton OnClick="AddTeam" Variant="Variant.Filled" Color="Color.Primary">Add</MudButton>
|
||||
<MudButton Href="/teams" Variant="Variant.Text">Cancel</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<EditForm method="post" Model="Team" OnValidSubmit="AddTeam" FormName="create" Enhance>
|
||||
<AntiforgeryToken />
|
||||
@@ -23,17 +35,18 @@
|
||||
<MudSelectItem T="EventDefinition" Value="@(evt)"></MudSelectItem>
|
||||
}
|
||||
</MudSelect>
|
||||
@if (_existingTeams?.Count == 1)
|
||||
@switch (_existingTeams?.Count)
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Class="my-2">
|
||||
A team for @Team.Event.Name already exists. This will be team 2, and the existing team will become team 1.
|
||||
</MudAlert>
|
||||
}
|
||||
else if (_existingTeams?.Count >= 2)
|
||||
{
|
||||
<MudAlert Severity="Severity.Error" Class="my-2">
|
||||
Two teams for @Team.Event.Name already exist. Cannot create a third team.
|
||||
</MudAlert>
|
||||
case 1:
|
||||
<MudAlert Severity="Severity.Info" Class="my-2">
|
||||
A team for @Team.Event.Name already exists. This will be team 2, and the existing team will become team 1.
|
||||
</MudAlert>
|
||||
break;
|
||||
case >= 2:
|
||||
<MudAlert Severity="Severity.Error" Class="my-2">
|
||||
Two teams for @Team.Event.Name already exist. Cannot create a third team.
|
||||
</MudAlert>
|
||||
break;
|
||||
}
|
||||
|
||||
<MudDivider Class="my-4" />
|
||||
@@ -55,8 +68,6 @@
|
||||
{
|
||||
<MudAlert Severity="Severity.Error" Class="mt-3">@_errorMessage</MudAlert>
|
||||
}
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="students">Back</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Add" OnClick="AddTeam">Add</MudButton>
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
@page "/teams/edit"
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject AppDbContext Context
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<PageTitle>Edit Team - TSA Chapter Organizer</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">Edit</MudText>
|
||||
<MudText Typo="Typo.h4">Team @(Team.ToString())</MudText>
|
||||
|
||||
@if (Team is null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
<EditForm method="post" Model="Team" OnValidSubmit="UpdateTeam" FormName="edit" Enhance>
|
||||
|
||||
<PageHeader Title="Edit Team"
|
||||
Subtitle=@Team.ToString()
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="/teams">
|
||||
<ActionButtons>
|
||||
<MudButton OnClick="UpdateTeam" Variant="Variant.Filled" Color="Color.Primary">Save</MudButton>
|
||||
<MudButton Href="/teams" Variant="Variant.Text">Cancel</MudButton>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<EditForm method="post" Model="Team" OnValidSubmit="UpdateTeam" FormName="edit" Enhance>
|
||||
<AntiforgeryToken />
|
||||
<DataAnnotationsValidator/>
|
||||
<MudGrid>
|
||||
@@ -33,10 +39,7 @@ else
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="teams">Back</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Save" OnClick="UpdateTeam">Save</MudButton>
|
||||
</EditForm>
|
||||
}
|
||||
</EditForm>
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
@@ -45,7 +48,7 @@ else
|
||||
[SupplyParameterFromForm]
|
||||
private Team? Team { get; set; }
|
||||
|
||||
private IEnumerable<Student> _selectedStudents = [];
|
||||
private IEnumerable<Student>? _selectedStudents = [];
|
||||
private List<Student> _students = [];
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -55,7 +58,7 @@ else
|
||||
.Include(e => e.Students)
|
||||
.FirstOrDefaultAsync(m => m.Id == Id);
|
||||
_students = await Context.Students.ToListAsync();
|
||||
_selectedStudents = Team.Students.ToList();
|
||||
_selectedStudents = Team?.Students.ToList();
|
||||
|
||||
if (Team is null)
|
||||
{
|
||||
@@ -68,6 +71,10 @@ else
|
||||
Team.Captain ??= Team.Students[0];
|
||||
Team.Identifier ??= Team.Captain.FirstName;
|
||||
break;
|
||||
case EventFormat.Team:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,14 +83,15 @@ else
|
||||
private async Task UpdateTeam()
|
||||
{
|
||||
//Context.Attach(Team!).Entity = EntityState.Modified;
|
||||
Team.Students.Clear();
|
||||
foreach (var s in _selectedStudents)
|
||||
{
|
||||
Team.Students.Add(s);
|
||||
}
|
||||
Team?.Students.Clear();
|
||||
if (_selectedStudents != null)
|
||||
foreach (var s in _selectedStudents)
|
||||
{
|
||||
Team?.Students.Add(s);
|
||||
}
|
||||
|
||||
// Update identifier for individual events
|
||||
if (Team.Event.EventFormat == EventFormat.Individual && Team.Students.Count == 1)
|
||||
if (Team is { Event.EventFormat: EventFormat.Individual, Students.Count: 1 })
|
||||
{
|
||||
Team.Captain ??= Team.Students[0];
|
||||
Team.Identifier = Team.Captain.FirstName;
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@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>
|
||||
<PageHeader
|
||||
Title="@($"{Configuration["ChapterSettings:Shortname"]} TSA Student Goals {Configuration["ChapterSettings:CompetitionYear"]}")"
|
||||
Description="Set Your Goals for Success" />
|
||||
|
||||
@if (_students == null)
|
||||
{
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject IConfiguration Configuration
|
||||
@inject AppDbContext Context
|
||||
|
||||
<PageTitle>@Configuration["ChapterSettings:Shortname"] TSA Teams @Configuration["ChapterSettings:CompetitionYear"]</PageTitle>
|
||||
<PageHeader
|
||||
Title="@($"{Configuration["ChapterSettings:Shortname"]} TSA Teams {Configuration["ChapterSettings:CompetitionYear"]}")"
|
||||
Description="Yearly theme: Unity Through Community" />
|
||||
|
||||
<MudText Typo="Typo.h3">@Configuration["ChapterSettings:Shortname"] TSA Teams @Configuration["ChapterSettings:CompetitionYear"]</MudText>
|
||||
<MudText Typo="Typo.h5" Class="mb-4">Yearly theme: Unity Through Community</MudText>
|
||||
|
||||
@if (_teams == null)
|
||||
@if (_teams == null || _students == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@inject IConfiguration Configuration
|
||||
@inject AppDbContext Context
|
||||
|
||||
<PageTitle>@Configuration["ChapterSettings:Shortname"] TSA Teams @Configuration["ChapterSettings:CompetitionYear"]</PageTitle>
|
||||
|
||||
<MudText Typo="Typo.h3">@Configuration["ChapterSettings:Shortname"] TSA Teams @Configuration["ChapterSettings:CompetitionYear"]</MudText>
|
||||
<MudText Typo="Typo.h5" Class="mb-4">Yearly theme: Unity Through Community</MudText>
|
||||
<PageHeader
|
||||
Title="@($"{Configuration["ChapterSettings:Shortname"]} TSA Teams {Configuration["ChapterSettings:CompetitionYear"]}")"
|
||||
Description="Yearly theme: Unity Through Community" />
|
||||
|
||||
<Legend></Legend>
|
||||
@if (_teams == null)
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
@attribute [Authorize(Roles = AuthRoles.Administrator)]
|
||||
@using WebApp.Authentication
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@using System.Text.Json
|
||||
@inject IWebHostEnvironment Environment
|
||||
@inject IConfiguration Configuration
|
||||
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Chapter Settings</PageTitle>
|
||||
<PageHeader
|
||||
Title="Chapter Settings"
|
||||
Description="Configure chapter information. Changes take effect on next application restart." />
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.Large" Class="mt-4">
|
||||
<MudText Typo="Typo.h3" Class="mb-4">Chapter Settings</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-6">Configure chapter information. Changes take effect on next application restart.</MudText>
|
||||
|
||||
@if (_settings != null)
|
||||
{
|
||||
|
||||
@@ -2,17 +2,18 @@
|
||||
@attribute [Authorize(Roles = AuthRoles.Administrator)]
|
||||
@using Core.Validation
|
||||
@using WebApp.Authentication
|
||||
@using WebApp.Components.Shared.Components
|
||||
@using System.Text.Json
|
||||
@inject IWebHostEnvironment Environment
|
||||
@inject IConfiguration Configuration
|
||||
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Validation Settings</PageTitle>
|
||||
<PageHeader
|
||||
Title="Validation Settings"
|
||||
Description="Configure validation rules and thresholds. Changes take effect on next application restart." />
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.Large" Class="mt-4">
|
||||
<MudText Typo="Typo.h3" Class="mb-4">Validation Settings</MudText>
|
||||
<MudText Typo="Typo.body1" Class="mb-6">Configure validation rules and thresholds. Changes take effect on next application restart.</MudText>
|
||||
|
||||
@if (_config != null)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
@* Description *@
|
||||
@if (!string.IsNullOrEmpty(Description))
|
||||
{
|
||||
<MudText Typo="Typo.body2" Color="Color.Secondary">@Description</MudText>
|
||||
<MudText Typo="Typo.body2">@Description</MudText>
|
||||
}
|
||||
|
||||
@* Custom Header Content *@
|
||||
|
||||
Reference in New Issue
Block a user