diff --git a/api/add_comment.php b/api/add_comment.php index 5e878f2..bca3664 100644 --- a/api/add_comment.php +++ b/api/add_comment.php @@ -66,6 +66,11 @@ try { $auditLog->logCommentCreate($userId, $result['comment_id'], $ticketId); } + // Add user display name to result for frontend + if ($result['success']) { + $result['user_name'] = $currentUser['display_name'] ?? $currentUser['username']; + } + // Discard any unexpected output ob_end_clean(); diff --git a/models/TicketModel.php b/models/TicketModel.php index 9a52182..754304f 100644 --- a/models/TicketModel.php +++ b/models/TicketModel.php @@ -7,16 +7,24 @@ class TicketModel { } public function getTicketById($id) { - $sql = "SELECT * FROM tickets WHERE ticket_id = ?"; + $sql = "SELECT t.*, + u_created.username as creator_username, + u_created.display_name as creator_display_name, + u_updated.username as updater_username, + u_updated.display_name as updater_display_name + FROM tickets t + LEFT JOIN users u_created ON t.created_by = u_created.user_id + LEFT JOIN users u_updated ON t.updated_by = u_updated.user_id + WHERE t.ticket_id = ?"; $stmt = $this->conn->prepare($sql); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); - + if ($result->num_rows === 0) { return null; } - + return $result->fetch_assoc(); } diff --git a/views/DashboardView.php b/views/DashboardView.php index 4ff99a7..675d978 100644 --- a/views/DashboardView.php +++ b/views/DashboardView.php @@ -13,19 +13,60 @@ -
-
- 🎫 Tinker Tickets +
+
+ 🎫 Tinker Tickets
-
+
- 👤 + 👤 - Admin + Admin
+

Ticket Dashboard

diff --git a/views/TicketView.php b/views/TicketView.php index 0af7ef8..b834972 100644 --- a/views/TicketView.php +++ b/views/TicketView.php @@ -27,24 +27,86 @@ -
-
- ← Dashboard +
+ -
+
- 👤 + 👤 - Admin + Admin
+
">

" data-field="title" disabled>

-
UUID
+
">