diff --git a/models/TicketModel.php b/models/TicketModel.php index a621f29..94916ae 100644 --- a/models/TicketModel.php +++ b/models/TicketModel.php @@ -113,8 +113,15 @@ class TicketModel { $totalResult = $countStmt->get_result(); $totalTickets = $totalResult->fetch_assoc()['total']; - // Get tickets with pagination - $sql = "SELECT * FROM tickets $whereClause ORDER BY $sortColumn $sortDirection LIMIT ? OFFSET ?"; + // Get tickets with pagination and creator info + $sql = "SELECT t.*, + u.username as creator_username, + u.display_name as creator_display_name + FROM tickets t + LEFT JOIN users u ON t.created_by = u.user_id + $whereClause + ORDER BY $sortColumn $sortDirection + LIMIT ? OFFSET ?"; $stmt = $this->conn->prepare($sql); // Add limit and offset parameters diff --git a/views/DashboardView.php b/views/DashboardView.php index 1ee3cf1..1e186dd 100644 --- a/views/DashboardView.php +++ b/views/DashboardView.php @@ -182,11 +182,12 @@ $columns = [ 'ticket_id' => 'Ticket ID', - 'priority' => 'Priority', + 'priority' => 'Priority', 'title' => 'Title', 'category' => 'Category', 'type' => 'Type', 'status' => 'Status', + 'created_by' => 'Created By', 'created_at' => 'Created', 'updated_at' => 'Updated' ]; @@ -206,6 +207,7 @@ 0) { foreach($tickets as $row) { + $creator = $row['creator_display_name'] ?? $row['creator_username'] ?? 'System'; echo "