Book in functions
This commit is contained in:
@@ -234,8 +234,8 @@
|
||||
const data = JSON.parse(event.data);
|
||||
console.log('WebSocket message received:', data);
|
||||
|
||||
// Refresh display when any PPR-related, local flight, or departure event occurs
|
||||
if (data.type && (data.type.includes('ppr_') || data.type === 'status_update' || data.type.includes('local_flight_') || data.type.includes('departure_'))) {
|
||||
// Refresh display when any PPR-related, local flight, departure, or arrival event occurs
|
||||
if (data.type && (data.type.includes('ppr_') || data.type === 'status_update' || data.type.includes('local_flight_') || data.type.includes('departure_') || data.type.includes('arrival_'))) {
|
||||
console.log('Flight update detected, refreshing display...');
|
||||
loadArrivals();
|
||||
loadDepartures();
|
||||
@@ -305,6 +305,7 @@
|
||||
// Build rows asynchronously to lookup airport names
|
||||
const rows = await Promise.all(arrivals.map(async (arrival) => {
|
||||
const isLocal = arrival.isLocalFlight;
|
||||
const isBookedIn = arrival.isBookedIn;
|
||||
|
||||
if (isLocal) {
|
||||
// Local flight
|
||||
@@ -321,6 +322,30 @@
|
||||
<td>${timeDisplay}</td>
|
||||
</tr>
|
||||
`;
|
||||
} else if (isBookedIn) {
|
||||
// Booked-in arrival
|
||||
const aircraftId = arrival.callsign || arrival.registration || '';
|
||||
const aircraftDisplay = `${escapeHtml(aircraftId)} <span style="font-size: 0.8em; color: #666;">(${escapeHtml(arrival.type || '')})</span>`;
|
||||
const fromDisplay = await getAirportName(arrival.in_from || '');
|
||||
|
||||
let timeDisplay;
|
||||
if (arrival.status === 'LANDED' && arrival.landed_dt) {
|
||||
// Show landed time if LANDED
|
||||
const time = convertToLocalTime(arrival.landed_dt);
|
||||
timeDisplay = `<div style="display: flex; align-items: center; gap: 8px;"><span style="color: #27ae60; font-weight: bold;">${time}</span><span style="font-size: 0.7em; background: #27ae60; color: white; padding: 2px 4px; border-radius: 3px; white-space: nowrap;">LANDED</span></div>`;
|
||||
} else {
|
||||
// Show ETA if BOOKED_IN
|
||||
const time = convertToLocalTime(arrival.eta);
|
||||
timeDisplay = `<div style="display: flex; align-items: center; gap: 8px;"><span style="color: #3498db; font-weight: bold;">${time}</span><span style="font-size: 0.7em; background: #3498db; color: white; padding: 2px 4px; border-radius: 3px; white-space: nowrap;">IN AIR</span></div>`;
|
||||
}
|
||||
|
||||
return `
|
||||
<tr>
|
||||
<td>${aircraftDisplay}</td>
|
||||
<td>${escapeHtml(fromDisplay)}</td>
|
||||
<td>${timeDisplay}</td>
|
||||
</tr>
|
||||
`;
|
||||
} else {
|
||||
// PPR
|
||||
const aircraftId = arrival.ac_call || arrival.ac_reg || '';
|
||||
|
||||
Reference in New Issue
Block a user