Add Event Calendar feature with event occurrences service integration

Introduced a new Event Calendar component that displays scheduled events using the Heron.MudCalendar. Implemented IEventOccurrenceService to fetch event occurrences, and added mock data for initial testing. Updated navigation menu to include a link to the Event Calendar.
This commit is contained in:
2025-12-27 13:25:17 -05:00
parent 5c1e0b7444
commit 9668ec162d
8 changed files with 231 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
using Heron.MudCalendar;
using MudBlazor;
namespace WebApp.Models;
/// <summary>
/// Calendar event item model for Heron.MudCalendar component.
/// Maps from EventOccurrence entity to calendar event format.
/// </summary>
public class CalendarEventItem : CalendarItem
{
/// <summary>
/// Gets the original EventOccurrence data.
/// </summary>
public Core.Entities.EventOccurrence? EventOccurrenceData { get; set; }
/// <summary>
/// Gets the associated EventDefinition if available.
/// </summary>
public Core.Entities.EventDefinition? EventDefinition { get; set; }
/// <summary>
/// Parameterless constructor required by Heron.MudCalendar component.
/// </summary>
public CalendarEventItem()
{
}
public CalendarEventItem(Core.Entities.EventOccurrence occurrence, Core.Entities.EventDefinition? eventDefinition = null)
{
// Set base class properties that the calendar component uses
Text = GetEventTitle(occurrence, eventDefinition);
Start = occurrence.StartTime;
End = occurrence.EndTime ?? occurrence.StartTime.AddHours(1);
this.EventOccurrenceData = occurrence;
this.EventDefinition = eventDefinition;
}
private static string GetEventTitle(Core.Entities.EventOccurrence occurrence, Core.Entities.EventDefinition? eventDefinition)
{
var title = occurrence.Name;
if (eventDefinition != null && !string.IsNullOrEmpty(eventDefinition.Name))
{
title = $"{eventDefinition.Name} - {title}";
}
if (!string.IsNullOrEmpty(occurrence.Location))
{
title += $" ({occurrence.Location})";
}
return title;
}
}