diff --git a/tower.php b/tower.php index 9e0365c..884f66a 100644 --- a/tower.php +++ b/tower.php @@ -169,10 +169,43 @@ 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; + } + + + + + + Upcoming Movements + + + + + + + + +

Upcoming Movements

+ +" . htmlspecialchars($value ?? '') . (!empty($value) ? " Z" : "") . ""; + } + if ($key == 'ac_reg' && $row['ac_call'] != NULL) { + $notes = htmlspecialchars($row['notes'] ?? ''); + $acCall = htmlspecialchars($row['ac_call'] ?? ''); + $acReg = htmlspecialchars($value ?? ''); + if (!empty($row['notes'])) { + return "$acCall
$acReg"; + } + return "$acCall
$acReg"; + } elseif ($key == 'ac_reg' && !empty($row['notes'])) { + $notes = htmlspecialchars($row['notes'] ?? ''); + $acReg = htmlspecialchars($value ?? ''); + return "$acReg"; + } else { + return "" . htmlspecialchars($value ?? '') . ""; + } +} + +function renderActionsCell($id) { + return " + + + "; +} + +function renderTableRow($row) { + $rowHtml = ""; + foreach ($row as $key => $value) { + if (!in_array($key, ['id', 'ac_call', 'notes'])) { // Exclude 'notes' + $rowHtml .= renderTableCell($key, $value, $row); + } + } + $rowHtml .= renderActionsCell($row['id']); + $rowHtml .= ""; + return $rowHtml; +} + +function renderTable($result) { + $tableHtml = " + + "; + $fields = $result->fetch_fields(); + foreach ($fields as $field) { + if (!in_array($field->name, ['id', 'ac_call', 'notes'])) { // Exclude 'notes' + $tableHtml .= ""; + } + } + $tableHtml .= ""; + + while ($row = $result->fetch_assoc()) { + $tableHtml .= renderTableRow($row); + } + + $tableHtml .= "
" . htmlspecialchars($field->name ?? '') . "Actions
"; + return $tableHtml; +} + +$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() + ORDER BY eta ASC;"; +$result = $conn->query($sql); + +if ($result->num_rows > 0) { + echo renderTable($result); +} else { + echo "
No upcoming movements found.
"; +} + +$conn->close(); +?> + + +