document.getElementById("package").addEventListener("change", updateCost);
document.getElementById("duration").addEventListener("change", updateCost);
function updateCost() {
const packageValue = document.getElementById("package").value;
const duration = parseInt(document.getElementById("duration").value);
let cost = 0;
if (packageValue === "engagement") cost = 36000;
if (packageValue === "website") cost = 36000;
if (packageValue === "both") cost = 72000;
// Adjust for duration
cost = (cost / 12) * duration;
return cost.toFixed(2);
}
document.getElementById("roiForm").addEventListener("submit", function (e) {
e.preventDefault();
// Get User Inputs
const revenue = parseFloat(document.getElementById("currentRevenue").value);
const avgCustomerValue = parseFloat(document.getElementById("avgCustomerValue").value);
const marketingSpend = parseFloat(document.getElementById("marketingSpend").value);
const currentConversionRate = parseFloat(document.getElementById("currentConversionRate").value) / 100;
const costOfServices = parseFloat(updateCost());
// Get Improvements
const leadImprovement = parseFloat(document.getElementById("leadImprovement").value) / 100;
const conversionImprovement = parseFloat(document.getElementById("conversionImprovement").value) / 100;
// Calculate ROI
const currentLeads = revenue / avgCustomerValue;
const newLeads = currentLeads * (1 + leadImprovement);
const newConversions = newLeads * (currentConversionRate + conversionImprovement);
const newRevenue = newConversions * avgCustomerValue;
const totalCost = marketingSpend + costOfServices;
const roi = ((newRevenue - revenue - totalCost) / totalCost) * 100;
// Display Results
document.getElementById("roiOutput").innerHTML = `
Package Cost: $${costOfServices}
Projected New Revenue: $${newRevenue.toLocaleString()}
Total ROI: ${roi.toFixed(2)}%
`;
document.querySelector(".result-container").style.display = "block";
});