Usability fixes
This commit is contained in:
@@ -437,7 +437,7 @@
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
@@ -848,18 +848,12 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="quick-actions">
|
||||
<button id="btn-confirm" class="btn btn-success btn-sm" onclick="updateStatus('CONFIRMED')">
|
||||
✓ Confirm
|
||||
</button>
|
||||
<button id="btn-landed" class="btn btn-warning btn-sm" onclick="showTimestampModal('LANDED')">
|
||||
🛬 Land
|
||||
</button>
|
||||
<button id="btn-departed" class="btn btn-primary btn-sm" onclick="showTimestampModal('DEPARTED')">
|
||||
🛫 Depart
|
||||
</button>
|
||||
<button id="btn-cancel" class="btn btn-danger btn-sm" onclick="updateStatus('CANCELED')">
|
||||
❌ Cancel
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form id="ppr-form">
|
||||
@@ -943,11 +937,8 @@
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="button" class="btn btn-danger" id="delete-btn" onclick="deletePPR()" style="display: none;">
|
||||
🗑️ Delete
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" onclick="closePPRModal()">
|
||||
Cancel
|
||||
<button type="button" class="btn btn-danger" id="btn-cancel" onclick="updateStatus('CANCELED')">
|
||||
❌ Cancel PPR
|
||||
</button>
|
||||
<button type="submit" class="btn btn-success">
|
||||
💾 Save Changes
|
||||
@@ -1989,7 +1980,6 @@
|
||||
currentPPRId = null;
|
||||
etdManuallyEdited = false; // Reset the manual edit flag for new PPR
|
||||
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';
|
||||
|
||||
@@ -2072,7 +2062,6 @@
|
||||
isNewPPR = false;
|
||||
currentPPRId = pprId;
|
||||
document.getElementById('modal-title').textContent = 'Edit PPR Entry';
|
||||
document.getElementById('delete-btn').style.display = 'inline-block';
|
||||
document.querySelector('.quick-actions').style.display = 'flex';
|
||||
|
||||
try {
|
||||
@@ -2087,23 +2076,21 @@
|
||||
|
||||
// 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
|
||||
// DEPARTED, CANCELED, DELETED - hide all quick actions and cancel button
|
||||
document.querySelector('.quick-actions').style.display = 'none';
|
||||
document.getElementById('btn-cancel').style.display = 'none';
|
||||
}
|
||||
|
||||
await loadJournal(pprId); // Always load journal when opening a PPR
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
opacity: 0.9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
|
||||
.container {
|
||||
@@ -376,9 +377,6 @@
|
||||
<button class="btn btn-success" onclick="exportToCSV()">
|
||||
📊 Export CSV
|
||||
</button>
|
||||
<button class="btn btn-success" onclick="exportToXLS()">
|
||||
📋 Export XLS
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -392,7 +390,6 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Status</th>
|
||||
<th>Aircraft</th>
|
||||
<th>Type</th>
|
||||
@@ -568,6 +565,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Sort by ETA (ascending)
|
||||
pprs.sort((a, b) => {
|
||||
if (!a.eta) return 1;
|
||||
if (!b.eta) return -1;
|
||||
return new Date(a.eta) - new Date(b.eta);
|
||||
});
|
||||
|
||||
tbody.innerHTML = '';
|
||||
document.getElementById('reports-table-content').style.display = 'block';
|
||||
|
||||
@@ -586,7 +590,6 @@
|
||||
const statusText = ppr.status.charAt(0).toUpperCase() + ppr.status.slice(1).toLowerCase();
|
||||
|
||||
row.innerHTML = `
|
||||
<td>${ppr.id}</td>
|
||||
<td><span class="${statusClass}">${statusText}</span></td>
|
||||
<td>${ppr.ac_reg}</td>
|
||||
<td>${ppr.ac_type}</td>
|
||||
@@ -622,7 +625,15 @@
|
||||
utcDateStr += 'Z';
|
||||
}
|
||||
const date = new Date(utcDateStr);
|
||||
return date.toISOString().slice(0, 16).replace('T', ' ');
|
||||
|
||||
// Format as dd/mm/yy hh:mm
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const year = String(date.getFullYear()).slice(-2);
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
|
||||
return `${day}/${month}/${year} ${hours}:${minutes}`;
|
||||
}
|
||||
|
||||
// Clear filters
|
||||
@@ -672,18 +683,6 @@
|
||||
downloadCSV(headers, csvData, 'ppr_reports.csv');
|
||||
}
|
||||
|
||||
function exportToXLS() {
|
||||
if (currentPPRs.length === 0) {
|
||||
showNotification('No data to export', true);
|
||||
return;
|
||||
}
|
||||
|
||||
// For XLS export, we'll create a CSV that Excel can open
|
||||
// In a production environment, you'd want to use a proper XLS library
|
||||
exportToCSV();
|
||||
showNotification('XLS export uses CSV format (compatible with Excel)');
|
||||
}
|
||||
|
||||
function downloadCSV(headers, data, filename) {
|
||||
const csvContent = [
|
||||
headers.join(','),
|
||||
|
||||
Reference in New Issue
Block a user