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

@@ -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(','),