Maintenance Plan Form
function updateTotals() {
const propertyCount = parseInt(document.getElementById('propertyCount').value) || 1;
let totalPrice = 0;
let totalServices = 0;
document.querySelectorAll('.service').forEach(serviceCheckbox => {
if (serviceCheckbox.checked) {
const rate = parseFloat(serviceCheckbox.getAttribute('data-rate'));
const frequency = parseInt(serviceCheckbox.nextElementSibling.value) || 1;
totalPrice += rate * frequency * propertyCount;
totalServices += frequency * propertyCount;
}
});
document.getElementById('priceDisplay').innerText = `Total Price: $${totalPrice.toFixed(2)}`;
document.getElementById('serviceCount').innerText = `Total Services: ${totalServices}`;
}
document.querySelectorAll('.service').forEach(serviceCheckbox => {
serviceCheckbox.addEventListener('change', updateTotals);
});
document.querySelectorAll('.frequency-select').forEach(select => {
select.addEventListener('change', updateTotals);
});
document.get