9668ec162d
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.
56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
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;
|
|
}
|
|
}
|