Description
In the ticket listing page, when sorting by "Last Replied", the system currently relies on the ticket’s updatedAt field. However, this timestamp does not always represent the time of the latest thread reply — it may be updated due to other actions like status or priority changes. As a result, the ticket list is not accurately reflecting the true last reply order. To fix this, the sorting should be based on the createdAt value of the latest associated thread for each ticket.

Description
In the ticket listing page, when sorting by "Last Replied", the system currently relies on the ticket’s updatedAt field. However, this timestamp does not always represent the time of the latest thread reply — it may be updated due to other actions like status or priority changes. As a result, the ticket list is not accurately reflecting the true last reply order. To fix this, the sorting should be based on the createdAt value of the latest associated thread for each ticket.