little fixes
This commit is contained in:
@@ -689,10 +689,10 @@
|
||||
✓ Confirm
|
||||
</button>
|
||||
<button id="btn-landed" class="btn btn-warning btn-sm" onclick="showTimestampModal('LANDED')">
|
||||
🛬 Landed
|
||||
🛬 Land
|
||||
</button>
|
||||
<button id="btn-departed" class="btn btn-primary btn-sm" onclick="showTimestampModal('DEPARTED')">
|
||||
🛫 Departed
|
||||
🛫 Depart
|
||||
</button>
|
||||
<button id="btn-cancel" class="btn btn-danger btn-sm" onclick="updateStatus('CANCELED')">
|
||||
❌ Cancel
|
||||
@@ -710,11 +710,11 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ac_type">Aircraft Type *</label>
|
||||
<input type="text" id="ac_type" name="ac_type" required>
|
||||
<input type="text" id="ac_type" name="ac_type" required tabindex="-1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="ac_call">Callsign</label>
|
||||
<input type="text" id="ac_call" name="ac_call" placeholder="If different from registration">
|
||||
<input type="text" id="ac_call" name="ac_call" placeholder="If different from registration" tabindex="-1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="captain">Captain *</label>
|
||||
@@ -735,7 +735,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="fuel">Fuel Required</label>
|
||||
<select id="fuel" name="fuel">
|
||||
<select id="fuel" name="fuel" tabindex="-1">
|
||||
<option value="">None</option>
|
||||
<option value="100LL">100LL</option>
|
||||
<option value="JET A1">JET A1</option>
|
||||
@@ -744,28 +744,28 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="out_to">Departing To</label>
|
||||
<input type="text" id="out_to" name="out_to" placeholder="ICAO Code or Airport Name" oninput="handleDepartureAirportLookup(this.value)">
|
||||
<input type="text" id="out_to" name="out_to" placeholder="ICAO Code or Airport Name" oninput="handleDepartureAirportLookup(this.value)" tabindex="-1">
|
||||
<div id="departure-airport-lookup-results"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="etd">ETD (Local Time)</label>
|
||||
<input type="datetime-local" id="etd" name="etd">
|
||||
<input type="datetime-local" id="etd" name="etd" tabindex="-1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pob_out">POB Outbound</label>
|
||||
<input type="number" id="pob_out" name="pob_out" min="1">
|
||||
<input type="number" id="pob_out" name="pob_out" min="1" tabindex="-1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" id="email" name="email">
|
||||
<input type="email" id="email" name="email" tabindex="-1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="phone">Phone</label>
|
||||
<input type="tel" id="phone" name="phone">
|
||||
<input type="tel" id="phone" name="phone" tabindex="-1">
|
||||
</div>
|
||||
<div class="form-group full-width">
|
||||
<label for="notes">Notes</label>
|
||||
<textarea id="notes" name="notes" rows="3"></textarea>
|
||||
<textarea id="notes" name="notes" rows="3" tabindex="-1"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1437,6 +1437,28 @@
|
||||
|
||||
const ppr = await response.json();
|
||||
populateForm(ppr);
|
||||
|
||||
// Show/hide quick action buttons based on current status
|
||||
if (ppr.status === 'NEW') {
|
||||
document.getElementById('btn-confirm').style.display = 'inline-block';
|
||||
document.getElementById('btn-landed').style.display = 'none';
|
||||
document.getElementById('btn-departed').style.display = 'none';
|
||||
document.getElementById('btn-cancel').style.display = 'inline-block';
|
||||
} else if (ppr.status === 'CONFIRMED') {
|
||||
document.getElementById('btn-confirm').style.display = 'none';
|
||||
document.getElementById('btn-landed').style.display = 'inline-block';
|
||||
document.getElementById('btn-departed').style.display = 'none';
|
||||
document.getElementById('btn-cancel').style.display = 'inline-block';
|
||||
} else if (ppr.status === 'LANDED') {
|
||||
document.getElementById('btn-confirm').style.display = 'none';
|
||||
document.getElementById('btn-landed').style.display = 'none';
|
||||
document.getElementById('btn-departed').style.display = 'inline-block';
|
||||
document.getElementById('btn-cancel').style.display = 'inline-block';
|
||||
} else {
|
||||
// DEPARTED, CANCELED, DELETED - hide all quick actions
|
||||
document.querySelector('.quick-actions').style.display = 'none';
|
||||
}
|
||||
|
||||
await loadJournal(pprId); // Always load journal when opening a PPR
|
||||
|
||||
document.getElementById('pprModal').style.display = 'block';
|
||||
@@ -1588,6 +1610,7 @@
|
||||
closeTimestampModal();
|
||||
loadPPRs(); // Refresh both tables
|
||||
showNotification(`Status updated to ${updatedStatus}`);
|
||||
closePPRModal(); // Close PPR modal after successful status update
|
||||
} catch (error) {
|
||||
console.error('Error updating status:', error);
|
||||
showNotification(`Error updating status: ${error.message}`, true);
|
||||
@@ -1656,6 +1679,13 @@
|
||||
async function updateStatus(status) {
|
||||
if (!currentPPRId || !accessToken) return;
|
||||
|
||||
// Show confirmation for cancel actions
|
||||
if (status === 'CANCELED') {
|
||||
if (!confirm('Are you sure you want to cancel this PPR? This action cannot be easily undone.')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/v1/pprs/${currentPPRId}/status`, {
|
||||
method: 'PATCH',
|
||||
@@ -1673,6 +1703,7 @@
|
||||
await loadJournal(currentPPRId); // Refresh journal
|
||||
loadPPRs(); // Refresh both tables
|
||||
showNotification(`Status updated to ${status}`);
|
||||
closePPRModal(); // Close modal after successful status update
|
||||
} catch (error) {
|
||||
console.error('Error updating status:', error);
|
||||
showNotification('Error updating status', true);
|
||||
|
||||
Reference in New Issue
Block a user