snapshot: preserve configurable onboarding conditional logic

This commit is contained in:
Md Bayazid Bostame
2026-03-27 12:54:47 +01:00
parent eb0fb811e4
commit 2e5e941d41
9 changed files with 431 additions and 41 deletions

View File

@@ -246,6 +246,70 @@
</div>
</form>
</section>
{% if form_type == 'onboarding' %}
<section class="options-panel">
<div class="options-head">
<h2>{% trans "Bedingte Logik" %}</h2>
</div>
<form method="post" action="/admin-tools/form-builder/?form_type={{ form_type }}&option_category={{ selected_option_category }}">
{% csrf_token %}
<div class="field-rule-groups">
{% for item in conditional_rule_items %}
<section class="field-rule-group">
<div class="field-rule-group-head">
<h3>{{ item.title }}</h3>
<span class="column-count">{{ item.target_fields|join:", " }}</span>
</div>
<div class="field-rule-list">
<div class="field-rule-row">
<div class="field-rule-main">
<strong>{{ item.title }}</strong>
<div class="mini">{{ item.description }}</div>
</div>
<label class="field-rule-control">
<span>{% trans "Aktiv" %}</span>
<input type="checkbox" name="conditional_active_{{ item.target_key }}" {% if item.is_active %}checked{% endif %} />
</label>
</div>
{% for clause in item.clauses %}
<div class="field-rule-row">
<div class="field-rule-main">
<strong>{% blocktrans trimmed with number=forloop.counter %}Bedingung {{ number }}{% endblocktrans %}</strong>
</div>
<label class="field-rule-control">
<span>{% trans "Feld" %}</span>
<select name="conditional_field_{{ item.target_key }}_{{ forloop.counter0 }}">
<option value="">{% trans "Keine" %}</option>
{% for value, label in item.field_choices %}
<option value="{{ value }}" {% if clause.field == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</label>
<label class="field-rule-control">
<span>{% trans "Operator" %}</span>
<select name="conditional_operator_{{ item.target_key }}_{{ forloop.counter0 }}">
{% for value, label in item.operator_choices %}
<option value="{{ value }}" {% if clause.operator == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</label>
<label class="field-rule-control">
<span>{% trans "Wert" %}</span>
<input type="text" name="conditional_value_{{ item.target_key }}_{{ forloop.counter0 }}" value="{{ clause.value }}" {% if clause.operator == 'checked' %}placeholder="{% trans 'wird ignoriert' %}"{% endif %} />
</label>
</div>
{% endfor %}
</div>
</section>
{% endfor %}
</div>
<div class="options-actions">
<button class="btn btn-primary" type="submit" name="builder_action" value="save_conditional_rules">{% trans "Bedingte Logik speichern" %}</button>
</div>
</form>
</section>
{% endif %}
</div>
</div>
</details>

View File

@@ -44,6 +44,7 @@
<form method="post" id="onboarding-form" enctype="multipart/form-data" data-email-domain="{{ portal_email_domain }}">
{% csrf_token %}
{{ onboarding_conditional_rules|json_script:"onboarding-conditional-rules" }}
{% for section in onboarding_sections %}
<section class="page {% if forloop.first %}active{% endif %}" data-step="{{ forloop.counter }}">
@@ -92,7 +93,11 @@
{% endif %}
{% endwith %}
{% else %}
<div id="{{ block.id }}" class="field-group field-full {% if block.hidden_default %}hidden{% endif %}">
<div
id="{{ block.id }}"
class="field-group field-full {% if block.hidden_default %}hidden{% endif %}"
data-conditional-target="{{ block.id }}"
>
<div class="grid-2">
{% for field in block.fields %}
{% if field.is_hidden %}