{# # --------------------------------------------------------------------- # # 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 . # # --------------------------------------------------------------------- #} {% extends 'components/itilobject/timeline/form_timeline_item.html.twig' %} {% import 'components/form/fields_macros.html.twig' as fields %} {% set params = {'parent': item}|merge(params|default({})) %} {% set candedit = item.maySolve() %} {% set can_read_kb = has_profile_right('knowbase', constant('READ')) or has_profile_right('knowbase', constant('KnowbaseItem::READFAQ')) %} {% set can_update_kb = has_profile_right('knowbase', constant('UPDATE')) %} {% set nokb = params['nokb'] is defined or params['nokb'] == true %} {% set rand = random() %} {% set formoptions = params['formoptions'] ?? '' %} {% block timeline_card %} {% if form_mode == 'view' %}
{{ entry_i['content']|enhanced_html({ 'user_mentions': true, 'images_gallery': true }) }}
{% if entry_i['users_id_tech'] %} {% set is_current_tech = (entry_i['users_id_tech'] == session('glpiID')) %} {% set anonym_tech = (get_current_interface() == 'helpdesk' and not is_current_tech and entity_config('anonymize_support_agents', session('glpiactive_entity')) != constant('Entity::ANONYMIZE_DISABLED')) %} {{ include('components/user/link_with_tooltip.html.twig', { 'users_id': entry_i['users_id_tech'], 'enable_anonymization': anonym_tech }, with_context = false) }} {% endif %} {% if entry_i['groups_id_tech'] %} {{ get_item_link('Group', entry_i['groups_id_tech'], {'enable_anonymization': true}) }} {% endif %} {% if entry_i['taskcategories_id'] %} {{ get_item_name('TaskCategory', entry_i['taskcategories_id']) }} {% endif %} {% if entry_i['actiontime'] %} {{ entry_i['actiontime']|formatted_duration }} {% endif %} {% if entry_i['begin'] %} {{ entry_i['begin']|formatted_datetime }} ⇒ {{ entry_i['end']|formatted_datetime }} {% endif %} {% if entry_i['sourceitems_id'] %} {% set merged_badge %} {{ get_item_link('Ticket', entry_i['sourceitems_id']) }} {% endset %} {{ __('Merged from Ticket %1$s')|format(merged_badge)|raw }} {% endif %} {% if entry_i['sourceof_items_id'] %} {% set promoted_badge %} {{ get_item_link('Ticket', entry_i['sourceof_items_id']) }} {% endset %} {{ __('Promoted to Ticket %1$s')|format(promoted_badge)|raw }} {% endif %} {{ include('components/itilobject/timeline/pending_reasons_messages.html.twig') }}
{% else %}
{{ call_plugin_hook('pre_item_form', {"item": subitem, 'options': params}) }}
{{ fields.textareaField( 'content', subitem.fields['content'], '', { 'full_width': true, 'no_label': true, 'enable_richtext': true, 'enable_fileupload': true, 'enable_mentions': true, 'entities_id': item.fields['entities_id'], 'rand': rand, } ) }}
{% set task_template_lbl %} {% endset %} {{ fields.dropdownField( 'TaskTemplate', 'tasktemplates_id', subitem.fields['tasktemplates_id'], task_template_lbl, { 'full_width': true, 'icon_label': true, 'on_change': 'itiltasktemplate_update' ~ rand ~ '(this.value)', 'entity': item.fields['entities_id'], 'rand': rand, } ) }} {% set task_date_lbl %} {% endset %} {{ fields.datetimeField( 'date', subitem.fields['date'], task_date_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, } ) }} {# Category #} {% set task_category_lbl %} {% endset %} {{ fields.dropdownField( 'TaskCategory', 'taskcategories_id', subitem.fields['taskcategories_id'], task_category_lbl, { 'full_width': true, 'icon_label': true, 'entity': item.fields['entities_id'], 'condition': { 'is_active': 1, }, 'rand': rand, } ) }} {# Status #} {% set task_state_lbl %} {% endset %} {{ fields.dropdownArrayField('state', subitem.fields['state'], { 0: _n('Information', 'Information', 1), 1: __('To do'), 2: __('Done') }, task_state_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, }) }} {% set task_private_lbl %} {% endset %} {{ fields.sliderField( 'is_private', subitem.fields['is_private'], task_private_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, } ) }} {% if can_read_kb and kb_id_toload > 0 %} {% set link_kb_lbl %} {% endset %} {{ fields.sliderField( 'kb_linked_id', 1, link_kb_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, 'yes_value': kb_id_toload, } ) }} {% endif %} {% if candedit and can_update_kb and not nokb %} {% set task_to_kb_lbl %} {% endset %} {{ fields.sliderField( '_task_to_kb', 0, task_to_kb_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, } ) }} {% endif %} {# Duration #} {% set task_actiontime_lbl %} {% endset %} {{ fields.dropdownTimestampField('actiontime', subitem.fields['actiontime'], task_actiontime_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, 'min': 0, 'max': 8 * constant('HOUR_TIMESTAMP'), 'addfirstminutes': true, 'inhours': true, 'toadd': range(9, 100)|map(i => i * constant('HOUR_TIMESTAMP')), }) }} {# User #} {% set task_user_lbl %} {% endset %} {{ fields.dropdownField( 'User', 'users_id_tech', subitem.fields['users_id_tech']|default(session('glpiID')), task_user_lbl, { 'full_width': true, 'icon_label': true, 'entity': item.fields['entities_id'], 'right': 'own_ticket', 'rand': rand, } ) }} {# Group #} {% set task_group_lbl %} {% endset %} {{ fields.dropdownField( 'Group', 'groups_id_tech', subitem.fields['groups_id_tech'], task_group_lbl, { 'full_width': true, 'icon_label': true, 'entity': item.fields['entities_id'], 'condition': {'is_task': 1}, 'rand': rand, } ) }}
{% if subitem.can(subitem.fields['id'], constant('UPDATE')) and subitem.fields['begin'] %} {% else %} {% endif %}
{% set pending_reasons %} {% set show_pending_reasons_actions = item.fields['status'] == constant('CommonITILObject::WAITING') and not has_pending_reason %} {% if not has_pending_reason %}
{{ include('components/itilobject/timeline/pending_reasons.html.twig') }}
{% endif %}
{% endset %} {{ call_plugin_hook('post_item_form', {"item": subitem, 'options': params}) }}
{% endif %} {% endblock %}