Add Created By column to dashboard and remove back button from ticket view
This commit is contained in:
@@ -113,8 +113,15 @@ class TicketModel {
|
|||||||
$totalResult = $countStmt->get_result();
|
$totalResult = $countStmt->get_result();
|
||||||
$totalTickets = $totalResult->fetch_assoc()['total'];
|
$totalTickets = $totalResult->fetch_assoc()['total'];
|
||||||
|
|
||||||
// Get tickets with pagination
|
// Get tickets with pagination and creator info
|
||||||
$sql = "SELECT * FROM tickets $whereClause ORDER BY $sortColumn $sortDirection LIMIT ? OFFSET ?";
|
$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);
|
$stmt = $this->conn->prepare($sql);
|
||||||
|
|
||||||
// Add limit and offset parameters
|
// Add limit and offset parameters
|
||||||
|
|||||||
@@ -187,6 +187,7 @@
|
|||||||
'category' => 'Category',
|
'category' => 'Category',
|
||||||
'type' => 'Type',
|
'type' => 'Type',
|
||||||
'status' => 'Status',
|
'status' => 'Status',
|
||||||
|
'created_by' => 'Created By',
|
||||||
'created_at' => 'Created',
|
'created_at' => 'Created',
|
||||||
'updated_at' => 'Updated'
|
'updated_at' => 'Updated'
|
||||||
];
|
];
|
||||||
@@ -206,6 +207,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (count($tickets) > 0) {
|
if (count($tickets) > 0) {
|
||||||
foreach($tickets as $row) {
|
foreach($tickets as $row) {
|
||||||
|
$creator = $row['creator_display_name'] ?? $row['creator_username'] ?? 'System';
|
||||||
echo "<tr class='priority-{$row['priority']}'>";
|
echo "<tr class='priority-{$row['priority']}'>";
|
||||||
echo "<td><a href='/ticket/{$row['ticket_id']}' class='ticket-link'>{$row['ticket_id']}</a></td>";
|
echo "<td><a href='/ticket/{$row['ticket_id']}' class='ticket-link'>{$row['ticket_id']}</a></td>";
|
||||||
echo "<td><span>{$row['priority']}</span></td>";
|
echo "<td><span>{$row['priority']}</span></td>";
|
||||||
@@ -213,12 +215,13 @@
|
|||||||
echo "<td>{$row['category']}</td>";
|
echo "<td>{$row['category']}</td>";
|
||||||
echo "<td>{$row['type']}</td>";
|
echo "<td>{$row['type']}</td>";
|
||||||
echo "<td><span class='status-" . str_replace(' ', '-', $row['status']) . "'>{$row['status']}</span></td>";
|
echo "<td><span class='status-" . str_replace(' ', '-', $row['status']) . "'>{$row['status']}</span></td>";
|
||||||
|
echo "<td>" . htmlspecialchars($creator) . "</td>";
|
||||||
echo "<td>" . date('Y-m-d H:i', strtotime($row['created_at'])) . "</td>";
|
echo "<td>" . date('Y-m-d H:i', strtotime($row['created_at'])) . "</td>";
|
||||||
echo "<td>" . date('Y-m-d H:i', strtotime($row['updated_at'])) . "</td>";
|
echo "<td>" . date('Y-m-d H:i', strtotime($row['updated_at'])) . "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "<tr><td colspan='8'>No tickets found</td></tr>";
|
echo "<tr><td colspan='9'>No tickets found</td></tr>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -205,9 +205,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ticket-footer">
|
|
||||||
<button onclick="window.location.href='/'" class="btn back-btn">Back to Dashboard</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
// Initialize the ticket view
|
// Initialize the ticket view
|
||||||
|
|||||||
Reference in New Issue
Block a user