diff --git a/VERSION b/VERSION index 0f434c9..6f898f5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.89 +2.2.90 diff --git a/app/modules/telefoni/templates/log.html b/app/modules/telefoni/templates/log.html index 020ac8d..6736482 100644 --- a/app/modules/telefoni/templates/log.html +++ b/app/modules/telefoni/templates/log.html @@ -630,6 +630,47 @@ function openLinkContactModal(callId, mode = 'contact') { }, 200); } +function quickNewContact(callId, number) { + // Open the link-contact modal but scroll to / pre-fill the 'opret ny kontakt' form. + linkContactState.callId = Number(callId); + linkContactState.number = String(number || '').trim(); + linkContactState.mode = 'contact'; + + const ctx = document.getElementById('linkContactContext'); + const phoneInput = document.getElementById('newContactPhone'); + const firstNameInput = document.getElementById('newContactFirstName'); + const lastNameInput = document.getElementById('newContactLastName'); + const emailInput = document.getElementById('newContactEmail'); + const titleInput = document.getElementById('newContactTitle'); + const searchInput = document.getElementById('linkContactSearch'); + const companySearchInput = document.getElementById('linkCompanySearch'); + + if (ctx) ctx.textContent = `Opkald: ${linkContactState.number || ('#' + callId)}`; + if (phoneInput) phoneInput.value = linkContactState.number; + if (firstNameInput) firstNameInput.value = ''; + if (lastNameInput) lastNameInput.value = ''; + if (emailInput) emailInput.value = ''; + if (titleInput) titleInput.value = ''; + if (searchInput) searchInput.value = ''; + if (companySearchInput) companySearchInput.value = ''; + setLinkContactSelected(null, ''); + setLinkCompanySelected(null, ''); + renderLinkContactResults([]); + renderCompanyResults([]); + + const modal = getLinkContactModalInstance(); + if (modal) modal.show(); + + // Scroll to the "Opret ny kontakt" section after modal opens + setTimeout(() => { + const newSection = document.getElementById('newContactFirstName'); + if (newSection) { + newSection.scrollIntoView({ behavior: 'smooth', block: 'center' }); + newSection.focus(); + } + }, 300); +} + async function unlinkContact(callId) { if (!confirm('Fjern link til kontakt for dette opkald?')) return; try { @@ -951,9 +992,17 @@ async function loadCalls() { ${r.contact_company ? `