Compare commits

..

3 Commits

Author SHA1 Message Date
1bd87c9d1b Refresh after PPR logged 2025-02-23 19:13:02 +00:00
faec70c562 Better row click handling 2025-02-23 19:12:41 +00:00
cd1afc491c Optional fields 2025-02-18 16:54:52 +00:00
5 changed files with 35 additions and 20 deletions

View File

@@ -83,14 +83,12 @@ function opCancel() {
$conn = connectDb(); $conn = connectDb();
$sql = "UPDATE submitted SET status = 'CANCELED' where id = " . $_GET['id']; $sql = "UPDATE submitted SET status = 'CANCELED' where id = " . $_GET['id'];
$result = $conn->query($sql); $result = $conn->query($sql);
logJournal($conn, $_GET['id'], "Marked Canceled");
} }
function opLanded() { function opLanded() {
$conn = connectDb(); $conn = connectDb();
$sql = "UPDATE submitted SET status = 'LANDED', landed_dt = NOW() where id = " . $_GET['id']; $sql = "UPDATE submitted SET status = 'LANDED', landed_dt = NOW() where id = " . $_GET['id'];
$result = $conn->query($sql); $result = $conn->query($sql);
logJournal($conn, $_GET['id'], "Marked Landed");
} }
function opDetail() { function opDetail() {

View File

@@ -1 +0,0 @@
New file

View File

@@ -20,15 +20,6 @@ function connectDb() {
} }
function logJournal($conn, $id, $message) {
$stmt = $conn->prepare("INSERT INTO journal (ppr_id, entry, user) VALUES (?, ?, ?)");
$stmt->bind_param("iss", $id, $message, $_SERVER['PHP_AUTH_USER']);
$stmt->execute();
$stmt->close();
}
function require_db_auth() { function require_db_auth() {
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) {

View File

@@ -121,6 +121,12 @@
outline: none; outline: none;
box-shadow: 0 0 5px rgba(0, 123, 255, 0.5); box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
} }
.optional-label {
color: gray;
font-style: italic;
}
</style> </style>
</head> </head>
<body> <body>
@@ -138,7 +144,7 @@
<input type="text" id="ac_type" name="ac_type" required> <input type="text" id="ac_type" name="ac_type" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="ac_call">Callsign</label> <label class="optional-label" for="ac_call">Callsign (optional)</label>
<input type="text" id="ac_call" name="ac_call"> <input type="text" id="ac_call" name="ac_call">
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -167,16 +173,16 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="email">Email</label> <label class="optional-label" for="email">Email (optional)</label>
<input type="email" id="email" name="email" > <input type="email" id="email" name="email" >
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="phone">Phone</label> <label class="optional-label" for="phone">Phone (optional)</label>
<input type="text" id="phone" name="phone" > <input type="text" id="phone" name="phone" >
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="notes">Notes</label> <label class="optional-label" for="notes">Notes (optional)</label>
<textarea id="message" name="notes" rows="4" ></textarea> <textarea id="message" name="notes" rows="4" ></textarea>
</div> </div>

View File

@@ -120,6 +120,7 @@ require_db_auth();
}; };
} }
</script> </script>
<center><h2>Swansea Inbound PPR <?php echo date('l d M Y'); ?></h2></center> <center><h2>Swansea Inbound PPR <?php echo date('l d M Y'); ?></h2></center>
@@ -149,7 +150,7 @@ $result = $conn->query($sql);
// Check if there are results // Check if there are results
if ($result->num_rows > 0) { if ($result->num_rows > 0) {
// Start HTML table // Start HTML table
echo '<table border="1"> echo '<table border="1" id="entries">
<thead> <thead>
<tr>'; <tr>';
@@ -169,7 +170,7 @@ if ($result->num_rows > 0) {
// Output table rows // Output table rows
while ($row = $result->fetch_assoc()) { while ($row = $result->fetch_assoc()) {
echo '<tr onclick="openDetail(' . $row['id'] . ')">'; echo '<tr data-id=' . $row['id'] . '>';
foreach ($row as $key => $value) { foreach ($row as $key => $value) {
if ($key != 'id' && $key != 'ac_call') { if ($key != 'id' && $key != 'ac_call') {
if ($key == 'ac_reg' && $row['ac_call'] != NULL) { if ($key == 'ac_reg' && $row['ac_call'] != NULL) {
@@ -197,6 +198,26 @@ $conn->close();
<script> <script>
function openPopup() { 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"); popup = 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");
const checkPopup = setInterval(() => {
if (popup && popup.closed) {
clearInterval(checkPopup);
window.location.reload(); // Reload parent window
}
}, 500); // Check every 500ms
} }
</script> </script>
<script>
document.getElementById("entries").addEventListener("click", function (event) {
let td = event.target.closest("td");
if (!td) return; // Clicked outside <td>
let tr = td.parentElement; // Get the row
if (td !== tr.lastElementChild) {
let rowId = tr.dataset.id; // Get the unique row ID
openDetail(rowId);
}
});
</script>