hide addons when not available
This commit is contained in:
parent
a8f204dcb4
commit
8c04166183
2 changed files with 23 additions and 4 deletions
|
@ -525,16 +525,35 @@ Please contact me with next steps for ordering this configuration.`;
|
|||
|
||||
// Update addons based on current configuration
|
||||
updateAddons() {
|
||||
if (!this.addonsContainer || !this.addonsData) return;
|
||||
if (!this.addonsContainer || !this.addonsData) {
|
||||
// Hide addons section if no container or data
|
||||
const addonsSection = document.getElementById('addonsSection');
|
||||
if (addonsSection) addonsSection.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
const serviceLevel = document.querySelector('input[name="serviceLevel"]:checked')?.value;
|
||||
if (!serviceLevel || !this.addonsData[serviceLevel]) return;
|
||||
if (!serviceLevel || !this.addonsData[serviceLevel]) {
|
||||
// Hide addons section if no service level or no addons for this level
|
||||
const addonsSection = document.getElementById('addonsSection');
|
||||
if (addonsSection) addonsSection.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
const addons = this.addonsData[serviceLevel];
|
||||
|
||||
// Clear existing addons
|
||||
this.addonsContainer.innerHTML = '';
|
||||
|
||||
// Show or hide addons section based on availability
|
||||
const addonsSection = document.getElementById('addonsSection');
|
||||
if (addons && addons.length > 0) {
|
||||
if (addonsSection) addonsSection.style.display = 'block';
|
||||
} else {
|
||||
if (addonsSection) addonsSection.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
// Add each addon
|
||||
addons.forEach(addon => {
|
||||
const addonElement = document.createElement('div');
|
||||
|
|
|
@ -276,8 +276,8 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Addons Section -->
|
||||
<div class="mb-4">
|
||||
<!-- Addons Section - Hidden by default, shown by JS if addons exist -->
|
||||
<div class="mb-4" id="addonsSection" style="display: none;">
|
||||
<label class="form-label">Add-ons (Optional)</label>
|
||||
<div id="addonsContainer">
|
||||
<!-- Add-ons will be dynamically populated here -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue