{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2024 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 %} {% set params = params|default({}) %} {% set candedit = candedit|default(item.maySolve()) %} {% set can_read_kb = can_read_kb|default( has_profile_right('knowbase', constant('READ')) or has_profile_right('knowbase', constant('KnowbaseItem::READFAQ')) ) %} {% set can_update_kb = can_update_kb|default(has_profile_right('knowbase', constant('UPDATE'))) %} {% set nokb = nokb|default(params['nokb'] is defined or params['nokb'] == true) %} {% set rand = rand|default(random()) %} {% set formoptions = formoptions|default(params['formoptions'] ?? '') %} {% set kb_id_toload = kb_id_toload|default(0) %} {# In some cases, we may already have an HTML form (massive actions) #} {% set add_html_form = no_form is not defined or no_form == false %}
{% if add_html_form %}
{% endif %} {{ 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, 'editor_height': 300, } ) }}
{% 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 %} {% set task_state %} {% do call('Planning::dropdownState', ['state', subitem.fields['state'], true, {'rand': rand}]) %} {% endset %} {{ fields.htmlField( 'state', task_state, 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, 'additional_attributes': { 'onchange': 'toggleTimelinePrivate(this.checked, this)', } } ) }} {% 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 %}
{% if disable_pending_reasons is not defined or disable_pending_reasons == false %} {% set pending_reasons %} {% set show_pending_reasons_actions = item.fields['status'] == constant('CommonITILObject::WAITING') and not has_pending_reason %} {% if call('PendingReason_Item::canDisplayPendingReasonForItem', [subitem]) %} {% if not has_pending_reason %}
{{ include('components/itilobject/timeline/pending_reasons.html.twig') }}
{% endif %}
{% endif %} {% endset %} {% endif %} {{ call_plugin_hook('post_item_form', {"item": subitem, 'options': params}) }} {# Fixed min-height ensure no height increase when toggling the pending reason button, as select 2 dropdown are a bit higher than the default footer height #} {% if add_html_form %}
{% endif %}