diff --git a/frontend/templates/adminconversations.pages.tmpl b/frontend/templates/adminconversations.pages.tmpl index f892ef2..ff76d4b 100644 --- a/frontend/templates/adminconversations.pages.tmpl +++ b/frontend/templates/adminconversations.pages.tmpl @@ -8,47 +8,41 @@

💬 Historique des messages — Utilisateur #{{ .UserID }}

- +

🔍 Filtres personnalisés

- +
- +
- +
- +
- +
- +
- + - - - - - - + + + + + +
-

🧵 Conversation complète

@@ -81,6 +74,24 @@ function filterTable(colIndex, filterValue) { } } } - +function sortTable(colIndex) { + const table = document.getElementById("conversationTable"); + const tbody = table.tBodies[0]; + const rows = Array.from(tbody.querySelectorAll("tr")); + + const isAscending = table.getAttribute("data-sort-dir") !== "asc"; + table.setAttribute("data-sort-dir", isAscending ? "asc" : "desc"); + + rows.sort((a, b) => { + const cellA = a.children[colIndex].innerText.toLowerCase(); + const cellB = b.children[colIndex].innerText.toLowerCase(); + return isAscending + ? cellA.localeCompare(cellB, 'fr', { numeric: true }) + : cellB.localeCompare(cellA, 'fr', { numeric: true }); + }); + + rows.forEach(row => tbody.appendChild(row)); +} + {{ end }}
DateDirectionExpéditeurTypeContenuStatut📅 Date➡️ Direction📨 Expéditeur📦 Type💬 Contenu✅ Statut