diff --git a/public/js/views/ticketDetail.js b/public/js/views/ticketDetail.js index 6da781d..d95aa1c 100644 --- a/public/js/views/ticketDetail.js +++ b/public/js/views/ticketDetail.js @@ -2906,6 +2906,11 @@ const TicketDetailView = { const hasEmailDraft = App.getDraft(id, 'email'); const emailBtnText = hasEmailDraft ? 'Continua mail' : 'Invia Email'; + const ticketRealAttachments = (attachments || []).filter(att => { + const fname = (att.filename || '').toLowerCase(); + return !fname.startsWith('file-1') && !fname.startsWith('file-2') && !fname.startsWith('file-3'); + }); + container.innerHTML = ` @@ -2931,6 +2936,11 @@ const TicketDetailView = { + ${ticketRealAttachments.length > 0 ? ` + + ` : ''}
${ticket.state_name} @@ -4289,6 +4299,16 @@ const TicketDetailView = { }); }); + const headerAttBtn = document.querySelector('.header-open-attachments-btn'); + if (headerAttBtn) { + headerAttBtn.addEventListener('click', (e) => { + e.stopPropagation(); + const firstBadge = document.querySelector('.attachment-badge'); + const firstSrc = firstBadge ? firstBadge.href : ''; + this.openImageLightbox(firstSrc); + }); + } + // Keydown listener for Ticket Detail shortcut (Save Quick Edit / Send Note) const handleTicketDetailShortcut = (e) => { if (!document.getElementById('qe-save')) {