Usability fixes

This commit is contained in:
James Pattinson
2025-12-11 15:42:21 +00:00
parent 5f2aa82e36
commit 7efc2ef37a
2 changed files with 22 additions and 36 deletions

View File

@@ -437,7 +437,7 @@
.form-actions { .form-actions {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
justify-content: flex-end; justify-content: space-between;
padding-top: 1rem; padding-top: 1rem;
border-top: 1px solid #eee; border-top: 1px solid #eee;
} }
@@ -848,18 +848,12 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="quick-actions"> <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')"> <button id="btn-landed" class="btn btn-warning btn-sm" onclick="showTimestampModal('LANDED')">
🛬 Land 🛬 Land
</button> </button>
<button id="btn-departed" class="btn btn-primary btn-sm" onclick="showTimestampModal('DEPARTED')"> <button id="btn-departed" class="btn btn-primary btn-sm" onclick="showTimestampModal('DEPARTED')">
🛫 Depart 🛫 Depart
</button> </button>
<button id="btn-cancel" class="btn btn-danger btn-sm" onclick="updateStatus('CANCELED')">
❌ Cancel
</button>
</div> </div>
<form id="ppr-form"> <form id="ppr-form">
@@ -943,11 +937,8 @@
</div> </div>
<div class="form-actions"> <div class="form-actions">
<button type="button" class="btn btn-danger" id="delete-btn" onclick="deletePPR()" style="display: none;"> <button type="button" class="btn btn-danger" id="btn-cancel" onclick="updateStatus('CANCELED')">
🗑️ Delete ❌ Cancel PPR
</button>
<button type="button" class="btn btn-primary" onclick="closePPRModal()">
Cancel
</button> </button>
<button type="submit" class="btn btn-success"> <button type="submit" class="btn btn-success">
💾 Save Changes 💾 Save Changes
@@ -1989,7 +1980,6 @@
currentPPRId = null; currentPPRId = null;
etdManuallyEdited = false; // Reset the manual edit flag for new PPR etdManuallyEdited = false; // Reset the manual edit flag for new PPR
document.getElementById('modal-title').textContent = 'New PPR'; document.getElementById('modal-title').textContent = 'New PPR';
document.getElementById('delete-btn').style.display = 'none';
document.getElementById('journal-section').style.display = 'none'; document.getElementById('journal-section').style.display = 'none';
document.querySelector('.quick-actions').style.display = 'none'; document.querySelector('.quick-actions').style.display = 'none';
@@ -2072,7 +2062,6 @@
isNewPPR = false; isNewPPR = false;
currentPPRId = pprId; currentPPRId = pprId;
document.getElementById('modal-title').textContent = 'Edit PPR Entry'; document.getElementById('modal-title').textContent = 'Edit PPR Entry';
document.getElementById('delete-btn').style.display = 'inline-block';
document.querySelector('.quick-actions').style.display = 'flex'; document.querySelector('.quick-actions').style.display = 'flex';
try { try {
@@ -2087,23 +2076,21 @@
// Show/hide quick action buttons based on current status // Show/hide quick action buttons based on current status
if (ppr.status === 'NEW') { if (ppr.status === 'NEW') {
document.getElementById('btn-confirm').style.display = 'inline-block';
document.getElementById('btn-landed').style.display = 'none'; document.getElementById('btn-landed').style.display = 'none';
document.getElementById('btn-departed').style.display = 'none'; document.getElementById('btn-departed').style.display = 'none';
document.getElementById('btn-cancel').style.display = 'inline-block'; document.getElementById('btn-cancel').style.display = 'inline-block';
} else if (ppr.status === 'CONFIRMED') { } else if (ppr.status === 'CONFIRMED') {
document.getElementById('btn-confirm').style.display = 'none';
document.getElementById('btn-landed').style.display = 'inline-block'; document.getElementById('btn-landed').style.display = 'inline-block';
document.getElementById('btn-departed').style.display = 'none'; document.getElementById('btn-departed').style.display = 'none';
document.getElementById('btn-cancel').style.display = 'inline-block'; document.getElementById('btn-cancel').style.display = 'inline-block';
} else if (ppr.status === 'LANDED') { } else if (ppr.status === 'LANDED') {
document.getElementById('btn-confirm').style.display = 'none';
document.getElementById('btn-landed').style.display = 'none'; document.getElementById('btn-landed').style.display = 'none';
document.getElementById('btn-departed').style.display = 'inline-block'; document.getElementById('btn-departed').style.display = 'inline-block';
document.getElementById('btn-cancel').style.display = 'inline-block'; document.getElementById('btn-cancel').style.display = 'inline-block';
} else { } 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.querySelector('.quick-actions').style.display = 'none';
document.getElementById('btn-cancel').style.display = 'none';
} }
await loadJournal(pprId); // Always load journal when opening a PPR await loadJournal(pprId); // Always load journal when opening a PPR

View File

@@ -43,6 +43,7 @@
opacity: 0.9; opacity: 0.9;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.3rem;
} }
.container { .container {
@@ -376,9 +377,6 @@
<button class="btn btn-success" onclick="exportToCSV()"> <button class="btn btn-success" onclick="exportToCSV()">
📊 Export CSV 📊 Export CSV
</button> </button>
<button class="btn btn-success" onclick="exportToXLS()">
📋 Export XLS
</button>
</div> </div>
</div> </div>
@@ -392,7 +390,6 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>ID</th>
<th>Status</th> <th>Status</th>
<th>Aircraft</th> <th>Aircraft</th>
<th>Type</th> <th>Type</th>
@@ -568,6 +565,13 @@
return; 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 = ''; tbody.innerHTML = '';
document.getElementById('reports-table-content').style.display = 'block'; document.getElementById('reports-table-content').style.display = 'block';
@@ -586,7 +590,6 @@
const statusText = ppr.status.charAt(0).toUpperCase() + ppr.status.slice(1).toLowerCase(); const statusText = ppr.status.charAt(0).toUpperCase() + ppr.status.slice(1).toLowerCase();
row.innerHTML = ` row.innerHTML = `
<td>${ppr.id}</td>
<td><span class="${statusClass}">${statusText}</span></td> <td><span class="${statusClass}">${statusText}</span></td>
<td>${ppr.ac_reg}</td> <td>${ppr.ac_reg}</td>
<td>${ppr.ac_type}</td> <td>${ppr.ac_type}</td>
@@ -622,7 +625,15 @@
utcDateStr += 'Z'; utcDateStr += 'Z';
} }
const date = new Date(utcDateStr); 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 // Clear filters
@@ -672,18 +683,6 @@
downloadCSV(headers, csvData, 'ppr_reports.csv'); 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) { function downloadCSV(headers, data, filename) {
const csvContent = [ const csvContent = [
headers.join(','), headers.join(','),