From 8d24759a15a2431dc2e0cbd166fae1781290559b Mon Sep 17 00:00:00 2001 From: Gabriele Cimaschi Date: Tue, 25 Aug 2026 23:24:48 +0200 Subject: [PATCH] feat: aggiunta ricerca spudorata. progress: ripreso con il tentativo di invio delle mail che non creino nuovi ticket --- activityDb.js | 17 + public/css/style.css | 7 +- public/index.html | 23 + public/js/app.js | 9 + public/js/components/filters.js | 25 +- public/js/views/envConfig.js | 315 +++++++++++ public/js/views/mailManagement.js | 77 +++ public/js/views/ricercaSpudorata.js | 777 ++++++++++++++++++++++++++++ public/js/views/ticketCreate.js | 2 +- public/js/views/ticketDetail.js | 2 +- public/js/views/ticketList.js | 4 +- routes/config.js | 147 ++++++ routes/email.js | 119 ++++- routes/groups.js | 13 +- routes/tickets.js | 157 ++++-- server.js | 2 + utils/graphMailer.js | 59 ++- utils/smtpMailer.js | 4 +- 18 files changed, 1661 insertions(+), 98 deletions(-) create mode 100644 public/js/views/envConfig.js create mode 100644 public/js/views/ricercaSpudorata.js create mode 100644 routes/config.js diff --git a/activityDb.js b/activityDb.js index 795990a..df6e4d8 100644 --- a/activityDb.js +++ b/activityDb.js @@ -106,6 +106,17 @@ db.exec(` ) `); +db.exec(` + CREATE TABLE IF NOT EXISTS env_history ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + agent_id INTEGER NOT NULL DEFAULT 1, + agent_name TEXT NOT NULL DEFAULT '', + content TEXT NOT NULL, + note TEXT NOT NULL DEFAULT '', + created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) + ) +`); + try { db.exec(`ALTER TABLE dashboard_chart_lines ADD COLUMN color TEXT`); } catch (e) { @@ -154,6 +165,12 @@ try { // Column already exists } +try { + db.exec(`ALTER TABLE agent_settings ADD COLUMN use_agent_sender INTEGER NOT NULL DEFAULT 0`); +} catch (e) { + // Column already exists +} + /** * Generate a UUID v7 (time-ordered). */ diff --git a/public/css/style.css b/public/css/style.css index 1b094f9..183c8ef 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1878,15 +1878,17 @@ body { position: absolute; top: 100%; left: 0; - right: 0; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-md); - max-height: 220px; + max-height: 280px; overflow-y: auto; z-index: 1000; box-shadow: var(--shadow-lg); backdrop-filter: blur(8px); + min-width: 480px; + width: max-content; + max-width: 85vw; } .autocomplete-suggestion-item { @@ -1896,6 +1898,7 @@ body { font-size: 0.85rem; color: var(--text-primary); transition: all var(--transition-fast); + white-space: nowrap; } .autocomplete-suggestion-item:hover { diff --git a/public/index.html b/public/index.html index 6faea14..9c6ed50 100644 --- a/public/index.html +++ b/public/index.html @@ -70,6 +70,16 @@ +
  • + + + + + + + Ricerca Spudorata + +
  • @@ -111,6 +121,17 @@ Gestione Mail
  • +
  • + + + + + + + + Modifica .env + +
  • @@ -216,6 +237,7 @@ + @@ -224,6 +246,7 @@ + diff --git a/public/js/app.js b/public/js/app.js index cef1e2e..6e7f707 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -295,6 +295,10 @@ const App = { titleEl.textContent = 'Ticket a mio carico'; TicketListView.render(); + } else if (hash === '#/ricerca-spudorata') { + titleEl.textContent = 'Ricerca Spudorata'; + RicercaSpudorataView.render(); + } else if (hash === '#/tickets/new') { document.getElementById('nav-new-ticket')?.classList.add('active'); titleEl.textContent = 'Nuovo Ticket'; @@ -320,6 +324,11 @@ const App = { titleEl.textContent = 'Gestione Mail'; MailManagementView.render(); + } else if (hash === '#/config-env') { + document.getElementById('nav-config-env')?.classList.add('active'); + titleEl.textContent = 'Modifica .env'; + EnvConfigView.render(); + } else if (hash === '#/time-accounting') { document.getElementById('nav-time-accounting')?.classList.add('active'); titleEl.textContent = 'Storico consuntivazione'; diff --git a/public/js/components/filters.js b/public/js/components/filters.js index f0ff1f0..53f5ed6 100644 --- a/public/js/components/filters.js +++ b/public/js/components/filters.js @@ -23,6 +23,15 @@ const Filters = { customer_user_id: '', date_from: '', date_to: '', + }, + spudorata: { + queue_id: '', + state_id: '', + priority_id: '', + user_id: '', + customer_user_id: '', + date_from: '', + date_to: '', } }, @@ -38,11 +47,15 @@ const Filters = { // Dynamic state getter based on active mode get state() { - return this.allStates[this.currentMode]; + return this.allStates[this.currentMode] || this.allStates.general; }, set state(val) { - this.allStates[this.currentMode] = val; + if (this.allStates[this.currentMode]) { + this.allStates[this.currentMode] = val; + } else { + this.allStates.general = val; + } }, /** Load saved filters from localStorage */ @@ -56,6 +69,10 @@ const Filters = { if (savedMy) { Object.assign(this.allStates.my, JSON.parse(savedMy)); } + const savedSpudorata = localStorage.getItem('otrs_turbo_filters_spudorata'); + if (savedSpudorata) { + Object.assign(this.allStates.spudorata, JSON.parse(savedSpudorata)); + } // Always sync mode 'my' user_id to activeAgentId const activeAgentId = localStorage.getItem('activeAgentId') || '1'; this.allStates.my.user_id = activeAgentId; @@ -222,7 +239,7 @@ const Filters = { ${App.escapeHtml(queueLabel)} ▼ -