diff --git a/site/public/order/dot-compliance/index.html b/site/public/order/dot-compliance/index.html index 4de9755..ac2a97c 100644 --- a/site/public/order/dot-compliance/index.html +++ b/site/public/order/dot-compliance/index.html @@ -568,6 +568,34 @@ preSelect.forEach(function(slug) { var cb = document.querySelector('input[data-slug="' + slug + '"]'); if (cb) cb.checked = true; }); + +// Smart bundle promotion: if 3+ individual federal services are selected, +// replace them with the bundle (better value) +if (preSelect.length >= 3) { + var bundleCb = document.querySelector('input[data-slug="dot-full-compliance"]'); + if (bundleCb) { + var bundleComponents = (bundleCb.dataset.bundle || "").split(","); + var selectedInBundle = preSelect.filter(function(s) { return bundleComponents.indexOf(s) >= 0; }); + if (selectedInBundle.length >= 2) { + bundleCb.checked = true; + // Uncheck the individual components the bundle covers + bundleComponents.forEach(function(slug) { + var cb = document.querySelector('input[data-slug="' + slug + '"]'); + if (cb) cb.checked = false; + }); + } + } +} + +// After pre-selection, trigger bundle uncheck logic for any checked bundles +document.querySelectorAll("input[data-bundle]:checked").forEach(function(bundleCb) { + var components = (bundleCb.dataset.bundle || "").split(","); + components.forEach(function(slug) { + var cb = document.querySelector('input[data-slug="' + slug + '"]'); + if (cb && cb.checked) cb.checked = false; + }); +}); + if (preSelect.length) updateTotal(); // Submit