From 44c89aa92f80d68a299a80639a3458e7d50341a0 Mon Sep 17 00:00:00 2001 From: Gabriele Cimaschi Date: Mon, 14 Sep 2026 10:50:07 +0200 Subject: [PATCH] style: nella pagina di riepilogo del ticket unificata copia di tn ed oggetto con click sull'oggetto. feat: aggiunto pulsante assegna ed aggiungi in scheda. --- public/js/app.js | 15 +++++++++++++++ public/js/views/ticketDetail.js | 22 ++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 1ccbe09..ef98728 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -126,6 +126,21 @@ const App = { } }, + async assignAndOpenTab(id, tn, title) { + const activeAgentId = parseInt(localStorage.getItem('activeAgentId') || '1', 10); + try { + await this.api(`/api/tickets/${id}`, { + method: 'PATCH', + body: JSON.stringify({ user_id: activeAgentId }), + }); + Toast.success('Ticket assegnato all\'agente attivo e aperto in scheda!'); + } catch (err) { + console.error('Error assigning ticket:', err); + Toast.error('Errore durante l\'assegnazione del ticket: ' + err.message); + } + this.openTab(id, tn, title); + }, + addTabWithoutRedirect(id, tn, title) { const exists = this.tabs.find(t => String(t.id) === String(id)); if (!exists) { diff --git a/public/js/views/ticketDetail.js b/public/js/views/ticketDetail.js index cfc433e..cd1af32 100644 --- a/public/js/views/ticketDetail.js +++ b/public/js/views/ticketDetail.js @@ -2924,9 +2924,13 @@ const TicketDetailView = { -

- 📋 - ${App.escapeHtml(ticket.title || '(senza titolo)')} + + ${App.escapeHtml(ticket.title || '(senza titolo)')} + +

${ticket.state_name} @@ -4259,6 +4263,20 @@ const TicketDetailView = { }); }); + document.querySelectorAll('.copy-full-ticket-title').forEach(el => { + el.addEventListener('click', (e) => { + e.stopPropagation(); + const fullText = el.dataset.full; + if (fullText) { + navigator.clipboard.writeText(fullText).then(() => { + Toast.success('TN e Oggetto copiati negli appunti!'); + }).catch(err => { + Toast.error('Errore durante la copia: ' + err.message); + }); + } + }); + }); + // Keydown listener for Ticket Detail shortcut (Save Quick Edit / Send Note) const handleTicketDetailShortcut = (e) => { if (!document.getElementById('qe-save')) {