Enhance TeamMeetingHistoryDialog to display team members' attendance
This commit updates the TeamMeetingHistoryDialog component to show the attendance status of team members during meetings. It replaces the previous status display with a list of team members, indicating their presence or absence using MudBlazor chips. Additionally, the TeamMeetingHistoryService is modified to include student data for accurate attendance tracking. These changes improve the clarity and usability of the meeting history dialog, enhancing the overall user experience in managing team meetings.
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
@using Core.Entities
|
||||
@using WebApp.Services
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@using WebApp.Models
|
||||
@using WebApp.Components.Shared.Components
|
||||
@using Core.Utility
|
||||
@inject ITeamMeetingHistoryService TeamMeetingHistoryService
|
||||
@implements IAsyncDisposable
|
||||
|
||||
@@ -23,19 +26,40 @@
|
||||
<MudTable Items="_meetingHistories" Hover="true" Dense="true">
|
||||
<HeaderContent>
|
||||
<MudTh>Date</MudTh>
|
||||
<MudTh>Status</MudTh>
|
||||
<MudTh>Team Members</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
@{
|
||||
var teamWasInMeeting = context.Teams.Any(t => t.Id == TeamId);
|
||||
var team = context.Teams.FirstOrDefault(t => t.Id == TeamId);
|
||||
var presentStudentIds = context.Students.Select(s => s.Id).ToHashSet();
|
||||
var absentStudents = team?.Students.Where(s => !presentStudentIds.Contains(s.Id)).ToList() ?? [];
|
||||
}
|
||||
<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")
|
||||
@if (team != null)
|
||||
{
|
||||
<MudStack Row="true" Spacing="1" Wrap="Wrap.Wrap" AlignItems="AlignItems.Center">
|
||||
@foreach (var student in team.Students)
|
||||
{
|
||||
var isAbsent = absentStudents.Contains(student);
|
||||
var formattedName = TeamStudentNameFormatter.FormatStudentName(
|
||||
student,
|
||||
team,
|
||||
new TeamStudentNameFormatter.FormatOptions
|
||||
{
|
||||
MarkAbsent = true,
|
||||
AbsentStudents = absentStudents
|
||||
});
|
||||
<MudChip T="string"
|
||||
Size="Size.Small"
|
||||
Color="Color.Default"
|
||||
Variant="@AppIcons.StudentChipVariant()"
|
||||
Style="@(isAbsent ? "opacity: 0.5;" : "")">
|
||||
<span>@formattedName</span>
|
||||
</MudChip>
|
||||
}
|
||||
</MudStack>
|
||||
}
|
||||
</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
|
||||
@@ -209,6 +209,8 @@ public class TeamMeetingHistoryService : ITeamMeetingHistoryService
|
||||
.AsNoTracking()
|
||||
.Include(tmh => tmh.Teams)
|
||||
.ThenInclude(t => t.Event)
|
||||
.Include(tmh => tmh.Teams)
|
||||
.ThenInclude(t => t.Students)
|
||||
.Include(tmh => tmh.Students)
|
||||
.Where(tmh => tmh.Teams.Any(t => t.Id == teamId))
|
||||
.OrderByDescending(tmh => tmh.MeetingDate)
|
||||
|
||||
Reference in New Issue
Block a user