15d7edec8f
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.
128 lines
3.7 KiB
Plaintext
128 lines
3.7 KiB
Plaintext
@namespace WebApp.Components.Features.Teams
|
|
@using Core.Entities
|
|
@using WebApp.Services
|
|
@using Microsoft.AspNetCore.Components
|
|
@inject ITeamMeetingHistoryService TeamMeetingHistoryService
|
|
@implements IAsyncDisposable
|
|
|
|
<MudDialog>
|
|
<TitleContent>
|
|
<MudText Typo="Typo.h6">@TeamName Meeting History</MudText>
|
|
</TitleContent>
|
|
<DialogContent>
|
|
@if (_isLoading)
|
|
{
|
|
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-4" />
|
|
}
|
|
else if (!_meetingHistories.Any())
|
|
{
|
|
<MudAlert Severity="Severity.Info">No meeting history found for this team.</MudAlert>
|
|
}
|
|
else
|
|
{
|
|
<MudTable Items="_meetingHistories" Hover="true" Dense="true">
|
|
<HeaderContent>
|
|
<MudTh>Date</MudTh>
|
|
<MudTh>Status</MudTh>
|
|
</HeaderContent>
|
|
<RowTemplate>
|
|
@{
|
|
var teamWasInMeeting = context.Teams.Any(t => t.Id == TeamId);
|
|
}
|
|
<MudTd>@context.MeetingDate.ToString("MM/dd/yyyy")</MudTd>
|
|
<MudTd>
|
|
<MudChip T="string" Size="Size.Small"
|
|
Color="@(teamWasInMeeting ? Color.Success : Color.Default)"
|
|
Variant="Variant.Text">
|
|
@(teamWasInMeeting ? "Team Met" : "Team Not Scheduled")
|
|
</MudChip>
|
|
</MudTd>
|
|
</RowTemplate>
|
|
</MudTable>
|
|
}
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<MudSpacer />
|
|
<MudButton OnClick="Close">Close</MudButton>
|
|
</DialogActions>
|
|
</MudDialog>
|
|
|
|
@code {
|
|
[CascadingParameter]
|
|
IMudDialogInstance MudDialog { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public int TeamId { get; set; }
|
|
|
|
[Parameter]
|
|
public string TeamName { get; set; } = string.Empty;
|
|
|
|
private List<TeamMeetingHistory> _meetingHistories = [];
|
|
private bool _isLoading = true;
|
|
private CancellationTokenSource? _cancellationTokenSource;
|
|
private bool _isDisposed = false;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_cancellationTokenSource = new CancellationTokenSource();
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await LoadMeetingHistories();
|
|
}
|
|
|
|
private async Task LoadMeetingHistories()
|
|
{
|
|
if (_isDisposed) return;
|
|
|
|
try
|
|
{
|
|
var cancellationToken = _cancellationTokenSource?.Token ?? CancellationToken.None;
|
|
var histories = await TeamMeetingHistoryService.GetMeetingHistoriesForTeamAsync(TeamId);
|
|
_meetingHistories = histories.ToList();
|
|
}
|
|
catch (TaskCanceledException)
|
|
{
|
|
// Component was disposed, ignore
|
|
}
|
|
catch (JSDisconnectedException)
|
|
{
|
|
// JS connection lost, ignore
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
if (!_isDisposed)
|
|
{
|
|
System.Diagnostics.Debug.WriteLine($"Error loading meeting histories: {ex.Message}");
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if (!_isDisposed)
|
|
{
|
|
_isLoading = false;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Close()
|
|
{
|
|
if (_isDisposed) return;
|
|
MudDialog.Close();
|
|
}
|
|
|
|
public async ValueTask DisposeAsync()
|
|
{
|
|
if (!_isDisposed)
|
|
{
|
|
_isDisposed = true;
|
|
_cancellationTokenSource?.Cancel();
|
|
_cancellationTokenSource?.Dispose();
|
|
_cancellationTokenSource = null;
|
|
}
|
|
await ValueTask.CompletedTask;
|
|
}
|
|
}
|