From 47d11c311eb3726ac26bd4f29b5c137e3e57e007 Mon Sep 17 00:00:00 2001 From: Gabriele Cimaschi Date: Tue, 14 Jul 2026 08:24:44 +0200 Subject: [PATCH] style: aggiunte iconcine per copia numero ticket e titolo nella pagina di riepilogo del ticket e copia titolo nella pagina ticket/a mio carico. style: rimosso link apri in otrs sul titolo dell'header di un ticket --- public/js/views/ticketDetail.js | 45 ++++++++++++++++++++++----------- public/js/views/ticketList.js | 24 +++++++++--------- 2 files changed, 42 insertions(+), 27 deletions(-) diff --git a/public/js/views/ticketDetail.js b/public/js/views/ticketDetail.js index 80b5f6c..b5bdf50 100644 --- a/public/js/views/ticketDetail.js +++ b/public/js/views/ticketDetail.js @@ -13,7 +13,7 @@ const TicketDetailView = { const body = this.noteQuill ? this.noteQuill.root.innerHTML.trim() : ''; const subject = document.getElementById('note-subject') ? document.getElementById('note-subject').value.trim() : ''; const time_unit = document.getElementById('note-time-units') ? document.getElementById('note-time-units').value.trim() : ''; - + if ((body !== '


' && body !== '') || subject !== '' || time_unit !== '' || this.noteAttachments.length > 0) { App.saveDraft(this.ticketId, { type: 'note', @@ -96,7 +96,7 @@ const TicketDetailView = { const data = await App.api(`/api/tickets/${id}`); const { ticket, articles, attachments } = data; // No automatic tab creation here anymore - + let groupsData = { asMaster: [], asMember: [] }; try { groupsData = await App.api(`/api/groups/by-ticket/${id}`); @@ -153,13 +153,14 @@ const TicketDetailView = {
-
#${ticket.tn}
-

- ${data.otrsWebUrl ? ` - - ${App.escapeHtml(ticket.title || '(senza titolo)')} - - ` : App.escapeHtml(ticket.title || '(senza titolo)')} +
+ 📋 + #${ticket.tn} + - +
+

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

${ticket.state_name} @@ -287,7 +288,7 @@ const TicketDetailView = {
${articles.length > 0 ? articles.map(a => { const hasHtml = (a.a_content_type || '').toLowerCase().includes('html') || a.a_body.includes(''); - + let processedBody = a.a_body || ''; const articleAttachments = (attachments || []).filter(att => att.article_id === a.article_id); @@ -521,7 +522,7 @@ const TicketDetailView = { modules: { toolbar: [ ['bold', 'italic', 'underline', 'strike'], - [{ 'list': 'ordered'}, { 'list': 'bullet' }], + [{ 'list': 'ordered' }, { 'list': 'bullet' }], ['link', 'image'], ['clean'] ], @@ -529,7 +530,7 @@ const TicketDetailView = { bindings: { tab: { key: 'Tab', - handler: function() { + handler: function () { return true; } } @@ -939,7 +940,7 @@ const TicketDetailView = { if (window.EmailCompose) { const hasHtml = (article.a_content_type || '').toLowerCase().includes('html') || article.a_body.includes(''); - + let processedQuoted = article.a_body || ''; if (hasHtml) { const articleAttachments = (attachments || []).filter(att => att.article_id === article.article_id); @@ -961,7 +962,7 @@ const TicketDetailView = { } const quotedBody = hasHtml ? processedQuoted : App.escapeHtml(article.a_body || '').replace(/\n/g, '
'); - + const initialBodyHtml = `


Il ${App.formatDateTime(article.create_time)}, ${App.escapeHtml(article.a_from || 'Sistema')} ha scritto:

@@ -1292,7 +1293,7 @@ const TicketDetailView = { if (doc && doc.readyState === 'complete') { attachImageClick(); } - } catch (_) {} + } catch (_) { } }); document.querySelectorAll('.attachment-badge[data-is-image="true"]').forEach(badge => { @@ -1302,5 +1303,19 @@ const TicketDetailView = { this.openImageLightbox(badge.href); }); }); + + document.querySelectorAll('.copy-ticket-btn').forEach(btn => { + btn.addEventListener('click', (e) => { + e.stopPropagation(); + const tn = btn.dataset.tn; + if (tn) { + navigator.clipboard.writeText(tn).then(() => { + Toast.success('Copiato negli appunti!'); + }).catch(err => { + Toast.error('Errore durante la copia: ' + err.message); + }); + } + }); + }); }, }; diff --git a/public/js/views/ticketList.js b/public/js/views/ticketList.js index 7722e3f..b5b5f39 100644 --- a/public/js/views/ticketList.js +++ b/public/js/views/ticketList.js @@ -39,18 +39,18 @@ const TicketListView = { Filters.state.user_id = activeAgentId; Filters.save(); } - + const params = Filters.toQueryParams(); params.set('page', this.currentPage); params.set('per_page', this.perPage); params.set('sort_by', this.sortBy); params.set('sort_dir', this.sortDir); - + const searchInput = document.getElementById('global-search'); if (searchInput && searchInput.value.trim()) { params.set('search', searchInput.value.trim()); } - + const data = await App.api(`/api/tickets?${params.toString()}`); this.renderContent(container, data); @@ -135,9 +135,9 @@ const TicketListView = { ${tickets.length > 0 ? tickets.map(t => { - const displayQueue = t.queue_name.includes('::') ? t.queue_name.split('::').pop() : t.queue_name; - const shortQueue = displayQueue.length > 15 ? displayQueue.substring(0, 12) + '...' : displayQueue; - return ` + const displayQueue = t.queue_name.includes('::') ? t.queue_name.split('::').pop() : t.queue_name; + const shortQueue = displayQueue.length > 15 ? displayQueue.substring(0, 12) + '...' : displayQueue; + return ` @@ -153,14 +153,14 @@ const TicketListView = { ${App.formatDateTime(t.create_time)} ${t.state_name} - ${App.escapeHtml(t.title || '(senza titolo)')} + 📋${App.escapeHtml(t.title || '(senza titolo)')} ${App.escapeHtml(shortQueue)}
${App.escapeHtml(t.queue_name)}
${t.owner_first || ''} ${t.owner_last || ''} ${t.customer_first ? `${t.customer_first} ${t.customer_last}` : (t.customer_user_id || '—')} ${App.priorityIndex(t.priority_name)} `; - }).join('') : ` + }).join('') : `
@@ -265,7 +265,7 @@ const TicketListView = { if (e.target.closest('.ticket-tn-link') || e.target.closest('.ticket-title-link')) { return; } - + const id = String(row.dataset.ticketId); if (this.selectedIds.has(id)) { this.selectedIds.delete(id); @@ -289,7 +289,7 @@ const TicketListView = { tr.classList.remove('first-selected'); } }); - + this.updateBatchBar(); }); }); @@ -312,7 +312,7 @@ const TicketListView = { batchOpenTabsBtn.addEventListener('click', (e) => { e.stopPropagation(); if (this.selectedIds.size === 0) return; - + let count = 0; this.selectedIds.forEach(id => { const row = document.querySelector(`.ticket-table tbody tr[data-ticket-id="${id}"]`); @@ -325,7 +325,7 @@ const TicketListView = { count++; } }); - + if (count > 0) { Toast.success(`${count} ticket aperti in nuove schede!`); this.selectedIds.clear();