{# # --------------------------------------------------------------------- # # 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 = {'item': 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 noform = params['noform'] is defined or params['noform'] == true %} {% set disabled = (candedit == false) %} {% block timeline_card %} {% if form_mode == 'view' %}
{{ entry_i['content']|enhanced_html({ 'user_mentions': true, 'images_gallery': true }) }}
{% if entry_i['solutiontypes_id'] %} {{ get_item_name('SolutionType', entry_i['solutiontypes_id']) }} {% endif %} {% if entry_i['status'] != constant('CommonITILValidation::WAITING') and entry_i['status'] != constant('CommonITILValidation::NONE') %} {% set action = entry_i['status'] == constant('CommonITILValidation::ACCEPTED') ? __('Accepted') : _x('validation', 'Refused') %} {{ __('%1$s on %2$s by %3$s')|format( action, (entry_i['date_approval']|formatted_datetime), get_item_link('User', entry_i['users_id_approval'], {'enable_anonymization': true}) )|raw }} {% endif %}
{% else %}
{% set validation_class = item.getValidationClassInstance() %} {% if validation_class is not null %} {{ validation_class.alertValidation(item, 'solution') }} {% endif %} {% if not noform %}
{% endif %} {{ call_plugin_hook('pre_item_form', {"item": subitem, 'options': params}) }} {% if call('Ticket_Ticket::countOpenChildren', [item.fields['id']]) > 0 %}
{{ __('Warning: non closed children tickets depends on current ticket. Are you sure you want to close it?') }}
{% endif %}
{% set content = subitem.fields['content'] %} {% if kb_id_toload > 0 %} {% set kb_item = get_item("KnowbaseItem", kb_id_toload) %} {% set content = (kb_item.fields['answer'] ?? "") %} {% endif %} {{ fields.textareaField( 'content', content, '', { 'full_width': true, 'no_label': true, 'enable_richtext': true, 'enable_fileupload': true, 'enable_mentions': true, 'entities_id': item.fields['entities_id'], 'rand': rand, 'disabled': disabled, } ) }}
{% if candedit %} {% if can_read_kb %} {% set search_solution_button %} {% endset %} {{ fields.field( '', search_solution_button, '', { 'full_width': true, 'icon_label': true, } ) }} {% endif %} {% set sol_template_lbl %} {% endset %} {{ fields.dropdownField( 'SolutionTemplate', 'solutiontemplates_id', 0, sol_template_lbl, { 'full_width': true, 'icon_label': true, 'on_change': 'solutiontemplate_update' ~ rand ~ '(this.value)', 'rand': rand, 'entity': item.fields['entities_id'], 'disabled': disabled, } ) }} {% endif %} {% set sol_type_lbl %} {% endset %} {{ fields.dropdownField( 'SolutionType', 'solutiontypes_id', subitem.fields['solutiontypes_id'] ?? 0, sol_type_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, 'entity': item.fields['entities_id'], 'disabled': disabled, } ) }} {% 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 sol_to_kb_lbl %} {% endset %} {{ fields.sliderField( '_sol_to_kb', 0, sol_to_kb_lbl, { 'full_width': true, 'icon_label': true, 'rand': rand, } ) }} {% endif %}
{% if not noform %} {{ call_plugin_hook('post_item_form', {"item": subitem, 'options': params}) }}
{% endif %}
{% endif %} {% endblock %}