Added local flight duration
This commit is contained in:
@@ -409,6 +409,10 @@
|
||||
<option value="DEPARTURE">Departure to Other Airport</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="local_duration">Duration (minutes)</label>
|
||||
<input type="number" id="local_duration" name="duration" min="5" max="480" value="45" placeholder="Duration in minutes" tabindex="7">
|
||||
</div>
|
||||
<div class="form-group" id="departure-destination-group" style="display: none;">
|
||||
<label for="local_out_to" id="departure-destination-label">Destination Airport</label>
|
||||
<input type="text" id="local_out_to" name="out_to" placeholder="ICAO Code or Airport Name" oninput="handleLocalOutToAirportLookup(this.value)" tabindex="3">
|
||||
@@ -487,6 +491,10 @@
|
||||
<option value="DEPARTURE">Departure</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="local_edit_duration">Duration (minutes)</label>
|
||||
<input type="number" id="local_edit_duration" name="duration" min="5" max="480">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="local_edit_departure_dt">Departure Time</label>
|
||||
<div style="display: flex; gap: 0.5rem;">
|
||||
@@ -1890,7 +1898,16 @@
|
||||
acType = flight.type;
|
||||
typeIcon = '';
|
||||
fromDisplay = `<i>${flight.flight_type === 'CIRCUITS' ? 'Circuits' : flight.flight_type === 'LOCAL' ? 'Local Flight' : 'Departure'}</i>`;
|
||||
eta = flight.departure_dt ? formatTimeOnly(flight.departure_dt) : '-';
|
||||
|
||||
// Calculate ETA: use departed_dt (actual departure) if available, otherwise etd (planned departure)
|
||||
// Then add duration to get ETA
|
||||
let departureTime = flight.departed_dt || flight.etd;
|
||||
let etaTime = departureTime;
|
||||
if (departureTime && flight.duration) {
|
||||
const departTime = new Date(departureTime);
|
||||
etaTime = new Date(departTime.getTime() + flight.duration * 60000).toISOString(); // duration is in minutes
|
||||
}
|
||||
eta = etaTime ? formatTimeOnly(etaTime) : '-';
|
||||
pob = flight.pob || '-';
|
||||
fuel = '-';
|
||||
|
||||
@@ -3255,6 +3272,7 @@
|
||||
document.getElementById('local_edit_callsign').value = flight.callsign || '';
|
||||
document.getElementById('local_edit_pob').value = flight.pob;
|
||||
document.getElementById('local_edit_flight_type').value = flight.flight_type;
|
||||
document.getElementById('local_edit_duration').value = flight.duration || 45;
|
||||
document.getElementById('local_edit_notes').value = flight.notes || '';
|
||||
|
||||
// Parse and populate departure time if exists
|
||||
@@ -3588,7 +3606,7 @@
|
||||
|
||||
// Only include non-empty values
|
||||
if (typeof value === 'number' || (typeof value === 'string' && value.trim() !== '')) {
|
||||
if (key === 'pob') {
|
||||
if (key === 'pob' || key === 'duration') {
|
||||
updateData[key] = parseInt(value);
|
||||
} else if (value.trim) {
|
||||
updateData[key] = value.trim();
|
||||
@@ -3649,7 +3667,7 @@
|
||||
|
||||
// Only include non-empty values
|
||||
if (typeof value === 'number' || (typeof value === 'string' && value.trim() !== '')) {
|
||||
if (key === 'pob') {
|
||||
if (key === 'pob' || key === 'duration') {
|
||||
flightData[key] = parseInt(value);
|
||||
} else if (value.trim) {
|
||||
flightData[key] = value.trim();
|
||||
|
||||
@@ -317,7 +317,7 @@
|
||||
const aircraftDisplay = `${escapeHtml(aircraftId)} <span style="font-size: 0.8em; color: #666;">(${escapeHtml(arrival.ac_type || '')})</span>`;
|
||||
const fromDisplay = `<i>${getFlightTypeDisplay(arrival.flight_type)}</i>`;
|
||||
const time = convertToLocalTime(arrival.eta);
|
||||
const 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;">IN AIR</span></div>`;
|
||||
const 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>`;
|
||||
|
||||
html = `<tr><td>${aircraftDisplay}</td><td>${fromDisplay}</td><td>${timeDisplay}</td></tr>`;
|
||||
sortKey = `0-${arrival.eta}`; // Live flights, sort by ETA
|
||||
|
||||
Reference in New Issue
Block a user