merge compute and sla price into managed service price

This commit is contained in:
Tobias Brunner 2025-06-04 16:22:47 +02:00
parent 2da6285800
commit 15ede53cc3
No known key found for this signature in database
2 changed files with 8 additions and 13 deletions

View file

@ -54,8 +54,7 @@ class PriceCalculator {
this.planDescription = document.getElementById('planDescription');
this.planCpus = document.getElementById('planCpus');
this.planMemory = document.getElementById('planMemory');
this.computePrice = document.getElementById('computePrice');
this.servicePrice = document.getElementById('servicePrice');
this.managedServicePrice = document.getElementById('managedServicePrice');
this.storagePriceEl = document.getElementById('storagePrice');
this.storageAmount = document.getElementById('storageAmount');
this.totalPrice = document.getElementById('totalPrice');
@ -262,7 +261,7 @@ class PriceCalculator {
availablePlans.forEach(plan => {
const option = document.createElement('option');
option.value = JSON.stringify(plan);
option.textContent = `${plan.compute_plan} - ${plan.vcpus} vCPUs, ${plan.ram} GB RAM (CHF ${parseFloat(plan.final_price).toFixed(2)}/month)`;
option.textContent = `${plan.compute_plan} - ${plan.vcpus} vCPUs, ${plan.ram} GB RAM`;
this.planSelect.appendChild(option);
});
}
@ -361,12 +360,12 @@ class PriceCalculator {
// Calculate pricing
const computePriceValue = parseFloat(plan.compute_plan_price);
const servicePriceValue = parseFloat(plan.sla_price);
const managedServicePrice = computePriceValue + servicePriceValue;
const storagePriceValue = storage * this.storagePrice;
const totalPriceValue = computePriceValue + servicePriceValue + storagePriceValue;
const totalPriceValue = managedServicePrice + storagePriceValue;
// Update pricing display
if (this.computePrice) this.computePrice.textContent = computePriceValue.toFixed(2);
if (this.servicePrice) this.servicePrice.textContent = servicePriceValue.toFixed(2);
if (this.managedServicePrice) this.managedServicePrice.textContent = managedServicePrice.toFixed(2);
if (this.storagePriceEl) this.storagePriceEl.textContent = storagePriceValue.toFixed(2);
if (this.storageAmount) this.storageAmount.textContent = storage;
if (this.totalPrice) this.totalPrice.textContent = totalPriceValue.toFixed(2);

View file

@ -269,15 +269,11 @@
<!-- Pricing Breakdown -->
<div class="border-top pt-3">
<div class="d-flex justify-content-between mb-2">
<span>Compute Plan</span>
<span class="fw-bold">CHF <span id="computePrice">0.00</span></span>
<span>Managed Service (incl. Compute)</span>
<span class="fw-bold">CHF <span id="managedServicePrice">0.00</span></span>
</div>
<div class="d-flex justify-content-between mb-2">
<span>Service Price</span>
<span class="fw-bold">CHF <span id="servicePrice">0.00</span></span>
</div>
<div class="d-flex justify-content-between mb-2">
<span>Storage (<span id="storageAmount">20</span> GB)</span>
<span>Storage - <span id="storageAmount">20</span> GB</span>
<span class="fw-bold">CHF <span id="storagePrice">0.00</span></span>
</div>
<hr>