From 1e6d1d5f5bd3f752cae1bbc82879dc44f93348e9 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 17 Dec 2025 14:37:11 +0000 Subject: [PATCH] Add calendar and list view toggle buttons with dynamic content loading --- .../templates/rota/leaves_global.html | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/djangorota/djangorota/templates/rota/leaves_global.html b/djangorota/djangorota/templates/rota/leaves_global.html index d9b5736..3aed7e0 100644 --- a/djangorota/djangorota/templates/rota/leaves_global.html +++ b/djangorota/djangorota/templates/rota/leaves_global.html @@ -11,7 +11,15 @@ {# Rota selection is handled by route scoping; no dropdown needed here #} +
+
+ + +
+
+
+

View all leave requests across workers. Choose a rota to scope the calendar, or select "All rotas" to see everything. Click and drag to select dates to open the leave form (you'll need to choose workers in the modal).

@@ -55,6 +63,8 @@ const sel = document.getElementById('selected_rota_json'); if(sel) initialRota = JSON.parse(sel.textContent || sel.innerText || 'null'); }catch(e){ initialRota = null; } + // expose initial rota id so other scripts (list view) can access it + window._initialRota = initialRota; window.initCalendar('calendar', { leaves: leaves, leavesUrl: leavesUrlBase, rotaId: initialRota, requestUrl: '{% url "rota:request_leave" %}', mode: container.dataset.mode || 'inline' }); function refreshLegendFor(id){ const globalLegendContent = document.getElementById('global-legend-content'); @@ -86,5 +96,106 @@ })(); + + {# Consolidated legend above replaces the separate 'Workers on this rota' box #} {% endblock %}