Spaces:
Running
Running
For some reason the calculate my savings button stopped working - Follow Up Deployment
Browse files- index.html +91 -3
index.html
CHANGED
|
@@ -327,6 +327,36 @@
|
|
| 327 |
<button id="calculate-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 px-4 rounded-md font-medium transition duration-300">
|
| 328 |
Calculate My Savings
|
| 329 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
</div>
|
| 331 |
</div>
|
| 332 |
|
|
@@ -595,12 +625,13 @@
|
|
| 595 |
<a href="https://www.youtube.com/channel/example" target="_blank" class="flex items-center text-white hover:text-blue-100 transition duration-300">
|
| 596 |
<i class="fab fa-youtube text-2xl mr-2"></i> Watch Our YouTube Series
|
| 597 |
</a>
|
| 598 |
-
<a href="https://www.instagram.com/example" target="_blank" class="flex items-center text-white hover:text-blue-100 transition duration-300">
|
| 599 |
-
<i class="fab fa-instagram text-2xl mr-2"></i> Follow on Instagram
|
| 600 |
-
</a>
|
| 601 |
<a href="https://www.facebook.com/groups/californiatomadeira" target="_blank" class="flex items-center text-white hover:text-blue-100 transition duration-300">
|
| 602 |
<i class="fab fa-facebook-f text-2xl mr-2"></i> Join Facebook Group
|
| 603 |
</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 604 |
</div>
|
| 605 |
</div>
|
| 606 |
</section>
|
|
@@ -698,6 +729,63 @@
|
|
| 698 |
<!-- Calculator functionality -->
|
| 699 |
<script>
|
| 700 |
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 701 |
// Sync range inputs with number inputs
|
| 702 |
const syncInputs = (rangeId, numberId) => {
|
| 703 |
const rangeInput = document.getElementById(rangeId);
|
|
|
|
| 327 |
<button id="calculate-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 px-4 rounded-md font-medium transition duration-300">
|
| 328 |
Calculate My Savings
|
| 329 |
</button>
|
| 330 |
+
|
| 331 |
+
<div id="report-form" class="hidden mt-6 space-y-4">
|
| 332 |
+
<div>
|
| 333 |
+
<label for="name" class="block text-sm font-medium text-gray-700">Full Name</label>
|
| 334 |
+
<input type="text" id="name" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 335 |
+
</div>
|
| 336 |
+
<div>
|
| 337 |
+
<label for="email" class="block text-sm font-medium text-gray-700">Email Address</label>
|
| 338 |
+
<input type="email" id="email" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 339 |
+
</div>
|
| 340 |
+
<div class="flex">
|
| 341 |
+
<div class="w-1/4 mr-2">
|
| 342 |
+
<label for="country-code" class="block text-sm font-medium text-gray-700">Country Code</label>
|
| 343 |
+
<select id="country-code" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 344 |
+
<option value="1" selected>USA (+1)</option>
|
| 345 |
+
<option value="44">UK (+44)</option>
|
| 346 |
+
<option value="33">France (+33)</option>
|
| 347 |
+
<option value="49">Germany (+49)</option>
|
| 348 |
+
<option value="351">Portugal (+351)</option>
|
| 349 |
+
</select>
|
| 350 |
+
</div>
|
| 351 |
+
<div class="flex-1">
|
| 352 |
+
<label for="phone" class="block text-sm font-medium text-gray-700">Phone Number</label>
|
| 353 |
+
<input type="tel" id="phone" class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500">
|
| 354 |
+
</div>
|
| 355 |
+
</div>
|
| 356 |
+
<button type="submit" class="w-full bg-green-600 hover:bg-green-700 text-white py-3 px-4 rounded-md font-medium transition duration-300">
|
| 357 |
+
Submit Report Request
|
| 358 |
+
</button>
|
| 359 |
+
</div>
|
| 360 |
</div>
|
| 361 |
</div>
|
| 362 |
|
|
|
|
| 625 |
<a href="https://www.youtube.com/channel/example" target="_blank" class="flex items-center text-white hover:text-blue-100 transition duration-300">
|
| 626 |
<i class="fab fa-youtube text-2xl mr-2"></i> Watch Our YouTube Series
|
| 627 |
</a>
|
|
|
|
|
|
|
|
|
|
| 628 |
<a href="https://www.facebook.com/groups/californiatomadeira" target="_blank" class="flex items-center text-white hover:text-blue-100 transition duration-300">
|
| 629 |
<i class="fab fa-facebook-f text-2xl mr-2"></i> Join Facebook Group
|
| 630 |
</a>
|
| 631 |
+
<a href="https://www.instagram.com/example" target="_blank" class="flex items-center text-white hover:text-blue-100 transition duration-300">
|
| 632 |
+
<i class="fab fa-instagram text-2xl mr-2"></i> Follow on Instagram
|
| 633 |
+
</a>
|
| 634 |
+
|
| 635 |
</div>
|
| 636 |
</div>
|
| 637 |
</section>
|
|
|
|
| 729 |
<!-- Calculator functionality -->
|
| 730 |
<script>
|
| 731 |
document.addEventListener('DOMContentLoaded', function() {
|
| 732 |
+
// Show report form when calculate button is clicked
|
| 733 |
+
document.getElementById('calculate-btn').addEventListener('click', function() {
|
| 734 |
+
// First calculate the savings (existing functionality)
|
| 735 |
+
const housing = parseFloat(document.getElementById('housing').value);
|
| 736 |
+
const healthcare = parseFloat(document.getElementById('healthcare').value);
|
| 737 |
+
const groceries = parseFloat(document.getElementById('groceries').value);
|
| 738 |
+
const taxes = parseFloat(document.getElementById('taxes').value);
|
| 739 |
+
|
| 740 |
+
const madeiraHousing = housing * 0.3;
|
| 741 |
+
const madeiraHealthcare = healthcare * 0.125;
|
| 742 |
+
const madeiraGroceries = groceries * 0.4;
|
| 743 |
+
const madeiraTaxes = 0;
|
| 744 |
+
|
| 745 |
+
const savingsHousing = housing - madeiraHousing;
|
| 746 |
+
const savingsHealthcare = healthcare - madeiraHealthcare;
|
| 747 |
+
const savingsGroceries = groceries - madeiraGroceries;
|
| 748 |
+
const savingsTaxes = taxes - madeiraTaxes;
|
| 749 |
+
|
| 750 |
+
const calTotal = housing + healthcare + groceries + taxes;
|
| 751 |
+
const madeiraTotal = madeiraHousing + madeiraHealthcare + madeiraGroceries + madeiraTaxes;
|
| 752 |
+
const savingsTotal = calTotal - madeiraTotal;
|
| 753 |
+
const annualSavings = savingsTotal * 12;
|
| 754 |
+
|
| 755 |
+
// Update results display
|
| 756 |
+
document.getElementById('cal-housing').textContent = housing.toLocaleString();
|
| 757 |
+
document.getElementById('madeira-housing').textContent = madeiraHousing.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 758 |
+
document.getElementById('savings-housing').textContent = savingsHousing.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 759 |
+
|
| 760 |
+
document.getElementById('cal-healthcare').textContent = healthcare.toLocaleString();
|
| 761 |
+
document.getElementById('madeira-healthcare').textContent = madeiraHealthcare.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 762 |
+
document.getElementById('savings-healthcare').textContent = savingsHealthcare.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 763 |
+
|
| 764 |
+
document.getElementById('cal-groceries').textContent = groceries.toLocaleString();
|
| 765 |
+
document.getElementById('madeira-groceries').textContent = madeiraGroceries.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 766 |
+
document.getElementById('savings-groceries').textContent = savingsGroceries.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 767 |
+
|
| 768 |
+
document.getElementById('cal-taxes').textContent = taxes.toLocaleString();
|
| 769 |
+
document.getElementById('madeira-taxes').textContent = madeiraTaxes.toLocaleString();
|
| 770 |
+
document.getElementById('savings-taxes').textContent = savingsTaxes.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 771 |
+
|
| 772 |
+
document.getElementById('cal-total').textContent = calTotal.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 773 |
+
document.getElementById('madeira-total').textContent = madeiraTotal.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 774 |
+
document.getElementById('savings-total').textContent = savingsTotal.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 775 |
+
|
| 776 |
+
document.getElementById('annual-savings').textContent = annualSavings.toLocaleString(undefined, {maximumFractionDigits: 0});
|
| 777 |
+
|
| 778 |
+
// Show results
|
| 779 |
+
document.getElementById('results-placeholder').classList.add('hidden');
|
| 780 |
+
document.getElementById('results-container').classList.remove('hidden');
|
| 781 |
+
|
| 782 |
+
// Show the report form
|
| 783 |
+
document.getElementById('report-form').classList.remove('hidden');
|
| 784 |
+
|
| 785 |
+
// Scroll to results for better UX
|
| 786 |
+
document.getElementById('results-container').scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
| 787 |
+
});
|
| 788 |
+
|
| 789 |
// Sync range inputs with number inputs
|
| 790 |
const syncInputs = (rangeId, numberId) => {
|
| 791 |
const rangeInput = document.getElementById(rangeId);
|