{# # --------------------------------------------------------------------- # # 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 last_condition_is_filled = false %} {% for condition in defined_conditions %} {% set condition_is_filled = condition.getItemUuid() != '' %} {% set last_condition_is_filled = loop.last and condition_is_filled %}
{% if not loop.first %} {% do call('Dropdown::showFromArray', [ '_conditions[' ~ loop.index0 ~ '][logic_operator]', manager.getLogicOperatorDropdownValues(), { 'value': condition.getLogicOperator().value, 'aria_label' : __('Logic operator'), 'add_data_attributes': { 'glpi-conditions-editor-logic-operator': '', }, }]) %} {% endif %} {% do call('Dropdown::showFromArray', [ '_conditions[' ~ loop.index0 ~ '][item]', items_values, { 'value': condition.getItemDropdownKey(), 'aria_label' : _n('Item', 'Items', 1), 'add_data_attributes': { 'glpi-conditions-editor-item': '', }, 'display_emptychoice': true, 'emptylabel': __("Select an item..."), } ]) %} {% if condition_is_filled %} {% set value_op = '' %} {% if condition.getValueOperator() is not null %} {% set value_op = condition.getValueOperator().value %} {% endif %} {% do call('Dropdown::showFromArray', [ '_conditions[' ~ loop.index0 ~ '][value_operator]', manager.getValueOperatorDropdownValues( condition.getItemUuid() ), { '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: "_conditions[" ~ loop.index0 ~ "][value]", input_label: __("Value"), }|merge(handler.getTemplateParameters(condition)), with_context = false ) }} {% endif %} {% endif %} {% endif %} {% if condition_is_filled or loop.index0 > 0 %} {% endif %}
{% endfor %} {% if last_condition_is_filled %} {% endif %}