From df1ebaa2d488f5a1f9157d4f8b5d904539a3595e Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Wed, 26 Mar 2025 11:24:42 +0100 Subject: [PATCH] Display offering form in separate card --- .../service_offering_detail.html | 21 ++++++++++++------- src/servala/frontend/views/service.py | 4 ++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html index bd6a575..066c1af 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html +++ b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html @@ -9,13 +9,18 @@ {% endblock html_title %} {% partialdef service-form %} {% if service_form %} - {% if form_error %} -
- {% translate "Oops! Something went wrong with the service form generation. Please try again later." %} +
+
+
+ {% if form_error %} +
+ {% translate "Oops! Something went wrong with the service form generation. Please try again later." %} +
+ {% else %} + {% include "includes/form.html" with form=service_form %} + {% endif %}
- {% else %} - {% include "includes/form.html" with form=service_form %} - {% endif %} +
{% endif %} {% endpartialdef %} {% block content %} @@ -35,7 +40,7 @@
- {% if offering.control_planes.all.count == 0 %} + {% if not has_control_planes %}

{% translate "We currently cannot offer this service, sorry!" %}

{% else %}
{{ select_form }}
-
{% partial service-form %}
{% endif %}
+
{% partial service-form %}
{% endblock content %} diff --git a/src/servala/frontend/views/service.py b/src/servala/frontend/views/service.py index 427f6be..00b7edd 100644 --- a/src/servala/frontend/views/service.py +++ b/src/servala/frontend/views/service.py @@ -73,8 +73,12 @@ class ServiceOfferingDetailView(OrganizationViewMixin, HtmxViewMixin, DetailView def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["select_form"] = self.select_form + context["has_control_planes"] = self.planes.exists() if "control_plane" in self.request.GET: if self.select_form.is_valid(): + context["selected_plane"] = self.select_form.cleaned_data[ + "control_plane" + ] try: so_cp = ServiceOfferingControlPlane.objects.filter( control_plane=self.select_form.cleaned_data["control_plane"],