{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2025 Teclib' and contributors. # @licence https://www.gnu.org/licenses/gpl-3.0.html # # --------------------------------------------------------------------- # # LICENSE # # This file is part of GLPI. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # --------------------------------------------------------------------- #} {% set value_operators = manager.getValueOperatorForValidationDropdownValues(question_uuid) %} {% if value_operators is empty %}
{{ __('Conditional validation is not available for this question type.') }}
{% else %} {% for condition in defined_conditions %}
{% if not loop.first %} {% do call('Dropdown::showFromArray', [ '_validation_conditions[' ~ loop.index0 ~ '][logic_operator]', manager.getLogicOperatorDropdownValues(), { 'value': condition.getLogicOperator().value, 'aria_label' : __('Logic operator'), 'add_data_attributes': { 'glpi-conditions-editor-logic-operator': '', }, }]) %} {% endif %} {% set question_key = 'question-' ~ question_uuid %} {% set value_op = '' %} {% if condition.getValueOperator() is not null %} {% set value_op = condition.getValueOperator().value %} {% endif %} {% do call('Dropdown::showFromArray', [ '_validation_conditions[' ~ loop.index0 ~ '][value_operator]', value_operators, { 'value': value_op, 'aria_label' : __('Value operator'), 'add_data_attributes': { 'glpi-conditions-editor-value-operator': '', }, } ]) %} {# Load the correct template to use #} {% set handler = manager.getHandlerForCondition(condition) %} {% if handler is not null %} {% if handler.getTemplate() is not null %} {{ include( handler.getTemplate(), { input_value: condition.getValue(), input_name: "_validation_conditions[" ~ loop.index0 ~ "][value]", input_label: __("Value"), }|merge(handler.getTemplateParameters(condition)), with_context = false ) }} {% endif %} {% endif %}
{% endfor %} {% endif %}