diff --git a/iframe.html b/iframe.html index 1643547..cd287eb 100644 --- a/iframe.html +++ b/iframe.html @@ -1465,6 +1465,15 @@ font-size: 1rem; } + /* Warning styles for missing energy content */ + .dog-calculator-warning { + color: #e11d48; + font-weight: 500; + font-size: 1.2rem; + text-align: left; + cursor: help; + } + .dog-calculator-total-row { display: flex; justify-content: space-between; @@ -1845,6 +1854,7 @@ this.redistributePercentages(); this.renderFoodSource(foodSource); this.updateAddButton(); + this.updateRemoveButtons(); this.refreshAllPercentageUI(); } @@ -1868,6 +1878,7 @@ this.redistributePercentages(); this.updateFoodSourceNames(); this.updateAddButton(); + this.updateRemoveButtons(); this.refreshAllPercentageUI(); } @@ -2246,6 +2257,18 @@ } } + updateRemoveButtons() { + // Show/hide remove buttons based on whether we have more than one source + const hasMultipleSources = this.foodSources.length > 1; + + this.foodSources.forEach(fs => { + const removeBtn = document.getElementById(`remove-${fs.id}`); + if (removeBtn) { + removeBtn.style.display = hasMultipleSources ? 'block' : 'none'; + } + }); + } + renderFoodSource(foodSource) { const container = document.getElementById('foodSources'); if (!container) return; @@ -2254,14 +2277,13 @@
- ${this.foodSources.length > 1 ? `` : ''} +
-
Please enter a valid energy content
@@ -2273,6 +2295,7 @@
+
Please enter a valid energy content