From 0cbd3ccdfc4205c7a5ed84e0b8ef69cd3bc9aeb7 Mon Sep 17 00:00:00 2001 From: Gabriele Cimaschi Date: Wed, 29 Jul 2026 22:29:39 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20nella=20pagina=20di=20creazione=20di=20u?= =?UTF-8?q?n=20nuovo=20ticket,=20coda=20e=20cliente=20ora=20non=20sono=20p?= =?UTF-8?q?i=C3=B9=20precompilati=20dal=20primo=20campo=20della=20lista.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/views/ticketCreate.js | 37 +-------------------------------- 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/public/js/views/ticketCreate.js b/public/js/views/ticketCreate.js index 47ab892..f0f256d 100644 --- a/public/js/views/ticketCreate.js +++ b/public/js/views/ticketCreate.js @@ -331,7 +331,7 @@ const TicketCreateView = { } } else { setTimeout(async () => { - // 1. Owner & Responsible pre-population with active agent + // Active agent pre-population for Owner & Responsible const currentAgentId = localStorage.getItem('activeAgentId') || '1'; const activeAgent = (App.lookups.users || []).find(u => String(u.id) === String(currentAgentId)); if (activeAgent) { @@ -344,41 +344,6 @@ const TicketCreateView = { responsibleIdInput.value = activeAgent.id; } } - - // 2. Customer User pre-population with first match - try { - const companies = await App.api('/api/customer-companies/search?q='); - if (companies.length > 0 && customerIdInput && companySearchInput) { - const defaultCompany = companies[0]; - customerIdInput.value = defaultCompany.customer_id; - companySearchInput.value = defaultCompany.customer_id; - - // Search users for this company - const users = await App.api(`/api/customer-users/search?q=&customer_company_id=${encodeURIComponent(defaultCompany.customer_id)}`); - if (users.length > 0 && userSearchInput && customerUserIdInput) { - const defaultUser = users[0]; - userSearchInput.value = `${defaultUser.first_name} ${defaultUser.last_name}`; - customerUserIdInput.value = defaultUser.login; - } else { - // Fallback: use company name as customer user ID - userSearchInput.value = defaultCompany.name; - customerUserIdInput.value = defaultCompany.customer_id; - } - } - } catch (err) { - console.error('Error pre-populating defaults:', err); - } - - // 3. Queue pre-population - try { - const queues = await App.api('/api/queues/search?q='); - if (queues.length > 0 && queueSearchInput && queueIdInput) { - queueSearchInput.value = queues[0].name; - queueIdInput.value = queues[0].id; - } - } catch (err) { - console.error('Error pre-populating queues:', err); - } }, 50); }