local-flights #5

Merged
jamesp merged 37 commits from local-flights into main 2025-12-20 12:29:32 -05:00
Showing only changes of commit 65eb3272f2 - Show all commits

View File

@@ -59,6 +59,7 @@
<thead> <thead>
<tr> <tr>
<th>Registration</th> <th>Registration</th>
<th style="width: 30px; text-align: center;"></th>
<th>Type</th> <th>Type</th>
<th>From</th> <th>From</th>
<th>ETA</th> <th>ETA</th>
@@ -96,6 +97,7 @@
<thead> <thead>
<tr> <tr>
<th>Registration</th> <th>Registration</th>
<th style="width: 30px; text-align: center;"></th>
<th>Type</th> <th>Type</th>
<th>To</th> <th>To</th>
<th>ETD</th> <th>ETD</th>
@@ -137,6 +139,7 @@
<thead> <thead>
<tr style="font-size: 0.85rem !important;"> <tr style="font-size: 0.85rem !important;">
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Registration</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Registration</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; width: 30px; text-align: center;"></th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Callsign</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Callsign</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Destination</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Destination</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Departed</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Departed</th>
@@ -171,6 +174,7 @@
<thead> <thead>
<tr style="font-size: 0.85rem !important;"> <tr style="font-size: 0.85rem !important;">
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Registration</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Registration</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; width: 30px; text-align: center;"></th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Type</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Type</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">From</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">From</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Arrived</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Arrived</th>
@@ -205,6 +209,7 @@
<tr style="font-size: 0.85rem !important;"> <tr style="font-size: 0.85rem !important;">
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Date</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Date</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Registration</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Registration</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; width: 30px; text-align: center;"></th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Type</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">Type</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">From</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">From</th>
<th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">ETA</th> <th style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">ETA</th>
@@ -1499,6 +1504,7 @@
if (isLocal) { if (isLocal) {
row.innerHTML = ` row.innerHTML = `
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.registration || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.registration || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; text-align: center; width: 30px;"></td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.callsign || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.callsign || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">-</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">-</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(flight.departed_dt)}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(flight.departed_dt)}</td>
@@ -1506,6 +1512,7 @@
} else if (isDeparture) { } else if (isDeparture) {
row.innerHTML = ` row.innerHTML = `
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.registration || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.registration || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; text-align: center; width: 30px;"></td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.callsign || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.callsign || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.out_to || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.out_to || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(flight.departed_dt)}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(flight.departed_dt)}</td>
@@ -1513,6 +1520,7 @@
} else { } else {
row.innerHTML = ` row.innerHTML = `
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.ac_reg || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.ac_reg || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; text-align: center; width: 30px;"><span style="color: #e74c3c; font-weight: bold;" title="From PPR">P</span></td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.ac_call || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.ac_call || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.out_to || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${flight.out_to || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(flight.departed_dt)}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(flight.departed_dt)}</td>
@@ -1612,7 +1620,12 @@
row.style.cssText = 'font-size: 0.85rem !important; font-style: italic;'; row.style.cssText = 'font-size: 0.85rem !important; font-style: italic;';
// Get registration based on type (PPR vs booked-in) // Get registration based on type (PPR vs booked-in)
const registration = ppr.ac_reg || ppr.registration || '-'; let registration = ppr.ac_reg || ppr.registration || '-';
let typeIconParked = '';
if (!isBookedIn) {
// Add P icon for PPR flights
typeIconParked = '<span style="color: #e74c3c; font-weight: bold;" title="From PPR">P</span>';
}
// Get aircraft type based on type (PPR vs booked-in) // Get aircraft type based on type (PPR vs booked-in)
const acType = ppr.ac_type || ppr.type || '-'; const acType = ppr.ac_type || ppr.type || '-';
@@ -1644,6 +1657,7 @@
row.innerHTML = ` row.innerHTML = `
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${registration}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${registration}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; text-align: center; width: 30px;">${typeIconParked}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${acType}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${acType}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${fromAirport}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${fromAirport}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${arrivedDisplay}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${arrivedDisplay}</td>
@@ -1725,6 +1739,7 @@
row.innerHTML = ` row.innerHTML = `
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${dateDisplay}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${dateDisplay}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${ppr.ac_reg || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${ppr.ac_reg || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important; text-align: center; width: 30px;"><span style="color: #e74c3c; font-weight: bold;" title="From PPR">P</span></td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${ppr.ac_type || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${ppr.ac_type || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${ppr.in_from || '-'}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${ppr.in_from || '-'}</td>
<td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(ppr.eta)}</td> <td style="padding: 0.3rem 0.4rem !important; font-size: 0.85rem !important;">${formatTimeOnly(ppr.eta)}</td>
@@ -1822,7 +1837,7 @@
<span class="tooltip-text">${flight.notes}</span> <span class="tooltip-text">${flight.notes}</span>
</span>` : ''; </span>` : '';
let aircraftDisplay, acType, fromDisplay, eta, pob, fuel, actionButtons; let aircraftDisplay, acType, fromDisplay, eta, pob, fuel, actionButtons, typeIcon;
if (isLocal) { if (isLocal) {
// Local flight display // Local flight display
@@ -1832,6 +1847,7 @@
aircraftDisplay = `<strong>${flight.registration}</strong>`; aircraftDisplay = `<strong>${flight.registration}</strong>`;
} }
acType = flight.type; acType = flight.type;
typeIcon = '';
fromDisplay = `<i>${flight.flight_type === 'CIRCUITS' ? 'Circuits' : flight.flight_type === 'LOCAL' ? 'Local Flight' : 'Departure'}</i>`; fromDisplay = `<i>${flight.flight_type === 'CIRCUITS' ? 'Circuits' : flight.flight_type === 'LOCAL' ? 'Local Flight' : 'Departure'}</i>`;
eta = flight.departure_dt ? formatTimeOnly(flight.departure_dt) : '-'; eta = flight.departure_dt ? formatTimeOnly(flight.departure_dt) : '-';
pob = flight.pob || '-'; pob = flight.pob || '-';
@@ -1852,6 +1868,7 @@
aircraftDisplay = `<strong>${flight.registration}</strong>`; aircraftDisplay = `<strong>${flight.registration}</strong>`;
} }
acType = flight.type; acType = flight.type;
typeIcon = '';
// Lookup airport name for in_from // Lookup airport name for in_from
let fromDisplay_temp = flight.in_from; let fromDisplay_temp = flight.in_from;
@@ -1880,6 +1897,7 @@
aircraftDisplay = `<strong>${flight.ac_reg}</strong>`; aircraftDisplay = `<strong>${flight.ac_reg}</strong>`;
} }
acType = flight.ac_type; acType = flight.ac_type;
typeIcon = '<span style="color: #e74c3c; font-weight: bold; font-size: 0.9em;" title="From PPR">P</span>';
// Lookup airport name for in_from // Lookup airport name for in_from
let fromDisplay_temp = flight.in_from; let fromDisplay_temp = flight.in_from;
@@ -1903,6 +1921,7 @@
row.innerHTML = ` row.innerHTML = `
<td>${aircraftDisplay}${notesIndicator}</td> <td>${aircraftDisplay}${notesIndicator}</td>
<td style="text-align: center; width: 30px;">${typeIcon}</td>
<td>${acType}</td> <td>${acType}</td>
<td>${fromDisplay}</td> <td>${fromDisplay}</td>
<td>${eta}</td> <td>${eta}</td>
@@ -1958,7 +1977,7 @@
<span class="tooltip-text">${flight.notes}</span> <span class="tooltip-text">${flight.notes}</span>
</span>` : ''; </span>` : '';
let aircraftDisplay, toDisplay, etd, pob, fuel, landedDt, actionButtons; let aircraftDisplay, toDisplay, etd, pob, fuel, landedDt, actionButtons, typeIcon;
if (isLocal) { if (isLocal) {
// Local flight display // Local flight display
@@ -1967,6 +1986,7 @@
} else { } else {
aircraftDisplay = `<strong>${flight.registration}</strong>`; aircraftDisplay = `<strong>${flight.registration}</strong>`;
} }
typeIcon = '';
toDisplay = `<i>${flight.flight_type === 'CIRCUITS' ? 'Circuits' : flight.flight_type === 'LOCAL' ? 'Local Flight' : 'Departure'}</i>`; toDisplay = `<i>${flight.flight_type === 'CIRCUITS' ? 'Circuits' : flight.flight_type === 'LOCAL' ? 'Local Flight' : 'Departure'}</i>`;
etd = flight.etd ? formatTimeOnly(flight.etd) : (flight.created_dt ? formatTimeOnly(flight.created_dt) : '-'); etd = flight.etd ? formatTimeOnly(flight.etd) : (flight.created_dt ? formatTimeOnly(flight.created_dt) : '-');
pob = flight.pob || '-'; pob = flight.pob || '-';
@@ -2002,6 +2022,7 @@
} else { } else {
aircraftDisplay = `<strong>${flight.registration}</strong>`; aircraftDisplay = `<strong>${flight.registration}</strong>`;
} }
typeIcon = '';
toDisplay = flight.out_to || '-'; toDisplay = flight.out_to || '-';
if (flight.out_to && flight.out_to.length === 4 && /^[A-Z]{4}$/.test(flight.out_to)) { if (flight.out_to && flight.out_to.length === 4 && /^[A-Z]{4}$/.test(flight.out_to)) {
toDisplay = await getAirportDisplay(flight.out_to); toDisplay = await getAirportDisplay(flight.out_to);
@@ -2033,6 +2054,7 @@
} else { } else {
aircraftDisplay = `<strong>${flight.ac_reg}</strong>`; aircraftDisplay = `<strong>${flight.ac_reg}</strong>`;
} }
typeIcon = '<span style="color: #e74c3c; font-weight: bold; font-size: 0.9em;" title="From PPR">P</span>';
toDisplay = flight.out_to || '-'; toDisplay = flight.out_to || '-';
if (flight.out_to && flight.out_to.length === 4 && /^[A-Z]{4}$/.test(flight.out_to)) { if (flight.out_to && flight.out_to.length === 4 && /^[A-Z]{4}$/.test(flight.out_to)) {
toDisplay = await getAirportDisplay(flight.out_to); toDisplay = await getAirportDisplay(flight.out_to);
@@ -2054,6 +2076,7 @@
row.innerHTML = ` row.innerHTML = `
<td>${aircraftDisplay}${notesIndicator}</td> <td>${aircraftDisplay}${notesIndicator}</td>
<td style="text-align: center; width: 30px;">${typeIcon}</td>
<td>${isLocal ? flight.type : isDeparture ? flight.type : flight.ac_type}</td> <td>${isLocal ? flight.type : isDeparture ? flight.type : flight.ac_type}</td>
<td>${toDisplay}</td> <td>${toDisplay}</td>
<td>${etd}</td> <td>${etd}</td>