reworked price list view

This commit is contained in:
Tobias Brunner 2025-05-23 15:56:11 +02:00
parent d39ff91a74
commit c3d20fda7b
No known key found for this signature in database
3 changed files with 220 additions and 145 deletions

View file

@ -1,94 +1,81 @@
{% extends 'base.html' %}
{% block content %}
<h1>Compute Plan Price Comparison</h1>
{% block title %}Complete Price List{% endblock %}
{% for plan_data in plans_data %}
<div class="card mb-4">
<div class="card-header">
<h2>{{ plan_data.plan.name }}</h2>
{% block content %}
<div class="container-fluid mt-4">
<div class="row">
<div class="col-12">
<h1 class="mb-4">Complete Price List - All Service Variants</h1>
{% if pricing_data_by_service_level %}
{% for service_level, pricing_data in pricing_data_by_service_level.items %}
<div class="mb-5">
<h2 class="mb-3">{{ service_level }}</h2>
<div class="table-responsive">
<table class="table table-striped table-bordered table-sm">
<thead class="table-dark">
<tr>
<th>Cloud Provider</th>
<th>Service</th>
<th>Compute Plan</th>
<th>vCPUs</th>
<th>RAM (GB)</th>
<th>CPU/Memory Ratio</th>
<th>Term</th>
<th>Currency</th>
<th>Compute Plan Price</th>
<th>Variable Unit</th>
<th>Units</th>
<th>Replica Enforce</th>
<th>SLA Base</th>
<th>SLA Per Unit</th>
<th>SLA Price</th>
<th>Discount Model</th>
<th class="table-warning">Final Price</th>
</tr>
</thead>
<tbody>
{% for row in pricing_data %}
<tr>
<td>{{ row.cloud_provider }}</td>
<td>{{ row.service }}</td>
<td>{{ row.compute_plan }}</td>
<td>{{ row.vcpus }}</td>
<td>{{ row.ram }}</td>
<td>{{ row.cpu_mem_ratio }}</td>
<td>{{ row.term }}</td>
<td>{{ row.currency }}</td>
<td>{{ row.compute_plan_price|floatformat:2 }}</td>
<td>{{ row.variable_unit }}</td>
<td>{{ row.units }}</td>
<td>{{ row.replica_enforce }}</td>
<td>{{ row.sla_base|floatformat:2 }}</td>
<td>{{ row.sla_per_unit|floatformat:4 }}</td>
<td>{{ row.sla_price|floatformat:2 }}</td>
<td>
{% if row.has_discount %}
{{ row.discount_model }}
{% else %}
None
{% endif %}
</td>
<td class="table-warning fw-bold">{{ row.final_price|floatformat:2 }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="text-muted"><strong>{{ pricing_data|length }}</strong> variants for {{ service_level }}</p>
</div>
{% endfor %}
{% else %}
<div class="alert alert-info">
<h4>No pricing data available</h4>
<p>Please ensure you have active compute plans with prices and VSHNAppCat price configurations.</p>
</div>
{% endif %}
</div>
</div>
<div class="card-body">
<h3>Plan Details</h3>
<table class="table table-striped">
<tr>
<th>Cloud Provider:</th>
<td>{{ plan_data.plan.cloud_provider.name }}</td>
</tr>
<tr>
<th>vCPUs:</th>
<td>{{ plan_data.plan.vcpus }}</td>
</tr>
<tr>
<th>RAM:</th>
<td>{{ plan_data.plan.ram }} GB</td>
</tr>
<tr>
<th>CPU/Memory Ratio:</th>
<td>{{ plan_data.plan.cpu_mem_ratio }}</td>
</tr>
<tr>
<th>Term:</th>
<td>{{ plan_data.plan.get_term_display }}</td>
</tr>
<tr>
<th>Compute Plan Prices:</th>
<td>
{% for price in plan_data.plan.prices.all %}
{{ price.amount }} {{ price.currency }}<br>
{% empty %}
No prices set
{% endfor %}
</td>
</tr>
</table>
<h3>Calculated AppCat Prices</h3>
{% if plan_data.calculated_prices %}
<table class="table table-bordered">
<thead>
<tr>
<th>Service</th>
<th>Variable Unit</th>
<th>Service Level</th>
<th>Units</th>
<th>Plan Term</th>
<th>Service Term</th>
<th>Currency</th>
<th>Final Price</th>
<th>Discount</th>
</tr>
</thead>
<tbody>
{% for price in plan_data.calculated_prices %}
<tr>
<td>{{ price.service }}</td>
<td>{{ price.variable_unit }}</td>
<td>{{ price.service_level }}</td>
<td>{{ price.units }}</td>
<td>{{ price.plan_term }}</td>
<td>{{ price.service_term }}</td>
<td>{{ price.currency }}</td>
<td>{{ price.price }}</td>
<td>
{% if price.discount_model %}
{{ price.discount_model.name }}
{% else %}
-
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No AppCat prices calculated for this plan.</p>
{% endif %}
</div>
</div>
{% empty %}
<div class="alert alert-info">
No compute plans found.
</div>
{% endfor %}
</div>
{% endblock %}