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.
This commit is contained in:
1 parent
a15ab7e89d
commit
44c89aa92f
2 files changed
+34
-1
No files matched your search
@@ -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) {
|
addTabWithoutRedirect(id, tn, title) {
|
||||||
const exists = this.tabs.find(t => String(t.id) === String(id));
|
const exists = this.tabs.find(t => String(t.id) === String(id));
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
|
|||||||
@@ -2924,9 +2924,13 @@ const TicketDetailView = {
|
|||||||
-
|
-
|
||||||
</div>
|
</div>
|
||||||
<h2 class="ticket-detail-title" style="display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap;">
|
<h2 class="ticket-detail-title" style="display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap;">
|
||||||
<span class="copy-ticket-btn" data-tn="${App.escapeHtml(ticket.title || '')}" style="cursor: pointer; font-size: 0.85rem;" title="Copia titolo ticket">📋</span>
|
<span class="copy-full-ticket-title" data-full="${ticket.tn} - ${App.escapeHtml(ticket.title || '(senza titolo)')}" style="cursor: pointer;" title="Clicca per copiare: ${ticket.tn} - ${App.escapeHtml(ticket.title || '')}">
|
||||||
${App.escapeHtml(ticket.title || '(senza titolo)')}
|
${App.escapeHtml(ticket.title || '(senza titolo)')}
|
||||||
|
</span>
|
||||||
<button class="open-tab-btn" data-id="${ticket.id}" data-tn="${ticket.tn}" data-title="${App.escapeHtml(ticket.title || '(senza titolo)')}" onclick="App.openTab(${ticket.id}, '${ticket.tn}', this.dataset.title); event.stopPropagation();" title="Apri in scheda" style="display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; background:var(--accent-primary); color:#fff; border:none; border-radius:50%; font-size:10px; font-weight:800; font-family:sans-serif; margin-left:6px; cursor:pointer; line-height:16px;">+</button>
|
<button class="open-tab-btn" data-id="${ticket.id}" data-tn="${ticket.tn}" data-title="${App.escapeHtml(ticket.title || '(senza titolo)')}" onclick="App.openTab(${ticket.id}, '${ticket.tn}', this.dataset.title); event.stopPropagation();" title="Apri in scheda" style="display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; background:var(--accent-primary); color:#fff; border:none; border-radius:50%; font-size:10px; font-weight:800; font-family:sans-serif; margin-left:6px; cursor:pointer; line-height:16px;">+</button>
|
||||||
|
<button class="assign-open-tab-btn" data-id="${ticket.id}" data-tn="${ticket.tn}" data-title="${App.escapeHtml(ticket.title || '(senza titolo)')}" onclick="App.assignAndOpenTab(${ticket.id}, '${ticket.tn}', this.dataset.title); event.stopPropagation();" title="Assegna a me ed apri in scheda" style="display:inline-flex; align-items:center; justify-content:center; height:20px; padding:0 8px; background:var(--accent-primary); color:#fff; border:none; border-radius:var(--radius-full); font-size:11px; font-weight:600; font-family:inherit; margin-left:6px; cursor:pointer; gap:3px;">
|
||||||
|
👤+ Assegna & Scheda
|
||||||
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="ticket-meta-badges">
|
<div class="ticket-meta-badges">
|
||||||
<span class="badge badge-state" data-state-type="${(ticket.state_type || '').toLowerCase()}">${ticket.state_name}</span>
|
<span class="badge badge-state" data-state-type="${(ticket.state_type || '').toLowerCase()}">${ticket.state_name}</span>
|
||||||
@@ -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)
|
// Keydown listener for Ticket Detail shortcut (Save Quick Edit / Send Note)
|
||||||
const handleTicketDetailShortcut = (e) => {
|
const handleTicketDetailShortcut = (e) => {
|
||||||
if (!document.getElementById('qe-save')) {
|
if (!document.getElementById('qe-save')) {
|
||||||
|
|||||||
Reference in new issue
Block a user