Add Activity Timeline feature and database migrations
- Add Activity Timeline tab to ticket view showing chronological history - Create getTicketTimeline() method in AuditLogModel - Update TicketController to load timeline data - Add timeline UI with helper functions for formatting events - Add comprehensive timeline CSS with dark mode support - Create migrations 007-010 for upcoming features: - 007: Ticket assignment functionality - 008: Status workflow transitions - 009: Ticket templates - 010: Bulk operations tracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -289,4 +289,36 @@ class AuditLogModel {
|
||||
public function logTicketView($userId, $ticketId) {
|
||||
return $this->log($userId, 'view', 'ticket', $ticketId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formatted timeline for a specific ticket
|
||||
* Includes all ticket updates and comments
|
||||
*
|
||||
* @param string $ticketId Ticket ID
|
||||
* @return array Timeline events
|
||||
*/
|
||||
public function getTicketTimeline($ticketId) {
|
||||
$stmt = $this->conn->prepare(
|
||||
"SELECT al.*, u.username, u.display_name
|
||||
FROM audit_log al
|
||||
LEFT JOIN users u ON al.user_id = u.user_id
|
||||
WHERE (al.entity_type = 'ticket' AND al.entity_id = ?)
|
||||
OR (al.entity_type = 'comment' AND JSON_EXTRACT(al.details, '$.ticket_id') = ?)
|
||||
ORDER BY al.created_at DESC"
|
||||
);
|
||||
$stmt->bind_param("ss", $ticketId, $ticketId);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
|
||||
$timeline = [];
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
if ($row['details']) {
|
||||
$row['details'] = json_decode($row['details'], true);
|
||||
}
|
||||
$timeline[] = $row;
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
return $timeline;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user