Display offering form in separate card
All checks were successful
Tests / test (push) Successful in 24s
All checks were successful
Tests / test (push) Successful in 24s
This commit is contained in:
parent
24e1ce8cb8
commit
df1ebaa2d4
2 changed files with 17 additions and 8 deletions
|
@ -9,13 +9,18 @@
|
|||
{% endblock html_title %}
|
||||
{% partialdef service-form %}
|
||||
{% if service_form %}
|
||||
{% if form_error %}
|
||||
<div class="alert alert-danger">
|
||||
{% translate "Oops! Something went wrong with the service form generation. Please try again later." %}
|
||||
<div class="card">
|
||||
<div class="card-header d-flex align-items-center"></div>
|
||||
<div class="card-body">
|
||||
{% if form_error %}
|
||||
<div class="alert alert-danger">
|
||||
{% translate "Oops! Something went wrong with the service form generation. Please try again later." %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% include "includes/form.html" with form=service_form %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% include "includes/form.html" with form=service_form %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endpartialdef %}
|
||||
{% block content %}
|
||||
|
@ -35,7 +40,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% if offering.control_planes.all.count == 0 %}
|
||||
{% if not has_control_planes %}
|
||||
<p>{% translate "We currently cannot offer this service, sorry!" %}</p>
|
||||
{% else %}
|
||||
<form hx-trigger="change"
|
||||
|
@ -43,9 +48,9 @@
|
|||
hx-target="#service-form">
|
||||
{{ select_form }}
|
||||
</form>
|
||||
<div id="service-form">{% partial service-form %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div id="service-form">{% partial service-form %}</div>
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -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"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue