feat: exclusion groups for additional services
This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
</div>
|
||||
{{ form_row(form.price) }}
|
||||
{{ form_row(form.selectionGroup) }}
|
||||
{{ form_row(form.exclusionGroup) }}
|
||||
<div class="lg:col-span-2">
|
||||
{{ form_row(form.isExclusive) }}
|
||||
</div>
|
||||
{{ form_row(form.dateFrom) }}
|
||||
{{ form_row(form.dateTo) }}
|
||||
</div>
|
||||
|
||||
@@ -148,6 +148,10 @@
|
||||
|
||||
{% if ctx.ungroupedAdditionalServices is not empty or ctx.groupedAdditionalServices is not empty %}
|
||||
|
||||
{# Wraps every fieldset so mutually exclusive services can be unchecked across fieldsets.
|
||||
Purely for instant feedback — the server resolves the same conflicts on submit. #}
|
||||
<div {{ stimulus_controller('service-exclusion') }} {{ stimulus_action('service-exclusion', 'select', 'change') }}>
|
||||
|
||||
{# Ungrouped → checkboxes #}
|
||||
{% if ctx.ungroupedAdditionalServices is not empty %}
|
||||
<div class="pb-4">
|
||||
@@ -179,6 +183,11 @@
|
||||
name="{{ form.selectedAdditionalServiceIds.vars.full_name }}"
|
||||
value="{{ service.id }}"
|
||||
{% if service.id in dto.selectedAdditionalServiceIds %}checked{% endif %}
|
||||
{% if service.exclusionGroup %}
|
||||
{{ stimulus_target('service-exclusion', 'input') }}
|
||||
data-exclusion-group="{{ service.exclusionGroup }}"
|
||||
data-exclusive="{{ service.isExclusive ? '1' : '0' }}"
|
||||
{% endif %}
|
||||
class="form-checkbox">
|
||||
</td>
|
||||
</tr>
|
||||
@@ -217,6 +226,11 @@
|
||||
name="{{ selectedAdditionalServiceBaseName }}[{{ groupName|e('html_attr') }}]"
|
||||
value="{{ service.id }}"
|
||||
{% if service.id in dto.selectedAdditionalServiceIds %}checked{% endif %}
|
||||
{% if service.exclusionGroup %}
|
||||
data-service-exclusion-target="input"
|
||||
data-exclusion-group="{{ service.exclusionGroup }}"
|
||||
data-exclusive="{{ service.isExclusive ? '1' : '0' }}"
|
||||
{% endif %}
|
||||
class="form-radio">
|
||||
</td>
|
||||
</tr>
|
||||
@@ -226,6 +240,8 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user