{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2023 Teclib' and contributors. # @copyright 2003-2014 by the INDEPNET Development Team. # @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 . # # --------------------------------------------------------------------- #} {% import 'components/form/fields_macros.html.twig' as fields %} {% import 'components/form/modals_macros.html.twig' as modals %} {% set la_fields = [] %} {% set la_fields = la_fields|merge([ { 'la': sla, 'type_str': 'sla', 'type': constant('SLM::TTO'), 'datefieldname': 'time_to_own', 'lafieldname': 'slas_id_tto', 'label': __('TTO'), 'helper': __('Time to own'), }, { 'la': sla, 'type_str': 'sla', 'type': constant('SLM::TTR'), 'datefieldname': 'time_to_resolve', 'lafieldname': 'slas_id_ttr', 'label': __('TTR'), 'helper': __('Time to resolve'), } ]) %} {% set la_fields = la_fields|merge([ { 'la': ola, 'type_str': 'ola', 'type': constant('SLM::TTO'), 'datefieldname': 'internal_time_to_own', 'lafieldname': 'olas_id_tto', 'label': __('Internal TTO'), 'helper': __('Internal Time to own'), }, { 'la': ola, 'type_str': 'ola', 'type': constant('SLM::TTR'), 'datefieldname': 'internal_time_to_resolve', 'lafieldname': 'olas_id_ttr', 'label': __('Internal TTR'), 'helper': __('Internal Time to resolve'), } ]) %} {% for la_field in la_fields %} {% set rand = random() %} {% set date_displayed = field_options.fields_template is not defined or not field_options.fields_template.isHiddenField(la_field.datefieldname) %} {% set la_displayed = field_options.fields_template is not defined or not field_options.fields_template.isHiddenField(la_field.lafieldname) %} {% if date_displayed or la_displayed %} {% set la_html %} {% if la_field.la.getDataForTicket(item.fields['id'], la_field.type) %} {% if date_displayed %} {{ item.fields[la_field.datefieldname]|formatted_datetime }} {% endif %} {% if la_displayed %} {{ get_item_name(la_field.la.getType(), item.fields[la_field.lafieldname]) }} {% if canupdate %} {% endif %} {% set nextaction = la_field.la.getNextActionForTicket(item, la_field.type) %} {% set level = la_field.la.getLevelFromAction(nextaction) %} {% if level != false %} {{ get_item_name(level) }} {% endif %} {% endif %} {% else %}
{% set assign_la_id = 'assign_la_' ~ rand %} {% if date_displayed %}
{{ fields.datetimeField( la_field.datefieldname, item.fields[la_field.datefieldname], '', { 'include_field': false, 'id': 'date_' ~ assign_la_id, 'disabled': (not canupdate), } ) }}
{% endif %} {% if la_displayed %} {% if canupdate %} {{ modals.confirm( __('Warning'), la_field.la.getAddConfirmation()|join('
'), { 'id': assign_la_id, 'confirm_label': '' ~ __('Assign'), 'confirm_event': 'toggleAssignLA_' ~ rand ~ '()', } ) }} {% endif %} {% endif %}
{% endif %} {% endset %} {{ fields.field( la_field.lafieldname, la_html, la_field.label, { helper: la_field.helper, mb: 'mb-2', label_class: 'col-auto', full_width: true, is_horizontal: false, add_field_class: (is_expanded ? 'col-sm-6' : ''), } ) }} {% endif %} {% endfor %}