From 86f1dc65f4aba42310e5cc87172302489aea37ab Mon Sep 17 00:00:00 2001
From: James Pattinson
Date: Wed, 10 Dec 2025 11:25:33 +0000
Subject: [PATCH] Public display improvements WIP
---
backend/app/crud/crud_ppr.py | 8 ++-
web/admin.html | 46 ++++++++++++++
web/index.html | 116 +++++++++++++++++++++++++----------
3 files changed, 137 insertions(+), 33 deletions(-)
diff --git a/backend/app/crud/crud_ppr.py b/backend/app/crud/crud_ppr.py
index f1f2f3a..86ccbcd 100644
--- a/backend/app/crud/crud_ppr.py
+++ b/backend/app/crud/crud_ppr.py
@@ -55,7 +55,8 @@ class CRUDPPR:
func.date(PPRRecord.eta) == today,
or_(
PPRRecord.status == PPRStatus.NEW,
- PPRRecord.status == PPRStatus.CONFIRMED
+ PPRRecord.status == PPRStatus.CONFIRMED,
+ PPRRecord.status == PPRStatus.LANDED
)
)
).order_by(PPRRecord.eta).all()
@@ -66,7 +67,10 @@ class CRUDPPR:
return db.query(PPRRecord).filter(
and_(
func.date(PPRRecord.etd) == today,
- PPRRecord.status == PPRStatus.LANDED
+ or_(
+ PPRRecord.status == PPRStatus.LANDED,
+ PPRRecord.status == PPRStatus.DEPARTED
+ )
)
).order_by(PPRRecord.etd).all()
diff --git a/web/admin.html b/web/admin.html
index 1547a73..3cc7f1d 100644
--- a/web/admin.html
+++ b/web/admin.html
@@ -25,6 +25,8 @@
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+ position: relative;
+ z-index: 100;
}
.title h1 {
@@ -541,11 +543,13 @@
transform: translateY(-20px);
transition: all 0.3s ease;
font-weight: 500;
+ pointer-events: none;
}
.notification.show {
opacity: 1;
transform: translateY(0);
+ pointer-events: auto;
}
.notification.error {
@@ -932,6 +936,7 @@
let lastHeartbeatResponse = null;
let sessionExpiryWarningShown = false;
let sessionExpiryCheckInterval = null;
+ let etdManuallyEdited = false; // Track if user has manually edited ETD
// WebSocket connection for real-time updates
function connectWebSocket() {
@@ -1542,6 +1547,7 @@
function openNewPPRModal() {
isNewPPR = true;
currentPPRId = null;
+ etdManuallyEdited = false; // Reset the manual edit flag for new PPR
document.getElementById('modal-title').textContent = 'New PPR Entry';
document.getElementById('delete-btn').style.display = 'none';
document.getElementById('journal-section').style.display = 'none';
@@ -1588,6 +1594,38 @@
}, 100);
}
+ // Function to update ETD based on ETA (2 hours later)
+ function updateETDFromETA() {
+ // Only auto-update if user hasn't manually edited ETD
+ if (etdManuallyEdited) {
+ return;
+ }
+
+ const etaDate = document.getElementById('eta-date').value;
+ const etaTime = document.getElementById('eta-time').value;
+
+ if (etaDate && etaTime) {
+ // Parse ETA
+ const eta = new Date(`${etaDate}T${etaTime}`);
+
+ // Calculate ETD (2 hours after ETA)
+ const etd = new Date(eta.getTime() + 2 * 60 * 60 * 1000);
+
+ // Format ETD
+ const etdDateStr = `${etd.getFullYear()}-${String(etd.getMonth() + 1).padStart(2, '0')}-${String(etd.getDate()).padStart(2, '0')}`;
+ const etdTimeStr = `${String(etd.getHours()).padStart(2, '0')}:${String(etd.getMinutes()).padStart(2, '0')}`;
+
+ // Update ETD fields
+ document.getElementById('etd-date').value = etdDateStr;
+ document.getElementById('etd-time').value = etdTimeStr;
+ }
+ }
+
+ // Function to mark ETD as manually edited
+ function markETDAsManuallyEdited() {
+ etdManuallyEdited = true;
+ }
+
async function openPPRModal(pprId) {
if (!accessToken) return;
@@ -2509,6 +2547,14 @@
setupKeyboardShortcuts();
initializeTimeDropdowns(); // Initialize time dropdowns
initializeAuth(); // Start authentication process
+
+ // Add event listeners to ETA fields to auto-update ETD
+ document.getElementById('eta-date').addEventListener('change', updateETDFromETA);
+ document.getElementById('eta-time').addEventListener('change', updateETDFromETA);
+
+ // Add event listeners to ETD fields to mark as manually edited
+ document.getElementById('etd-date').addEventListener('change', markETDAsManuallyEdited);
+ document.getElementById('etd-time').addEventListener('change', markETDAsManuallyEdited);
});
- Arrivals/Departures Information
+ Flight Information
@@ -145,15 +148,14 @@
- | Registration |
- Aircraft Type |
- From |
- Due |
+ Aircraft |
+ From |
+ Due |
- | Loading arrivals... |
+ Loading arrivals... |
@@ -165,15 +167,14 @@
- | Registration |
- Aircraft Type |
- To |
- Due |
+ Aircraft |
+ To |
+ Due |
- | Loading departures... |
+ Loading departures... |
@@ -191,6 +192,27 @@