Prep for 1.0

This commit is contained in:
2025-03-31 12:33:26 +00:00
parent ac5cd4f3a0
commit 41dcd937cd
5 changed files with 98 additions and 205 deletions

170
admin.php
View File

@@ -6,70 +6,9 @@ require_db_auth();
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="refresh" content="300">
<script>
document.addEventListener("DOMContentLoaded", function() {
let rows = document.querySelectorAll("table tbody tr");
rows.forEach(row => {
let fuelCell = row.cells[3]; // Get the "Fuel" cell (index 3)
if (fuelCell.textContent == "100LL") {
row.classList.add("highlight100LL"); // Add the class
} else if (fuelCell.textContent == "JET A1") {
row.classList.add("highlightJET"); // Add the class
}
});
// Sorting functionality
let table = document.querySelector("table");
let headers = table.querySelectorAll("th");
let sortDirection = {}; // Track sort direction for each column
headers.forEach((header, index) => {
header.addEventListener("click", function() {
let direction = sortDirection[index] === "asc" ? "desc" : "asc";
sortDirection[index] = direction;
sortTable(table, index, direction);
// Update visual indication
headers.forEach(h => h.classList.remove("sorted-asc", "sorted-desc"));
header.classList.add(direction === "asc" ? "sorted-asc" : "sorted-desc");
});
});
function sortTable(table, columnIndex, direction) {
let rows = Array.from(table.querySelectorAll("tbody tr"));
let isDate = !isNaN(Date.parse(rows[0].cells[columnIndex]?.textContent.trim() || ""));
let isNumeric = !isNaN(rows[0].cells[columnIndex]?.textContent.trim() || "");
let sortedRows = rows.sort((a, b) => {
let aText = a.cells[columnIndex]?.textContent.trim() || null;
let bText = b.cells[columnIndex]?.textContent.trim() || null;
if (aText === null || bText === null) {
return aText === null ? 1 : -1; // Place null/empty values at the bottom
}
if (isDate) {
let aDate = new Date(aText);
let bDate = new Date(bText);
return direction === "asc" ? aDate - bDate : bDate - aDate;
} else if (isNumeric) {
return direction === "asc" ? aText - bText : bText - aText;
} else {
return direction === "asc" ? aText.localeCompare(bText) : bText.localeCompare(aText);
}
});
let tbody = table.querySelector("tbody");
tbody.innerHTML = "";
sortedRows.forEach(row => tbody.appendChild(row));
}
});
</script>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Swansea Daily PPR</title> <title>PPR Monthly Reports</title>
<style> <style>
/* Styling for the table */ /* Styling for the table */
@@ -104,16 +43,6 @@ require_db_auth();
background-color: #f1f1f1; background-color: #f1f1f1;
} }
.highlight100LL {
background-color: #ADD8E6 !important;
#font-weight: bold;
}
.highlightJET {
background-color: yellow !important; /* Allow it to override the odd/even shading */
#font-weight: bold;
}
button { button {
padding: 10px 20px; padding: 10px 20px;
font-size: 1rem; font-size: 1rem;
@@ -136,42 +65,18 @@ require_db_auth();
border-radius: 5px; border-radius: 5px;
} }
/* Add styles for sorted columns */ .container {
th.sorted-asc::after { text-align: center;
content: " ▲"; margin-bottom: 20px;
font-size: 0.8em;
}
th.sorted-desc::after {
content: " ▼";
font-size: 0.8em;
} }
</style> </style>
</head> </head>
<body> <body>
<?php include("menu.php"); ?>
<script> <script>
function markLanded(id) {
page="action.php?op=landed&id=" + id;
var xhr = new XMLHttpRequest();
xhr.open("GET", page, false); // 'false' makes the request synchronous
xhr.send();
window.location.reload(true);
}
function markCancel(id) {
page="action.php?op=cancel&id=" + id;
var xhr = new XMLHttpRequest();
xhr.open("GET", page, false); // 'false' makes the request synchronous
xhr.send();
window.location.reload(true);
}
function deletePpr(id) {
page="action.php?op=delete&id=" + id;
var xhr = new XMLHttpRequest();
xhr.open("GET", page, false); // 'false' makes the request synchronous
xhr.send();
window.location.reload(true);
}
function openDetail(id) { function openDetail(id) {
page="action.php?op=detail&id=" + id; page="action.php?op=detail&id=" + id;
var popupWindow = window.open(page, "PopupWindow", "toolbar=no, location=no, directories=no,status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=600, height=1100"); var popupWindow = window.open(page, "PopupWindow", "toolbar=no, location=no, directories=no,status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=600, height=1100");
@@ -183,29 +88,31 @@ require_db_auth();
} }
</script> </script>
<center><h2>Swansea Inbound PPR ADMIN</h2></center> <center><h2>Swansea Inbound PPR ADMIN</h2></center>
<div class="container"> <div class="container">
<h2>Select a Month</h2> <div style="display: inline-block; text-align: left;">
<select id="monthSelect"> <select id="monthSelect">
<option value="1">January</option> <option value="1">January</option>
<option value="2">February</option> <option value="2">February</option>
<option value="3">March</option> <option value="3">March</option>
<option value="4">April</option> <option value="4">April</option>
<option value="5">May</option> <option value="5">May</option>
<option value="6">June</option> <option value="6">June</option>
<option value="7">July</option> <option value="7">July</option>
<option value="8">August</option> <option value="8">August</option>
<option value="9">September</option> <option value="9">September</option>
<option value="10">October</option> <option value="10">October</option>
<option value="11">November</option> <option value="11">November</option>
<option value="12">December</option> <option value="12">December</option>
</select> </select>
<select id="yearSelect"></select> <select id="yearSelect"></select>
<button onclick="selectMonthYear()">Submit</button> <button onclick="selectMonthYear()">Submit</button>
<button onclick="downloadCSV()">Download CSV</button> <button onclick="downloadCSV()">Download CSV</button>
<p id="output"></p> </div>
</div> <p id="output"></p>
</div>
<script> <script>
function populateYearDropdown() { function populateYearDropdown() {
@@ -251,15 +158,7 @@ require_db_auth();
<?php <?php
$conn = connectDb();
// Create connection
$conn = new mysqli($host, $username, $password, $database);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$year = $_GET['year'] ?? date('Y'); $year = $_GET['year'] ?? date('Y');
$month = $_GET['month'] ?? date('n'); $month = $_GET['month'] ?? date('n');
@@ -282,7 +181,6 @@ if ($result->num_rows > 0) {
} }
} }
// echo '<th>actions</th>';
echo ' </tr> echo ' </tr>
</thead> </thead>
@@ -304,15 +202,7 @@ if ($result->num_rows > 0) {
echo "No results found."; echo "No results found.";
} }
// Close the database connection
$conn->close(); $conn->close();
?> ?>
<center><button onclick="openPopup()">Log New PPR</button></center> <?php include("footer.php"); ?>
<script>
function openPopup() {
window.open("input.html", "PopupWindow", "toolbar=no, location=no, directories=no,status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=600, height=1100");
}
</script>

30
footer.php Normal file
View File

@@ -0,0 +1,30 @@
<style>
.footer-bar {
display: flex;
justify-content: center;
align-items: center;
background-color: #333;
color: white;
padding: 10px 0;
font-family: Arial, sans-serif;
font-size: 14px;
position: fixed;
bottom: 0;
width: 100%;
}
.footer-bar a {
color: #007bff;
text-decoration: none;
margin-left: 5px;
}
.footer-bar a:hover {
text-decoration: underline;
}
</style>
<div class="footer-bar">
<span>Version 1.0.0</span>
<a href="changelog.php">View Changelog</a>
</div>

33
menu.php Normal file
View File

@@ -0,0 +1,33 @@
<style>
.menu-bar {
display: flex;
justify-content: center;
background-color: #333;
padding: 10px 0;
margin-bottom: 20px;
}
.menu-bar a {
color: white;
text-decoration: none;
padding: 10px 20px;
font-family: Arial, sans-serif;
font-size: 16px;
transition: background-color 0.3s;
}
.menu-bar a:hover {
background-color: #575757;
}
.menu-bar a.active {
background-color: #007bff;
font-weight: bold;
}
</style>
<div class="menu-bar">
<a href="tower.php" class="<?= basename($_SERVER['PHP_SELF']) === 'tower.php' ? 'active' : '' ?>">HOME</a>
<a href="upcoming.php" class="<?= basename($_SERVER['PHP_SELF']) === 'upcoming.php' ? 'active' : '' ?>">Future PPRs</a>
<a href="admin.php" class="<?= basename($_SERVER['PHP_SELF']) === 'admin.php' ? 'active' : '' ?>">Reports</a>
</div>

View File

@@ -169,42 +169,11 @@ require_db_auth();
z-index: 10; z-index: 10;
} }
/* Menu bar styling */
.menu-bar {
display: flex;
justify-content: center;
background-color: #333;
padding: 10px 0;
margin-bottom: 20px;
}
.menu-bar a {
color: white;
text-decoration: none;
padding: 10px 20px;
font-family: Arial, sans-serif;
font-size: 16px;
transition: background-color 0.3s;
}
.menu-bar a:hover {
background-color: #575757;
}
.menu-bar a.active {
background-color: #007bff;
font-weight: bold;
}
</style> </style>
</head> </head>
<body> <body>
<div class="menu-bar"> <?php include("menu.php"); ?>
<a href="tower.php" class="active">HOME</a>
<a href="upcoming.php">Future PPRs</a>
<a href="admin.php">Reports</a>
</div>
<script> <script>
function markAction(id, action, title, buttonText) { function markAction(id, action, title, buttonText) {
@@ -440,5 +409,5 @@ $conn->close();
</script> </script>
<?php include("footer.php"); ?>

View File

@@ -13,33 +13,6 @@ require_db_auth();
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upcoming Movements</title> <title>Upcoming Movements</title>
<style> <style>
/* ...existing styles from tower.php... */
.menu-bar {
display: flex;
justify-content: center;
background-color: #333;
padding: 10px 0;
margin-bottom: 20px;
}
.menu-bar a {
color: white;
text-decoration: none;
padding: 10px 20px;
font-family: Arial, sans-serif;
font-size: 16px;
transition: background-color 0.3s;
}
.menu-bar a:hover {
background-color: #575757;
}
.menu-bar a.active {
background-color: #007bff;
font-weight: bold;
}
/* Table styling */ /* Table styling */
table { table {
@@ -172,11 +145,7 @@ require_db_auth();
</head> </head>
<body> <body>
<div class="menu-bar"> <?php include("menu.php"); ?>
<a href="tower.php">HOME</a>
<a href="upcoming.php" class="active">Future PPRs</a>
<a href="admin.php">Reports</a>
</div>
<script> <script>
function markAction(id, action, title, buttonText) { function markAction(id, action, title, buttonText) {
@@ -309,6 +278,7 @@ $conn = connectDb();
$sql = "SELECT id, ac_reg, ac_type, ac_call, eta AS ETA, fuel, in_from, pob_in, notes $sql = "SELECT id, ac_reg, ac_type, ac_call, eta AS ETA, fuel, in_from, pob_in, notes
FROM submitted FROM submitted
WHERE DATE(eta) > CURDATE() WHERE DATE(eta) > CURDATE()
AND status != 'CANCELED'
ORDER BY eta ASC;"; ORDER BY eta ASC;";
$result = $conn->query($sql); $result = $conn->query($sql);
@@ -323,3 +293,4 @@ $conn->close();
</body> </body>
</html> </html>
<?php include("footer.php"); ?>