SBI AI Analyzer

Markt- en branchinzicht per SBI-code — met uitgebreide payload (zoekterm, focus, locatie)

API: …

Kies een suggestie om de SBI-code te vullen — of vul de code zelf in.

Verplicht: gebruikt voor lokale context in de analyse.

Helpt suggesties uit de SBI-index te tonen in het resultaat.

Ctrl/Cmd ingedrukt voor meerdere opties.

IT Live-assistent

Zelfde motor als Diensten, verrijkt met de IT Live-diensten-database (tabellen + links). Noem bedrijfsnaam, postcode of domein voor KvK-/domeincheck. Antwoorden: Markdown (tabellen, lijsten). page_origin=sbi_analyzer

Bezig met analyseren…

Analyse-resultaten

'; } function displayResults(data) { lastReport = data; window.__itliveSbiReport = data; var html = '
'; html += '

Basisinformatie

'; html += '
SBI-code
' + escapeHtml(data.sbi_code || '—') + '
'; html += '
Locatie
' + escapeHtml(data.location || '—') + '
'; html += '

CBS-beschrijving: ' + escapeHtml(data.description || '—') + '

'; html += '

Sector: ' + escapeHtml(data.category || '—') + '

'; if (data.postal_code) html += '

Postcode: ' + escapeHtml(data.postal_code) + '

'; if (data.radius_km) html += '

Radius: ' + escapeHtml(String(data.radius_km)) + ' km

'; if (data.search_query) html += '

Zoekterm: ' + escapeHtml(data.search_query) + '

'; if (data.company_focus) html += '

Focus: ' + escapeHtml(data.company_focus) + '

'; if (data.search_hints && data.search_hints.length) { html += '

SBI-hints

'; data.search_hints.slice(0, 8).forEach(function (h) { html += '' + escapeHtml(h.code) + ' — ' + escapeHtml(h.label) + ''; }); html += '
'; } html += '

Tijd: ' + new Date(data.timestamp || Date.now()).toLocaleString('nl-NL') + '

'; html += '
'; if (data.analyses) { var order = ['market_analysis', 'competition', 'trends', 'recommendations']; var seen = {}; order.forEach(function (type) { if (data.analyses[type] !== undefined) { html += renderAnalysisCard(type, data.analyses[type]); seen[type] = true; } }); Object.keys(data.analyses).forEach(function (type) { if (!seen[type]) html += renderAnalysisCard(type, data.analyses[type]); }); } html += '
'; resultsContent.innerHTML = html; results.style.display = 'block'; var tb = document.getElementById('resultsToolbar'); if (tb) tb.style.display = 'flex'; try { results.scrollIntoView({ behavior: 'smooth', block: 'start' }); } catch (e) {} } form.addEventListener('submit', function (e) { e.preventDefault(); var sbiCode = document.getElementById('sbiCode').value.trim(); var location = document.getElementById('location').value.trim(); var sel = document.getElementById('analysisTypes'); var analysisTypes = []; for (var i = 0; i < sel.options.length; i++) { if (sel.options[i].selected) analysisTypes.push(sel.options[i].value); } if (!sbiCode || !location) { showError('SBI-code en locatie zijn verplicht'); return; } if (analysisTypes.length === 0) { showError('Selecteer minimaal één analysetype'); return; } var clientPayload = { notes: document.getElementById('extraContext').value.trim(), generated_at: new Date().toISOString() }; showLoading(true); hideMessages(); fetch(apiEndpoint, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ action: 'enhanced_analysis', sbi_code: sbiCode, location: location, analysis_types: JSON.stringify(analysisTypes), search_query: document.getElementById('searchQuery').value.trim(), company_focus: document.getElementById('companyFocus').value.trim(), postal_code: document.getElementById('postalCode').value.trim(), radius_km: document.getElementById('radiusKm').value || '25', extra_context: document.getElementById('extraContext').value.trim(), client_payload: JSON.stringify(clientPayload), include_kvk: '1', include_google: '1' }) }) .then(function (r) { return r.json(); }) .then(function (data) { if (data.success && data.data) { displayResults(data.data); showSuccess('Analyse geladen (lokale API v2 + CBS)'); } else { showError(data.error || 'Analyse mislukt'); displayMockResults(sbiCode, location, analysisTypes); } }) .catch(function (err) { console.error(err); showError('Netwerkfout — toon demo'); displayMockResults(sbiCode, location, analysisTypes); }) .finally(function () { showLoading(false); }); }); fetch(apiEndpoint + '?action=health_check').then(function (r) { return r.json(); }).then(function (data) { if (data.success) { apiBadge.textContent = 'API: ' + (data.version || 'ok') + (data.cbs_loaded ? ' · CBS geladen' : ''); } }).catch(function () { apiBadge.textContent = 'API: offline'; }); function sbiSend() { var input = document.getElementById('sbiUserInput'); if (!input) return; var txt = input.value.trim(); if (!txt) return; ensureProvisioned(); appendChat(txt, true); input.value = ''; appendChat('…', false, true); var typing = document.getElementById('sbiChatWindow').lastChild; var leadName = document.getElementById('chatLeadName'); var leadEmail = document.getElementById('chatLeadEmail'); var leadPhone = document.getElementById('chatLeadPhone'); fetch('/api/homepage-chat-bot.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ session_id: sessionId, message: txt, name: leadName ? leadName.value.trim() : '', email: leadEmail ? leadEmail.value.trim() : '', phone: leadPhone ? leadPhone.value.trim() : '', theme: 'day', page_origin: 'sbi_analyzer', context: { sbi_code: document.getElementById('sbiCode').value.trim(), location: document.getElementById('location').value.trim(), company_focus: document.getElementById('companyFocus').value.trim(), postal_code: document.getElementById('postalCode').value.trim(), search_query: document.getElementById('searchQuery').value.trim(), analysis_summary: lastReport ? ((lastReport.description || '') + ' | SBI ' + (lastReport.sbi_code || '')) : '' } }) }).then(function (r) { return r.json(); }).then(function (data) { if (typing && typing.parentNode) typing.parentNode.removeChild(typing); if (data && data.success && data.message) { appendChat(data.message, false); updateRegistrerenLink(); if (data.session_handoff && data.session_handoff.account_register_url) { var lr = document.getElementById('linkRegistreren'); var u = data.session_handoff.account_register_url; if (lr && u) lr.href = u; } } else { appendChat('Kon geen antwoord ophalen. Probeer later opnieuw.', false, true); } }).catch(function () { if (typing && typing.parentNode) typing.parentNode.removeChild(typing); appendChat('Chat tijdelijk niet bereikbaar.', false, true); }); } document.getElementById('sbiSendBtn').addEventListener('click', sbiSend); document.getElementById('sbiUserInput').addEventListener('keydown', function (ev) { if (ev.key === 'Enter') { ev.preventDefault(); sbiSend(); } }); (function prefillFromQuery() { var q = new URLSearchParams(window.location.search); var s = q.get('sbi') || q.get('sbi_code'); var l = q.get('locatie') || q.get('location'); if (s) document.getElementById('sbiCode').value = s.replace(/\D/g, '').slice(0, 5) || s; if (l) document.getElementById('location').value = l; })(); ['chatLeadName', 'chatLeadEmail', 'chatLeadPhone'].forEach(function (id) { var el = document.getElementById(id); if (el) el.addEventListener('input', updateRegistrerenLink); }); updateRegistrerenLink(); document.getElementById('btnDownloadHtml').addEventListener('click', function () { if (!lastReport) return; var fn = 'sbi-rapport-' + String(lastReport.sbi_code || 'onbekend').replace(/\W/g, '') + '-' + new Date().toISOString().slice(0, 10) + '.html'; triggerDownload(fn, 'text/html;charset=utf-8', buildReportHtmlDocument(lastReport)); showSuccess('HTML-rapport gedownload'); }); document.getElementById('btnDownloadJson').addEventListener('click', function () { if (!lastReport) return; var fn = 'sbi-rapport-' + String(lastReport.sbi_code || 'x').replace(/\W/g, '') + '-' + new Date().toISOString().slice(0, 10) + '.json'; triggerDownload(fn, 'application/json;charset=utf-8', JSON.stringify(lastReport, null, 2)); showSuccess('JSON gedownload'); }); document.getElementById('btnCopyText').addEventListener('click', function () { if (!lastReport) return; var t = reportToPlainText(lastReport); if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(t).then(function () { showSuccess('Tekst gekopieerd naar klembord'); }).catch(function () { window.prompt('Kopieer:', t); }); } else { window.prompt('Kopieer deze tekst:', t); } }); document.getElementById('btnPrint').addEventListener('click', function () { if (!lastReport) return; window.print(); }); })();
Platform Intelligence Hub Certificaten DB NACE/GMB Database Enrichment API AI: Ollama · OpenAI · Anthropic · Groq · HuggingFace