make selectPlan available in compressed files

This commit is contained in:
Tobias Brunner 2025-07-16 11:07:43 +02:00
parent 92af0a9627
commit 384c626adb
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ

View file

@ -28,6 +28,25 @@ document.addEventListener('DOMContentLoaded', () => {
window.priceCalculator = new PriceCalculator();
}
});
// Global function for traditional plan selection (used by template buttons)
function selectPlan(element) {
const planId = element.getAttribute('data-plan-id');
const planName = element.getAttribute('data-plan-name');
// Find the plan dropdown in the contact form
const planDropdown = document.getElementById('id_choice');
if (planDropdown) {
// Find the option with matching plan id and select it
for (let i = 0; i < planDropdown.options.length; i++) {
const optionValue = planDropdown.options[i].value;
if (optionValue.startsWith(planId + '|')) {
planDropdown.selectedIndex = i;
break;
}
}
}
}
</script>
{% endcompress %}
{% endif %}