Prep for 1.0
This commit is contained in:
134
admin.php
134
admin.php
@@ -6,70 +6,9 @@ require_db_auth();
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<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 name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Swansea Daily PPR</title>
|
||||
<title>PPR Monthly Reports</title>
|
||||
<style>
|
||||
|
||||
/* Styling for the table */
|
||||
@@ -104,16 +43,6 @@ require_db_auth();
|
||||
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 {
|
||||
padding: 10px 20px;
|
||||
font-size: 1rem;
|
||||
@@ -136,42 +65,18 @@ require_db_auth();
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/* Add styles for sorted columns */
|
||||
th.sorted-asc::after {
|
||||
content: " ▲";
|
||||
font-size: 0.8em;
|
||||
}
|
||||
th.sorted-desc::after {
|
||||
content: " ▼";
|
||||
font-size: 0.8em;
|
||||
.container {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php include("menu.php"); ?>
|
||||
|
||||
<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) {
|
||||
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");
|
||||
@@ -183,10 +88,11 @@ require_db_auth();
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<center><h2>Swansea Inbound PPR ADMIN</h2></center>
|
||||
|
||||
<div class="container">
|
||||
<h2>Select a Month</h2>
|
||||
<div style="display: inline-block; text-align: left;">
|
||||
<select id="monthSelect">
|
||||
<option value="1">January</option>
|
||||
<option value="2">February</option>
|
||||
@@ -204,8 +110,9 @@ require_db_auth();
|
||||
<select id="yearSelect"></select>
|
||||
<button onclick="selectMonthYear()">Submit</button>
|
||||
<button onclick="downloadCSV()">Download CSV</button>
|
||||
</div>
|
||||
<p id="output"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function populateYearDropdown() {
|
||||
@@ -251,15 +158,7 @@ require_db_auth();
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($host, $username, $password, $database);
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
$conn = connectDb();
|
||||
|
||||
$year = $_GET['year'] ?? date('Y');
|
||||
$month = $_GET['month'] ?? date('n');
|
||||
@@ -282,7 +181,6 @@ if ($result->num_rows > 0) {
|
||||
}
|
||||
|
||||
}
|
||||
// echo '<th>actions</th>';
|
||||
|
||||
echo ' </tr>
|
||||
</thead>
|
||||
@@ -304,15 +202,7 @@ if ($result->num_rows > 0) {
|
||||
echo "No results found.";
|
||||
}
|
||||
|
||||
// Close the database connection
|
||||
$conn->close();
|
||||
|
||||
?>
|
||||
|
||||
<center><button onclick="openPopup()">Log New PPR</button></center>
|
||||
|
||||
<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>
|
||||
<?php include("footer.php"); ?>
|
||||
30
footer.php
Normal file
30
footer.php
Normal 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
33
menu.php
Normal 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>
|
||||
35
tower.php
35
tower.php
@@ -169,42 +169,11 @@ require_db_auth();
|
||||
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>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="menu-bar">
|
||||
<a href="tower.php" class="active">HOME</a>
|
||||
<a href="upcoming.php">Future PPRs</a>
|
||||
<a href="admin.php">Reports</a>
|
||||
</div>
|
||||
<?php include("menu.php"); ?>
|
||||
|
||||
<script>
|
||||
function markAction(id, action, title, buttonText) {
|
||||
@@ -440,5 +409,5 @@ $conn->close();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
|
||||
|
||||
35
upcoming.php
35
upcoming.php
@@ -13,33 +13,6 @@ require_db_auth();
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Upcoming Movements</title>
|
||||
<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 {
|
||||
@@ -172,11 +145,7 @@ require_db_auth();
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="menu-bar">
|
||||
<a href="tower.php">HOME</a>
|
||||
<a href="upcoming.php" class="active">Future PPRs</a>
|
||||
<a href="admin.php">Reports</a>
|
||||
</div>
|
||||
<?php include("menu.php"); ?>
|
||||
|
||||
<script>
|
||||
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
|
||||
FROM submitted
|
||||
WHERE DATE(eta) > CURDATE()
|
||||
AND status != 'CANCELED'
|
||||
ORDER BY eta ASC;";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
@@ -323,3 +293,4 @@ $conn->close();
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php include("footer.php"); ?>
|
||||
Reference in New Issue
Block a user