diff --git a/PC2/Views/Events/Index.cshtml b/PC2/Views/Events/Index.cshtml index 43a1f17..d970884 100644 --- a/PC2/Views/Events/Index.cshtml +++ b/PC2/Views/Events/Index.cshtml @@ -1,4 +1,4 @@ -@model PC2.Models.EventsModel +@model PC2.Models.EventsModel @{ ViewData["Title"] = "Event Calendar"; @@ -25,10 +25,12 @@ .pc2-event { background-color: #d1e7dd !important; /* Light green */ + color: #212529 !important; } .county-event { background-color: #f8d7da !important; /* Light red */ + color: #212529 !important; } .legend { @@ -47,7 +49,7 @@ margin-right: 10px; } - /* CSS to word break on multiple lines in the event modal dialog */ + /* CSS to word break on multiple lines in the event modal dialog */ #modalEventTitle { overflow-wrap: anywhere; } @@ -75,94 +77,119 @@ - - - - + + + }, + eventClick: function(info) { + var startTime = info.event.start.toLocaleString(); + var endTime = info.event.end ? info.event.end.toLocaleString() : 'N/A'; + + document.getElementById('modalEventTitle').innerHTML = info.event.title; + document.getElementById('modalEventDate').innerText = startTime; + document.getElementById('modalEventEndTime').innerText = endTime; + + new bootstrap.Modal(document.getElementById('eventModal')).show(); + }, + validRange: function(currentDate) { + // Today's date + const start = new Date(currentDate); + + // Sets end to 1 year in future based on today's date + const end = new Date(currentDate); + end.setMonth(end.getMonth() + 12); + + return { start, end }; + }, + eventDidMount: function(info) { + // Render HTML in event titles instead of escaped text. + // List view: write to the directly to avoid nesting inside FullCalendar's own . + // Other views: write to the .fc-event-title element. + const titleEl = info.view.type === 'listMonth' + ? info.el.querySelector('.fc-list-event-title') + : info.el.querySelector('.fc-event-title'); + + if (titleEl) { + titleEl.innerHTML = info.event.title; + // Prevent inner link navigation so clicks bubble to eventClick and open the modal + titleEl.querySelectorAll('a').forEach(function(a) { + a.addEventListener('click', function(e) { + e.preventDefault(); + }); + }); + } + + // Add a Bootstrap tooltip on month view events so the full text is visible on hover + if (info.view.type === 'dayGridMonth') { + const tempDiv = document.createElement('div'); + tempDiv.innerHTML = info.event.title; + const plainText = tempDiv.textContent || tempDiv.innerText || ''; + new bootstrap.Tooltip(info.el, { + title: plainText, + placement: 'top', + trigger: 'hover', + container: 'body' + }); + } + }, + noEventsText: 'No events this month' + }); + calendar.render(); + }); + +}
-
+
-
-
-
- PC2 Event -
-
-
- County Event -
+
+
+
+
+ PC2 Event +
+
+
+ County Event
-
\ No newline at end of file +