add addons to services
This commit is contained in:
parent
b96b186875
commit
22e527bcd9
8 changed files with 1039 additions and 4 deletions
|
@ -43,6 +43,7 @@ def pricelist(request):
|
|||
"""Generate comprehensive price list grouped by compute plan groups and service levels"""
|
||||
# Get filter parameters from request
|
||||
show_discount_details = request.GET.get("discount_details", "").lower() == "true"
|
||||
show_addon_details = request.GET.get("addon_details", "").lower() == "true"
|
||||
show_price_comparison = request.GET.get("price_comparison", "").lower() == "true"
|
||||
filter_cloud_provider = request.GET.get("cloud_provider", "")
|
||||
filter_service = request.GET.get("service", "")
|
||||
|
@ -202,6 +203,40 @@ def pricelist(request):
|
|||
discount_savings = 0
|
||||
discount_percentage = 0
|
||||
|
||||
# Get addon information
|
||||
addons = appcat_price.addons.filter(active=True)
|
||||
mandatory_addons = []
|
||||
optional_addons = []
|
||||
|
||||
# Group addons by mandatory vs optional
|
||||
for addon in addons:
|
||||
addon_price = None
|
||||
|
||||
if addon.addon_type == "BF": # Base Fee
|
||||
addon_price = addon.get_price(currency)
|
||||
elif addon.addon_type == "UR": # Unit Rate
|
||||
addon_price_per_unit = addon.get_price(
|
||||
currency, service_level
|
||||
)
|
||||
if addon_price_per_unit:
|
||||
addon_price = addon_price_per_unit * total_units
|
||||
|
||||
addon_info = {
|
||||
"id": addon.id,
|
||||
"name": addon.name,
|
||||
"description": addon.description,
|
||||
"commercial_description": addon.commercial_description,
|
||||
"addon_type": addon.get_addon_type_display(),
|
||||
"price": addon_price,
|
||||
}
|
||||
|
||||
if addon.mandatory:
|
||||
mandatory_addons.append(addon_info)
|
||||
if addon_price:
|
||||
sla_price += addon_price
|
||||
else:
|
||||
optional_addons.append(addon_info)
|
||||
|
||||
final_price = compute_plan_price + sla_price
|
||||
service_level_display = dict(VSHNAppCatPrice.ServiceLevel.choices)[
|
||||
service_level
|
||||
|
@ -296,6 +331,8 @@ def pricelist(request):
|
|||
and appcat_price.discount_model.active
|
||||
),
|
||||
"external_comparisons": external_comparisons,
|
||||
"mandatory_addons": mandatory_addons,
|
||||
"optional_addons": optional_addons,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -344,6 +381,7 @@ def pricelist(request):
|
|||
context = {
|
||||
"pricing_data_by_group_and_service_level": final_context_data,
|
||||
"show_discount_details": show_discount_details,
|
||||
"show_addon_details": show_addon_details,
|
||||
"show_price_comparison": show_price_comparison,
|
||||
"filter_cloud_provider": filter_cloud_provider,
|
||||
"filter_service": filter_service,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue