-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
66 lines (57 loc) · 2.41 KB
/
Copy pathmain.js
File metadata and controls
66 lines (57 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const navLinks = document.querySelectorAll('a[href^="#"]');
const briefForm = document.querySelector('#briefForm');
const leadGoal = document.querySelector('#leadGoal');
const leadGoalValue = document.querySelector('#leadGoalValue');
const packageName = document.querySelector('#packageName');
const packageSummary = document.querySelector('#packageSummary');
const timeline = document.querySelector('#timeline');
const scope = document.querySelector('#scope');
const priority = document.querySelector('#priority');
const packages = {
service: {
name: 'Lokálny growth web + AI predaj',
priority: 'Získať viac telefonátov a dopytov',
},
shop: {
name: 'Produktový predajný systém',
priority: 'Premeniť návštevníkov na objednávky',
},
startup: {
name: 'SaaS launch kit s AI onboardingom',
priority: 'Vysvetliť produkt a zbierať kvalifikované leady',
},
};
const needLabels = {
web: 'landing page alebo redesign',
sales: 'AI predajný skript',
maintenance: 'mesačná údržba',
automation: 'automatizácie a kódovanie',
};
navLinks.forEach((link) => {
link.addEventListener('click', (event) => {
const targetId = link.getAttribute('href');
const target = document.querySelector(targetId);
if (!target) return;
event.preventDefault();
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
});
function updateRecommendation() {
if (!briefForm) return;
const formData = new FormData(briefForm);
const businessType = formData.get('businessType');
const selectedNeeds = formData.getAll('needs');
const leadTarget = Number(leadGoal.value);
const selectedPackage = packages[businessType];
const modules = selectedNeeds.length || 1;
const weekEstimate = modules >= 4 ? '4–6 týždňov' : modules === 3 ? '3–4 týždne' : '2–3 týždne';
const focus = selectedNeeds.map((need) => needLabels[need]).join(', ');
leadGoalValue.textContent = `${leadTarget} dopytov`;
packageName.textContent = selectedPackage.name;
packageSummary.textContent = `Odporúčaný štart: ${focus}. Cieľ je pripraviť systém, ktorý zvládne približne ${leadTarget} dopytov mesačne.`;
timeline.textContent = weekEstimate;
scope.textContent = `${modules} ${modules === 1 ? 'modul' : modules < 5 ? 'moduly' : 'modulov'}`;
priority.textContent = selectedPackage.priority;
}
briefForm?.addEventListener('input', updateRecommendation);
updateRecommendation();