Set vm base price in js also
This commit is contained in:
parent
00b434efb9
commit
e6de90e431
5 changed files with 8 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
from cms.plugin_base import CMSPluginBase
|
||||
from cms.plugin_pool import plugin_pool
|
||||
from django.conf import settings
|
||||
|
||||
from .cms_models import (
|
||||
DCLBannerItemPluginModel, DCLBannerListPluginModel, DCLContactPluginModel,
|
||||
|
@ -100,6 +101,7 @@ class DCLCalculatorPlugin(CMSPluginBase):
|
|||
vm_type=instance.vm_type
|
||||
).order_by('name')
|
||||
context['instance'] = instance
|
||||
context['vm_base_price'] = settings.VM_BASE_PRICE
|
||||
context['min_ram'] = 0.5 if instance.enable_512mb_ram else 1
|
||||
return context
|
||||
|
||||
|
|
|
@ -225,8 +225,8 @@
|
|||
}
|
||||
var total = (cardPricing['cpu'].value * window.coresUnitPrice) +
|
||||
(cardPricing['ram'].value * window.ramUnitPrice) +
|
||||
(cardPricing['storage'].value * window.ssdUnitPrice) -
|
||||
window.discountAmount;
|
||||
(cardPricing['storage'].value * window.ssdUnitPrice) +
|
||||
window.vmBasePrice - window.discountAmount;
|
||||
total = parseFloat(total.toFixed(2));
|
||||
$("#total").text(total);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="price-calc-section">
|
||||
<div class="card">
|
||||
{% include "datacenterlight/includes/_calculator_form.html" with vm_pricing=instance.pricing %}
|
||||
{% include "datacenterlight/includes/_calculator_form.html" with vm_pricing=instance.pricing vm_base_price=vm_base_price %}
|
||||
</div>
|
||||
</div>
|
|
@ -9,6 +9,7 @@
|
|||
window.ssdUnitPrice = {{vm_pricing.ssd_unit_price|default:0}};
|
||||
window.hddUnitPrice = {{vm_pricing.hdd_unit_price|default:0}};
|
||||
window.discountAmount = {{vm_pricing.discount_amount|default:0}};
|
||||
window.vmBasePrice = {{vm_base_price|default:0}};
|
||||
window.minRam = {{min_ram}};
|
||||
window.minRamErr = '{% blocktrans with min_ram=min_ram %}Please enter a value in range {{min_ram}} - 200.{% endblocktrans %}';
|
||||
</script>
|
||||
|
|
|
@ -266,8 +266,8 @@ $( document ).ready(function() {
|
|||
}
|
||||
var total = (cardPricing['cpu'].value * window.coresUnitPrice) +
|
||||
(cardPricing['ram'].value * window.ramUnitPrice) +
|
||||
(cardPricing['storage'].value * window.ssdUnitPrice) -
|
||||
window.discountAmount;
|
||||
(cardPricing['storage'].value * window.ssdUnitPrice) +
|
||||
window.vmBasePrice - window.discountAmount;
|
||||
total = parseFloat(total.toFixed(2));
|
||||
$("#total").text(total);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue