-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
33 lines (29 loc) · 1.23 KB
/
script.js
File metadata and controls
33 lines (29 loc) · 1.23 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
function updateQuotationPreview() {
const form = document.getElementById('quotationForm');
const name = form.name.value;
const email = form.email.value;
const company = form.company.value;
const attendees = parseInt(form.attendees.value) || 0;
const duration = parseInt(form.duration.value) || 0;
const location = form.location.value.toLowerCase();
const selectedServices = [...form.querySelectorAll('input[name="services"]:checked')];
let total = 0;
let serviceList = '';
selectedServices.forEach(service => {
const price = parseFloat(service.dataset.price);
total += price;
serviceList += `<li>${service.value} - $${price}</li>`;
});
// Example business logic
if (attendees > 50) total *= 0.9; // 10% discount
if (location.includes("remote")) total += 100; // remote surcharge
if (duration > 3) total += duration * 20; // extended duration cost
document.getElementById('quoteOutput').innerHTML = `
<p><strong>Name:</strong> ${name}</p>
<p><strong>Email:</strong> ${email}</p>
<p><strong>Company:</strong> ${company}</p>
<p><strong>Selected Services:</strong></p>
<ul>${serviceList}</ul>
<p><strong>Total Price:</strong> $${total.toFixed(2)}</p>
`;
}