Journal display

This commit is contained in:
2025-03-13 18:11:19 +00:00
parent c7eddb5465
commit 426c5092ba
2 changed files with 77 additions and 22 deletions

View File

@@ -1,4 +1,3 @@
<!DOCTYPE html>
<html lang="en">
<head>
@@ -227,17 +226,41 @@ function opDetail() {
echo "<p><strong>Outbound To:</strong><span class=\"editable\" data-column=\"out_to\" contenteditable=\"true\">" . $row['out_to'] . "</p>";
echo "<p><strong>ETD:</strong><span class=\"editable\" data-column=\"etd\" contenteditable=\"true\">" . $row['etd'] . "</p>";
echo "<p><strong>Email Address:</strong> " . $row['email'] . "</p>";
echo "<p><strong>Phone:</strong> " . $row['phone'] . "</p>";
echo "<p><strong>Notes:</strong> " . $row['notes'] . "</p>";
echo "<p><i>PPR created at:</strong> " . $row['submitted_dt'] . " by " . $row['created_by'] . "</p></div>";
// Fetch journal entries
$journalSql = "SELECT * FROM journal WHERE ppr_id = " . $_GET['id'];
$journalResult = $conn->query($journalSql);
$journalCount = $journalResult->num_rows;
// Add button to toggle journal entries
echo '<button onclick="toggleJournal()">Show Journal Entries (' . $journalCount . ')</button>';
echo '<div id="journal-entries" style="display:none;">';
echo '<h3>Journal Entries</h3>';
echo '<table class="journal-table">';
echo '<tr><th>Timestamp</th><th>User</th><th>Entry</th></tr>';
if ($journalCount > 0) {
while ($journalRow = $journalResult->fetch_assoc()) {
echo '<tr>';
echo '<td>' . $journalRow['entry_dt'] . '</td>';
echo '<td>' . $journalRow['user'] . '</td>';
echo '<td>' . $journalRow['entry'] . '</td>';
echo '</tr>';
}
} else {
echo '<tr><td colspan="3">No journal entries found.</td></tr>';
}
echo '</table>';
echo '</div>';
echo '</div>';
} else {
echo "No details found for the given ID.";
}
$conn->close();
}
@@ -262,7 +285,44 @@ switch($_GET['op']) {
default:
}
?>
<p><center><button onclick="window.close()">Close Window</button></center>
<script>
function toggleJournal() {
var journalEntries = document.getElementById("journal-entries");
if (journalEntries.style.display === "none") {
journalEntries.style.display = "block";
} else {
journalEntries.style.display = "none";
}
}
</script>
<style>
.journal-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
.journal-table th, .journal-table td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
.journal-table th {
background-color: #f2f2f2;
color: #333;
}
.journal-table tr:nth-child(even) {
background-color: #f9f9f9;
}
.journal-table tr:hover {
background-color: #f1f1f1;
}
</style>