Moved crud operations to the title field
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
@page "/teams/details"
|
||||
@attribute [Authorize]
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using WebApp.Components.Shared.Components
|
||||
@using WebApp.Components.Features.Teams.Components
|
||||
@inject AppDbContext Context
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
@if (Team is null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
return;
|
||||
}
|
||||
|
||||
<PageHeader
|
||||
Title="Team Details"
|
||||
ShowBackButton="true"
|
||||
BackButtonUrl="/teams">
|
||||
<ActionButtons>
|
||||
<div class="no-print">
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Print"
|
||||
OnClick="PrintPage"
|
||||
Variant="Variant.Outlined">Print</MudButton>
|
||||
<MudButton StartIcon="@Icons.Material.Filled.Edit"
|
||||
Href="@($"/teams/edit?id={Team.Id}")"
|
||||
Variant="Variant.Outlined">Edit</MudButton>
|
||||
<MudButton Href="/teams" Variant="Variant.Text">Back to List</MudButton>
|
||||
</div>
|
||||
</ActionButtons>
|
||||
</PageHeader>
|
||||
|
||||
<MudPaper Class="pa-4">
|
||||
<MudGrid>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">Event</MudText>
|
||||
<MudText Typo="Typo.body1">@Team.Event.Name</MudText>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">Event Format</MudText>
|
||||
<MudText Typo="Typo.body1">@Team.Event.EventFormat</MudText>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">Team Identifier</MudText>
|
||||
<MudText Typo="Typo.body1">@(Team.Identifier ?? "N/A")</MudText>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6">
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">Captain</MudText>
|
||||
<MudText Typo="Typo.body1">@(Team.Captain?.FirstNameLastName ?? "N/A")</MudText>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Secondary">Team Members</MudText>
|
||||
<TeamStudents Team="@Team" />
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
private int Id { get; set; }
|
||||
|
||||
private Team? Team { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Team = await Context.Teams
|
||||
.Include(t => t.Event)
|
||||
.Include(t => t.Students)
|
||||
.Include(t => t.Captain)
|
||||
.FirstOrDefaultAsync(m => m.Id == Id);
|
||||
|
||||
if (Team is null)
|
||||
{
|
||||
NavigationManager.NavigateTo("notfound");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PrintPage()
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("window.print");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user