Info display tweaks
This commit is contained in:
@@ -564,7 +564,7 @@
|
||||
</div>
|
||||
<div class="menu-buttons">
|
||||
<button class="btn btn-success" onclick="openNewPPRModal()">
|
||||
➕ New PPR Entry
|
||||
➕ New PPR
|
||||
</button>
|
||||
<button class="btn btn-primary" onclick="window.open('reports.html', '_blank')">
|
||||
📊 Reports
|
||||
@@ -587,7 +587,7 @@
|
||||
<!-- Arrivals Table -->
|
||||
<div class="ppr-table">
|
||||
<div class="table-header">
|
||||
🛬 Today's Arrivals - <span id="arrivals-count">0</span> entries
|
||||
🛬 Pending Arrivals - <span id="arrivals-count">0</span>
|
||||
</div>
|
||||
|
||||
<div id="arrivals-loading" class="loading">
|
||||
@@ -614,15 +614,14 @@
|
||||
</div>
|
||||
|
||||
<div id="arrivals-no-data" class="no-data" style="display: none;">
|
||||
<h3>No arrivals for today</h3>
|
||||
<p>No NEW or CONFIRMED arrivals scheduled for today.</p>
|
||||
<h3>No Pending Arrivals</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Departures Table -->
|
||||
<div class="ppr-table" style="margin-top: 2rem;">
|
||||
<div class="table-header">
|
||||
🛫 Today's Departures - <span id="departures-count">0</span> entries
|
||||
🛫 Pending Departures - <span id="departures-count">0</span>
|
||||
</div>
|
||||
|
||||
<div id="departures-loading" class="loading">
|
||||
@@ -650,7 +649,7 @@
|
||||
</div>
|
||||
|
||||
<div id="departures-no-data" class="no-data" style="display: none;">
|
||||
<h3>No departures for today</h3>
|
||||
<h3>No Pending Departures</h3>
|
||||
<p>No aircraft currently landed and ready to depart.</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1324,22 +1323,26 @@
|
||||
document.getElementById('arrivals-no-data').style.display = 'none';
|
||||
|
||||
try {
|
||||
// Always load today's date
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
let url = `/api/v1/pprs/?limit=1000&date_from=${today}&date_to=${today}`;
|
||||
|
||||
const response = await authenticatedFetch(url);
|
||||
// Load all PPRs and filter client-side for today's arrivals
|
||||
// We filter by ETA date (not ETD) and NEW/CONFIRMED status
|
||||
const response = await authenticatedFetch('/api/v1/pprs/?limit=1000');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch arrivals');
|
||||
}
|
||||
|
||||
const allPPRs = await response.json();
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
|
||||
// Filter for arrivals (NEW and CONFIRMED with ETA only)
|
||||
const arrivals = allPPRs.filter(ppr =>
|
||||
(ppr.status === 'NEW' || ppr.status === 'CONFIRMED') && ppr.eta
|
||||
);
|
||||
// Filter for arrivals with ETA today and NEW or CONFIRMED status
|
||||
const arrivals = allPPRs.filter(ppr => {
|
||||
if (!ppr.eta || (ppr.status !== 'NEW' && ppr.status !== 'CONFIRMED')) {
|
||||
return false;
|
||||
}
|
||||
// Extract date from ETA (UTC)
|
||||
const etaDate = ppr.eta.split('T')[0];
|
||||
return etaDate === today;
|
||||
});
|
||||
|
||||
displayArrivals(arrivals);
|
||||
} catch (error) {
|
||||
@@ -1359,20 +1362,26 @@
|
||||
document.getElementById('departures-no-data').style.display = 'none';
|
||||
|
||||
try {
|
||||
// Always load today's date
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
let url = `/api/v1/pprs/?limit=1000&date_from=${today}&date_to=${today}`;
|
||||
|
||||
const response = await authenticatedFetch(url);
|
||||
// Load all PPRs and filter client-side for today's departures
|
||||
// We filter by ETD date and LANDED status only (exclude DEPARTED)
|
||||
const response = await authenticatedFetch('/api/v1/pprs/?limit=1000');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch departures');
|
||||
}
|
||||
|
||||
const allPPRs = await response.json();
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
|
||||
// Filter for departures (LANDED status only)
|
||||
const departures = allPPRs.filter(ppr => ppr.status === 'LANDED');
|
||||
// Filter for departures with ETD today and LANDED status only
|
||||
const departures = allPPRs.filter(ppr => {
|
||||
if (!ppr.etd || ppr.status !== 'LANDED') {
|
||||
return false;
|
||||
}
|
||||
// Extract date from ETD (UTC)
|
||||
const etdDate = ppr.etd.split('T')[0];
|
||||
return etdDate === today;
|
||||
});
|
||||
|
||||
displayDepartures(departures);
|
||||
} catch (error) {
|
||||
@@ -1548,7 +1557,7 @@
|
||||
isNewPPR = true;
|
||||
currentPPRId = null;
|
||||
etdManuallyEdited = false; // Reset the manual edit flag for new PPR
|
||||
document.getElementById('modal-title').textContent = 'New PPR Entry';
|
||||
document.getElementById('modal-title').textContent = 'New PPR';
|
||||
document.getElementById('delete-btn').style.display = 'none';
|
||||
document.getElementById('journal-section').style.display = 'none';
|
||||
document.querySelector('.quick-actions').style.display = 'none';
|
||||
|
||||
Reference in New Issue
Block a user