diff --git a/src/servala/frontend/templates/frontend/organizations/service_instance_update.html b/src/servala/frontend/templates/frontend/organizations/service_instance_update.html index 17b9a51..021be3c 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_instance_update.html +++ b/src/servala/frontend/templates/frontend/organizations/service_instance_update.html @@ -30,14 +30,42 @@ {% endpartialdef %} {% block content %}
-
- {% if not form and not custom_form %} - + + {% if plan_form %} +
+
+
{% translate "Compute Plan" %}
+
+
+ {% include "includes/plan_selection.html" with plan_form=plan_form storage_plan=storage_plan %} +
+
+ {% endif %} + +
+ {% if not form and not custom_form %} + + {% else %} +
{% partial service-form %}
+ {% endif %} +
+
{% endblock content %} 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 927c6e3..39b69a8 100644 --- a/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html +++ b/src/servala/frontend/templates/frontend/organizations/service_offering_detail.html @@ -124,12 +124,61 @@ {% endif %} - -
-
-
{% partial service-form %}
+
+ {% csrf_token %} + {% if plan_form.errors or service_form.errors or custom_service_form.errors %} +
+
+ {% include "frontend/forms/errors.html" with form=plan_form %} + {% if service_form %} + {% include "frontend/forms/errors.html" with form=service_form %} + {% endif %} + {% if custom_service_form %} + {% include "frontend/forms/errors.html" with form=custom_service_form %} + {% endif %} +
+
+ {% endif %} + + {% if context_object %} + {% if not has_available_plans %} +
+
+ +
+
+ {% else %} +
+
+
+
+
{% translate "Select Compute Plan" %}
+
+
+ {% include "includes/plan_selection.html" with plan_form=plan_form storage_plan=storage_plan %} +
+
+
+
+ {% endif %} + {% endif %} + +
+
+
+
{% partial service-form %}
+
+
-
+ {% endblock content %} {% block extra_js %} diff --git a/src/servala/frontend/templates/includes/plan_selection.html b/src/servala/frontend/templates/includes/plan_selection.html new file mode 100644 index 0000000..045aeb3 --- /dev/null +++ b/src/servala/frontend/templates/includes/plan_selection.html @@ -0,0 +1,178 @@ +{% load i18n %} + +
+ {% if plan_form %} + {% for assignment in plan_form.fields.compute_plan_assignment.queryset %} +
+ + +
+ {% endfor %} +
+
+
+ {% trans "Storage" %} + {% trans "Billed separately based on disk usage" %} +
+ {% if storage_plan %} +
+
CHF {{ storage_plan.price_per_gib }}
+
{% trans "per GiB" %}
+
+ {% else %} +
{% trans "Included" %}
+ {% endif %} +
+ {% if storage_plan %}
{% endif %} +
+ {% else %} +
{% trans "No compute plans available for this service offering." %}
+ {% endif %} +
+ diff --git a/src/servala/frontend/templates/includes/tabbed_fieldset_form.html b/src/servala/frontend/templates/includes/tabbed_fieldset_form.html index 5f289b7..f54b1ae 100644 --- a/src/servala/frontend/templates/includes/tabbed_fieldset_form.html +++ b/src/servala/frontend/templates/includes/tabbed_fieldset_form.html @@ -1,26 +1,64 @@ {% load i18n %} {% load get_field %} {% load static %} -
- {% csrf_token %} - {% include "frontend/forms/errors.html" %} - {% if form and expert_form and not hide_expert_mode %} - - {% endif %} -
- {% if form and form.context %}{{ form.context }}{% endif %} - {% if form and form.get_fieldsets|length == 1 %} - {# Single fieldset - render without tabs #} +{% include "frontend/forms/errors.html" %} +{% if form and expert_form and not hide_expert_mode %} + +{% endif %} +
+ {% if form and form.context %}{{ form.context }}{% endif %} + {% if form and form.get_fieldsets|length == 1 %} + {# Single fieldset - render without tabs #} + {% for fieldset in form.get_fieldsets %} +
+ {% for field in fieldset.fields %} + {% with field=form|get_field:field %}{{ field.as_field_group }}{% endwith %} + {% endfor %} + {% for subfieldset in fieldset.fieldsets %} + {% if subfieldset.fields %} +
+

{{ subfieldset.title }}

+ {% for field in subfieldset.fields %} + {% with field=form|get_field:field %}{{ field.as_field_group }}{% endwith %} + {% endfor %} +
+ {% endif %} + {% endfor %} +
+ {% endfor %} + {% elif form %} + {# Multiple fieldsets or auto-generated form - render with tabs #} + +
+ {% for fieldset in form.get_fieldsets %} +
{% for field in fieldset.fields %} {% with field=form|get_field:field %}{{ field.as_field_group }}{% endwith %} {% endfor %} @@ -36,113 +74,70 @@ {% endfor %}
{% endfor %} - {% elif form %} - {# Multiple fieldsets or auto-generated form - render with tabs #} - -
- {% for fieldset in form.get_fieldsets %} -
- {% for field in fieldset.fields %} - {% with field=form|get_field:field %}{{ field.as_field_group }}{% endwith %} - {% endfor %} - {% for subfieldset in fieldset.fieldsets %} - {% if subfieldset.fields %} -
-

{{ subfieldset.title }}

- {% for field in subfieldset.fields %} - {% with field=form|get_field:field %}{{ field.as_field_group }}{% endwith %} - {% endfor %} -
- {% endif %} - {% endfor %} -
- {% endfor %} -
- {% endif %} -
- {% if expert_form and not hide_expert_mode %} -
- {% if expert_form and expert_form.context %}{{ expert_form.context }}{% endif %} - -
- {% for fieldset in expert_form.get_fieldsets %} -
- {% for field in fieldset.fields %} - {% with field=expert_form|get_field:field %}{{ field.as_field_group }}{% endwith %} - {% endfor %} - {% for subfieldset in fieldset.fieldsets %} - {% if subfieldset.fields %} -
-

{{ subfieldset.title }}

- {% for field in subfieldset.fields %} - {% with field=expert_form|get_field:field %}{{ field.as_field_group }}{% endwith %} - {% endfor %} -
- {% endif %} - {% endfor %} -
- {% endfor %} -
{% endif %} - {% if form %} - - {% endif %} -
- {# browser form validation fails when there are fields missing/invalid that are hidden #} - +
+{% if expert_form and not hide_expert_mode %} +
+ {% if expert_form and expert_form.context %}{{ expert_form.context }}{% endif %} + +
+ {% for fieldset in expert_form.get_fieldsets %} +
+ {% for field in fieldset.fields %} + {% with field=expert_form|get_field:field %}{{ field.as_field_group }}{% endwith %} + {% endfor %} + {% for subfieldset in fieldset.fieldsets %} + {% if subfieldset.fields %} +
+

{{ subfieldset.title }}

+ {% for field in subfieldset.fields %} + {% with field=expert_form|get_field:field %}{{ field.as_field_group }}{% endwith %} + {% endfor %} +
+ {% endif %} + {% endfor %} +
+ {% endfor %} +
- +{% endif %} +{% if form %} + +{% endif %} +
+ {# browser form validation fails when there are fields missing/invalid that are hidden #} + +
{% if form and not hide_expert_mode %}