pricelist on offering detail

This commit is contained in:
Tobias Brunner 2025-05-23 17:43:29 +02:00
parent 5b4392f838
commit d9a04655ed
No known key found for this signature in database
6 changed files with 496 additions and 38 deletions

View file

@ -152,50 +152,121 @@
</div>
{% endif %}
<!-- Plans -->
{% if offering.plans.all %}
<!-- Plans or Service Plans -->
<div class="pt-24" id="plans" style="scroll-margin-top: 30px;">
<h3 class="fs-24 fw-semibold lh-1 mb-12">Available Plans</h3>
<div class="row">
{% for plan in offering.plans.all %}
<div class="col-12 col-lg-6 {% if not forloop.last %}mb-20 mb-lg-0{% endif %}">
<div class="bg-purple-50 rounded-16 border-all p-24">
<div class="bg-white border-all rounded-7 p-20 mb-20">
<h3 class="text-purple fs-22 fw-semibold lh-1-7 mb-0">{{ plan.name }}</h3>
{% if plan.plan_description %}
<div class="text-black mb-20">
{{ plan.plan_description.text|safe }}
{% if offering.msp == "VS" and pricing_data_by_group_and_service_level %}
<!-- Service Plans with Pricing Data -->
<h3 class="fs-24 fw-semibold lh-1 mb-12">Service Plans</h3>
<div class="accordion" id="servicePlansAccordion">
{% for group_name, service_levels in pricing_data_by_group_and_service_level.items %}
<div class="accordion-item">
<h2 class="accordion-header" id="heading{{ forloop.counter }}">
<button class="accordion-button{% if not forloop.first %} collapsed{% endif %}" type="button" data-bs-toggle="collapse" data-bs-target="#collapse{{ forloop.counter }}" aria-expanded="{% if forloop.first %}true{% else %}false{% endif %}" aria-controls="collapse{{ forloop.counter }}">
<strong>{{ group_name }}</strong>
</button>
</h2>
<div id="collapse{{ forloop.counter }}" class="accordion-collapse collapse{% if forloop.first %} show{% endif %}" aria-labelledby="heading{{ forloop.counter }}" data-bs-parent="#servicePlansAccordion">
<div class="accordion-body">
{% comment %} Display group description from first available plan {% endcomment %}
{% for service_level, pricing_data in service_levels.items %}
{% if pricing_data and forloop.first %}
{% with pricing_data.0 as representative_plan %}
{% if representative_plan.compute_plan_group_description %}
<p class="text-muted mb-3">{{ representative_plan.compute_plan_group_description }}</p>
{% endif %}
{% endwith %}
{% endif %}
{% if forloop.first %}
{% comment %} Only show description for first service level {% endcomment %}
{% endif %}
{% endfor %}
{% for service_level, pricing_data in service_levels.items %}
<div class="mb-4">
<h4 class="mb-3 text-primary">{{ service_level }}</h4>
{% if pricing_data %}
<div class="table-responsive">
<table class="table table-striped table-sm">
<thead class="table-dark">
<tr>
<th>Compute Plan</th>
<th>vCPUs</th>
<th>RAM (GB)</th>
<th>Currency</th>
<th>Compute Price</th>
<th>Service Price</th>
<th class="table-warning">Total Price</th>
</tr>
</thead>
<tbody>
{% for row in pricing_data %}
<tr>
<td>{{ row.compute_plan }}</td>
<td>{{ row.vcpus }}</td>
<td>{{ row.ram }}</td>
<td>{{ row.currency }}</td>
<td>{{ row.compute_plan_price|floatformat:2 }}</td>
<td>{{ row.sla_price|floatformat:2 }}</td>
<td class="table-warning fw-bold">{{ row.final_price|floatformat:2 }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-muted">No pricing data available for {{ service_level }}.</p>
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% if plan.description %}
<div class="text-black mb-20">
{{ plan.description|safe }}
</div>
{% endfor %}
</div>
{% elif offering.plans.all %}
<!-- Traditional Plans -->
<h3 class="fs-24 fw-semibold lh-1 mb-12">Available Plans</h3>
<div class="row">
{% for plan in offering.plans.all %}
<div class="col-12 col-lg-6 {% if not forloop.last %}mb-20 mb-lg-0{% endif %}">
<div class="bg-purple-50 rounded-16 border-all p-24">
<div class="bg-white border-all rounded-7 p-20 mb-20">
<h3 class="text-purple fs-22 fw-semibold lh-1-7 mb-0">{{ plan.name }}</h3>
{% if plan.plan_description %}
<div class="text-black mb-20">
{{ plan.plan_description.text|safe }}
</div>
{% endif %}
{% if plan.description %}
<div class="text-black mb-20">
{{ plan.description|safe }}
</div>
{% endif %}
{% if plan.pricing %}
<div class="text-black mb-20">
{{ plan.pricing|safe }}
</div>
{% endif %}
</div>
{% endif %}
{% if plan.pricing %}
<div class="text-black mb-20">
{{ plan.pricing|safe }}
</div>
{% endif %}
</div>
</div>
</div>
{% empty %}
<div class="col-12" id="interest" style="scroll-margin-top: 30px;">
<div class="alert alert-info">
<p>No plans available yet.</p>
<h4 class="mb-3">I'm interested in this offering</h4>
{% embedded_contact_form source="Offering Interest" service=offering.service offering_id=offering.id %}
{% empty %}
<div class="col-12" id="interest" style="scroll-margin-top: 30px;">
<div class="alert alert-info">
<p>No plans available yet.</p>
<h4 class="mb-3">I'm interested in this offering</h4>
{% embedded_contact_form source="Offering Interest" service=offering.service offering_id=offering.id %}
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% else %}
<div class="col-12" id="interest" style="scroll-margin-top: 30px;">
<h4 class="mb-3">I'm interested in this offering</h4>
{% load contact_tags %}
{% embedded_contact_form source="Offering Interest" service=offering.service offering_id=offering.id %}
</div>
<!-- No Plans Available -->
<div class="col-12" id="interest" style="scroll-margin-top: 30px;">
<h4 class="mb-3">I'm interested in this offering</h4>
{% load contact_tags %}
{% embedded_contact_form source="Offering Interest" service=offering.service offering_id=offering.id %}
</div>
{% endif %}
{% if offering.plans.exists %}