Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
432caa0fe8 | ||
|
|
8d7c6b103c | ||
|
|
5d2d019e87 | ||
|
|
ea1bb70740 |
@@ -1 +1,72 @@
|
|||||||
|
@namespace WebApp.Components.Features.Calendar
|
||||||
|
@using Core.Entities
|
||||||
|
|
||||||
|
<MudDialog>
|
||||||
|
<DialogContent>
|
||||||
|
@if (EventOccurrence == null)
|
||||||
|
{
|
||||||
|
<MudAlert Severity="Severity.Warning">
|
||||||
|
Event details are unavailable.
|
||||||
|
</MudAlert>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudStack Spacing="2">
|
||||||
|
<MudText Typo="Typo.h6">
|
||||||
|
@(EventDefinition?.Name ?? EventOccurrence.Name)
|
||||||
|
</MudText>
|
||||||
|
|
||||||
|
<MudDivider />
|
||||||
|
|
||||||
|
<MudText Typo="Typo.body1">
|
||||||
|
<strong>Occurrence:</strong> @EventOccurrence.Name
|
||||||
|
</MudText>
|
||||||
|
<MudText Typo="Typo.body1">
|
||||||
|
<strong>Start:</strong> @EventOccurrence.StartTime.ToString("f")
|
||||||
|
</MudText>
|
||||||
|
@if (EventOccurrence.EndTime != null)
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body1">
|
||||||
|
<strong>End:</strong> @EventOccurrence.EndTime.Value.ToString("f")
|
||||||
|
</MudText>
|
||||||
|
}
|
||||||
|
@if (!string.IsNullOrWhiteSpace(EventOccurrence.Location))
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body1">
|
||||||
|
<strong>Location:</strong> @EventOccurrence.Location
|
||||||
|
</MudText>
|
||||||
|
}
|
||||||
|
@if (StudentFirstNames.Any())
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body1">
|
||||||
|
<strong>Students:</strong> @string.Join(", ", StudentFirstNames)
|
||||||
|
</MudText>
|
||||||
|
}
|
||||||
|
</MudStack>
|
||||||
|
}
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<MudSpacer />
|
||||||
|
<MudButton OnClick="Close">Close</MudButton>
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[CascadingParameter]
|
||||||
|
public IMudDialogInstance MudDialog { get; set; } = null!;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventOccurrence? EventOccurrence { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public EventDefinition? EventDefinition { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public List<string> StudentFirstNames { get; set; } = [];
|
||||||
|
|
||||||
|
private void Close()
|
||||||
|
{
|
||||||
|
MudDialog.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,12 +106,15 @@ else
|
|||||||
|
|
||||||
<MudContainer Class="pagebreak">
|
<MudContainer Class="pagebreak">
|
||||||
<MudText Typo="Typo.h5" Class="mb-2">Combined schedule</MudText>
|
<MudText Typo="Typo.h5" Class="mb-2">Combined schedule</MudText>
|
||||||
<MudText Typo="Typo.body2" Class="mud-text-secondary mb-3">All imported occurrences for this chapter database.</MudText>
|
<MudText Typo="Typo.body2" Class="mud-text-secondary mb-3">Imported occurrences relevant to this chapter.</MudText>
|
||||||
@if (_allOccurrences.Count == 0)
|
@{
|
||||||
{
|
var combinedOccurrences = GetCombinedScheduleOccurrences().ToList();
|
||||||
<MudText Class="mud-text-secondary">No event occurrences in the database. Import a schedule from the calendar first.</MudText>
|
|
||||||
}
|
}
|
||||||
@foreach (var dateGroup in _allOccurrences.GroupBy(o => o.StartTime.Date))
|
@if (combinedOccurrences.Count == 0)
|
||||||
|
{
|
||||||
|
<MudText Class="mud-text-secondary">No relevant event occurrences found for your current team registrations.</MudText>
|
||||||
|
}
|
||||||
|
@foreach (var dateGroup in combinedOccurrences.GroupBy(o => o.StartTime.Date))
|
||||||
{
|
{
|
||||||
<MudText Typo="Typo.subtitle2" Class="mt-2 mb-1">@FormatDateHeading(dateGroup.Key)</MudText>
|
<MudText Typo="Typo.subtitle2" Class="mt-2 mb-1">@FormatDateHeading(dateGroup.Key)</MudText>
|
||||||
<MudSimpleTable Dense="true" Class="state-schedule-table mb-3">
|
<MudSimpleTable Dense="true" Class="state-schedule-table mb-3">
|
||||||
@@ -123,14 +126,60 @@ else
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var occ in dateGroup.OrderBy(o => o.StartTime))
|
@foreach (var tlGroup in dateGroup
|
||||||
|
.OrderBy(o => o.StartTime)
|
||||||
|
.GroupBy(o => (FormatTimeDisplay(o), o.Location ?? ""))
|
||||||
|
.Select(g => g.ToList()))
|
||||||
{
|
{
|
||||||
|
if (tlGroup.Count == 1)
|
||||||
|
{
|
||||||
|
var occ = tlGroup[0];
|
||||||
<tr>
|
<tr>
|
||||||
<td>@FormatTimeDisplay(occ)</td>
|
<td>@FormatTimeDisplay(occ)</td>
|
||||||
<td>@FormatCombinedScheduleEventCell(occ)</td>
|
<td>@FormatCombinedScheduleEventCell(occ)</td>
|
||||||
<td>@(occ.Location ?? "")</td>
|
<td>@(occ.Location ?? "")</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var genericOcc = tlGroup.FirstOrDefault(o => !o.EventDefinitionId.HasValue);
|
||||||
|
var specificOccs = tlGroup
|
||||||
|
.Where(o => o.EventDefinitionId.HasValue)
|
||||||
|
.OrderBy(o => FormatEventColumn(o), StringComparer.OrdinalIgnoreCase)
|
||||||
|
.ToList();
|
||||||
|
var rowCount = (genericOcc != null ? 1 : 0) + specificOccs.Count;
|
||||||
|
var representative = genericOcc ?? specificOccs[0];
|
||||||
|
|
||||||
|
if (genericOcc != null)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td rowspan="@rowCount">@FormatTimeDisplay(representative)</td>
|
||||||
|
<td>@FormatCombinedScheduleEventCell(genericOcc)</td>
|
||||||
|
<td rowspan="@rowCount">@(representative.Location ?? "")</td>
|
||||||
|
</tr>
|
||||||
|
@foreach (var sub in specificOccs)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td class="combined-sub-event">@FormatCombinedScheduleEventCell(sub)</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td rowspan="@rowCount">@FormatTimeDisplay(representative)</td>
|
||||||
|
<td class="combined-sub-event">@FormatCombinedScheduleEventCell(specificOccs[0])</td>
|
||||||
|
<td rowspan="@rowCount">@(representative.Location ?? "")</td>
|
||||||
|
</tr>
|
||||||
|
@foreach (var sub in specificOccs.Skip(1))
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td class="combined-sub-event">@FormatCombinedScheduleEventCell(sub)</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</MudSimpleTable>
|
</MudSimpleTable>
|
||||||
}
|
}
|
||||||
@@ -196,6 +245,21 @@ else
|
|||||||
.DistinctBy(o => (o.StartTime, o.Name ?? ""));
|
.DistinctBy(o => (o.StartTime, o.Name ?? ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerable<EventOccurrence> GetCombinedScheduleOccurrences()
|
||||||
|
{
|
||||||
|
return _allOccurrences!
|
||||||
|
.Where(o =>
|
||||||
|
{
|
||||||
|
// Keep chapter-wide/special schedule rows.
|
||||||
|
if (!o.EventDefinitionId.HasValue)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Keep only competition events where this chapter has registered teams.
|
||||||
|
return _teamsByEventDefinitionId.TryGetValue(o.EventDefinitionId.Value, out var teams) && teams.Count > 0;
|
||||||
|
})
|
||||||
|
.OrderBy(o => o.StartTime);
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<EventSummaryRow> GetEventSummaryRows(Student student)
|
private IEnumerable<EventSummaryRow> GetEventSummaryRows(Student student)
|
||||||
{
|
{
|
||||||
foreach (var team in student.Teams.OrderBy(t => t.Event.Name))
|
foreach (var team in student.Teams.OrderBy(t => t.Event.Name))
|
||||||
|
|||||||
@@ -41,9 +41,8 @@ else
|
|||||||
@{
|
@{
|
||||||
var students
|
var students
|
||||||
= context.Students
|
= context.Students
|
||||||
.OrderByDescending(s => s == context.Captain)
|
.OrderByDescending(s => context.Captain != null && context.Captain.Equals(s))
|
||||||
.ThenBy(s => s.EventRankings.Find(e => e.EventDefinition == context.Event)?.Rank ?? int.MaxValue)
|
.ThenByDescending(e => e.Grade + e.TsaYear)
|
||||||
.ThenByDescending(e => e.Grade)
|
|
||||||
.ThenBy(e => e.FirstName)
|
.ThenBy(e => e.FirstName)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
@@ -233,6 +232,7 @@ else
|
|||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.Include(e => e.Event)
|
.Include(e => e.Event)
|
||||||
.Include(e => e.Students)
|
.Include(e => e.Students)
|
||||||
|
.Include(e => e.Captain)
|
||||||
.OrderByEventFormatFirst()
|
.OrderByEventFormatFirst()
|
||||||
.ThenBy(e => e.Event.Name)
|
.ThenBy(e => e.Event.Name)
|
||||||
.ThenBy(e => e.Identifier ?? "")
|
.ThenBy(e => e.Identifier ?? "")
|
||||||
|
|||||||
@@ -52,6 +52,17 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.state-schedule-table th,
|
||||||
|
.state-schedule-table td,
|
||||||
|
.state-schedule-table table th,
|
||||||
|
.state-schedule-table table td {
|
||||||
|
vertical-align: top !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combined-sub-event {
|
||||||
|
padding-left: 1.5rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
.state-schedule-handout {
|
.state-schedule-handout {
|
||||||
margin-left: -30pt !important;
|
margin-left: -30pt !important;
|
||||||
@@ -100,6 +111,11 @@
|
|||||||
.state-schedule-table table tbody tr:last-child td {
|
.state-schedule-table table tbody tr:last-child td {
|
||||||
border-bottom: none !important;
|
border-bottom: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.state-schedule-table .combined-sub-event,
|
||||||
|
.state-schedule-table table .combined-sub-event {
|
||||||
|
padding-left: 1.5rem !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
|
|||||||
Reference in New Issue
Block a user