From df203d8de35d7c53bf9904544492f8ac73c6eb55 Mon Sep 17 00:00:00 2001 From: Gabriele Cimaschi Date: Sun, 12 Jul 2026 23:27:18 +0200 Subject: [PATCH] fix: corretto posizionamento barra selezione rapida dopo l'aggiunta delle schede --- public/css/style.css | 2 +- public/js/app.js | 18 +++++++++++++++ public/js/views/emailCompose.js | 16 +++++++++++++ public/js/views/ticketDetail.js | 40 ++++++++++++++++----------------- 4 files changed, 54 insertions(+), 22 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index e50b9a5..ee0bb9c 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1167,7 +1167,7 @@ body { border-radius: var(--radius-lg); animation: slideDown 0.2s ease-out; position: sticky; - top: var(--topbar-height); + top: var(--topbar-total-height, var(--topbar-height)); z-index: 45; box-shadow: var(--shadow-md); } diff --git a/public/js/app.js b/public/js/app.js index 999aba0..2046006 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -48,6 +48,7 @@ const App = { delete this.drafts[ticketId]; } localStorage.setItem('otrs_turbo_drafts', JSON.stringify(this.drafts)); + this.renderTabs(); } }, @@ -98,6 +99,7 @@ const App = { if (!bar) return; if (this.tabs.length === 0) { bar.style.display = 'none'; + this.updateHeaderHeight(); return; } bar.style.display = 'flex'; @@ -106,14 +108,26 @@ const App = { bar.innerHTML = this.tabs.map(t => { const isActive = currentHash === `#/tickets/${t.id}`; + const hasEmailDraft = this.getDraft(t.id, 'email'); + const emailIconHtml = hasEmailDraft ? `✉️` : ''; const displayTitle = t.title ? (t.title.length > 25 ? t.title.substring(0, 22) + '...' : t.title) : `#${t.tn}`; return `
+ ${emailIconHtml} ${App.escapeHtml(displayTitle)}
`; }).join(''); + this.updateHeaderHeight(); + }, + + updateHeaderHeight() { + const topbar = document.getElementById('topbar'); + if (topbar) { + const height = topbar.offsetHeight; + document.documentElement.style.setProperty('--topbar-total-height', `${height}px`); + } }, get currentAgentId() { @@ -202,6 +216,9 @@ const App = { } // Initial route + window.addEventListener('resize', () => this.updateHeaderHeight()); + setTimeout(() => this.updateHeaderHeight(), 100); + if (!window.location.hash || window.location.hash === '#/') { window.location.hash = '#/dashboard'; } else { @@ -226,6 +243,7 @@ const App = { } this.renderTabs(); + this.updateHeaderHeight(); const container = document.getElementById('view-container'); if (container) { diff --git a/public/js/views/emailCompose.js b/public/js/views/emailCompose.js index 4c37cb2..4e4c080 100644 --- a/public/js/views/emailCompose.js +++ b/public/js/views/emailCompose.js @@ -606,6 +606,13 @@ const EmailCompose = (() => { if (currentOptions.ticketId) { App.clearDraft(currentOptions.ticketId, 'email'); } + const btn = document.getElementById('btn-open-email-compose'); + if (btn) { + const svg = btn.querySelector('svg'); + btn.innerHTML = ''; + if (svg) btn.appendChild(svg); + btn.appendChild(document.createTextNode(' Invia Email')); + } const overlay = document.getElementById('email-compose-overlay'); if (overlay) overlay.remove(); if (quillEditor) { quillEditor = null; } @@ -636,6 +643,15 @@ const EmailCompose = (() => { attachments: [...attachmentsList], options: currentOptions }); + + const btn = document.getElementById('btn-open-email-compose'); + if (btn) { + const svg = btn.querySelector('svg'); + btn.innerHTML = ''; + if (svg) btn.appendChild(svg); + btn.appendChild(document.createTextNode(' Continua mail')); + } + App.renderTabs(); } return { open, close, saveDraft }; diff --git a/public/js/views/ticketDetail.js b/public/js/views/ticketDetail.js index 10947b2..9e3c5f2 100644 --- a/public/js/views/ticketDetail.js +++ b/public/js/views/ticketDetail.js @@ -103,6 +103,9 @@ const TicketDetailView = { customer_last: ticket.customer_last, }; + const hasEmailDraft = App.getDraft(id, 'email'); + const emailBtnText = hasEmailDraft ? 'Continua mail' : 'Invia Email'; + container.innerHTML = ` @@ -227,7 +230,7 @@ const TicketDetailView = {