Files
chapter-organizer/WebApp/Components/Features/Teams/Details.razor
T
poprhythm 15d7edec8f Add Team Meeting History functionality with dialog and badge components
This commit introduces a new feature to display meeting history for teams. It adds a `TeamMeetingHistoryDialog` component that shows the meeting history in a dialog format, including a loading state and error handling. Additionally, a `TeamMeetingHistoryBadge` component is created to display the count of meetings for each team, enhancing the user interface with tooltips for better interaction. The `Details` and `Index` components are updated to integrate these new features, allowing users to view meeting history directly from the team details and index pages. These changes improve the overall functionality and user experience in managing team meetings.
2026-01-26 23:31:59 -05:00

119 lines
3.8 KiB
Plaintext

@page "/teams/details"
@attribute [Authorize]
@using Microsoft.EntityFrameworkCore
@using WebApp.Components.Shared.Components
@using WebApp.Components.Features.Teams.Components
@using MudBlazor
@inject AppDbContext Context
@inject NavigationManager NavigationManager
@inject IJSRuntime JSRuntime
@inject IDialogService DialogService
@if (Team is null)
{
<p><em>Loading...</em></p>
return;
}
<PageHeader
Title="Team Details"
ShowBackButton="true"
BackButtonUrl="@(ReturnUrl ?? "/teams")">
<ActionButtons>
<div class="no-print">
<MudTooltip Text="Print">
<MudButton StartIcon="@Icons.Material.Filled.Print"
OnClick="PrintPage"
Variant="Variant.Outlined">Print</MudButton>
</MudTooltip>
<MudTooltip Text="Edit">
<MudButton StartIcon="@Icons.Material.Filled.Edit"
Href="@($"/teams/edit?id={Team.Id}&returnUrl={ReturnUrl ?? "/teams"}")"
Variant="Variant.Outlined">Edit</MudButton>
</MudTooltip>
<MudTooltip Text="View Meeting History">
<MudButton StartIcon="@Icons.Material.Filled.History"
OnClick="ShowMeetingHistory"
Variant="Variant.Outlined">Meeting History</MudButton>
</MudTooltip>
</div>
</ActionButtons>
</PageHeader>
<MudPaper Elevation="2" Class="pa-3 pa-md-6">
<MudText Typo="Typo.h5" Class="mb-4">Team Information</MudText>
<MudGrid Spacing="3">
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Event</MudText>
<MudText Typo="Typo.body1">@Team.Event.Name</MudText>
</MudItem>
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Event Format</MudText>
<MudText Typo="Typo.body1">@Team.Event.EventFormat</MudText>
</MudItem>
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Team Identifier</MudText>
<MudText Typo="Typo.body1">@(Team.Identifier ?? "N/A")</MudText>
</MudItem>
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Captain</MudText>
<MudText Typo="Typo.body1">@(Team.Captain?.FirstNameLastName ?? "N/A")</MudText>
</MudItem>
<MudItem xs="12">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Team Members</MudText>
<TeamStudents Team="@Team" />
</MudItem>
</MudGrid>
</MudPaper>
@code {
[SupplyParameterFromQuery]
private int Id { get; set; }
[SupplyParameterFromQuery]
private string? ReturnUrl { 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");
}
private async Task ShowMeetingHistory()
{
if (Team == null) return;
var teamName = Team.ToString();
var parameters = new DialogParameters
{
["TeamId"] = Team.Id,
["TeamName"] = teamName
};
var options = new DialogOptions
{
CloseOnEscapeKey = true,
CloseButton = true,
MaxWidth = MaxWidth.Medium,
FullWidth = true
};
await DialogService.ShowAsync<TeamMeetingHistoryDialog>($"{teamName} Meeting History", parameters, options);
}
}