{# # --------------------------------------------------------------------- # # 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 %} {% set rand = random() %} {% set base_field_options = { 'is_horizontal': false, 'full_width': true, 'full_width_adapt_column': false, 'fields_template': itiltemplate, 'rand': rand, } %} {% set right_field_options = base_field_options|merge({ 'is_horizontal': true, 'label_class': 'col-lg-3', 'input_class': 'col-lg-9', }) %}
{% if has_tickets_to_validate and not url_validate is empty %} {% endif %} {{ include('components/itilobject/mainform_open.html.twig') }} {{ call_plugin_hook(constant('Glpi\\Plugin\\Hooks::PRE_ITEM_FORM'), {'item': item, 'options': params}) }}

{{ __('Describe the incident or request') }}

{% if delegating|length %}
{% set actor_add_form %}
{{ item.showActorAddFormOnCreate( constant('CommonITILActor::REQUESTER'), params )|u.truncate(0) }}
{% endset %} {{ fields.dropdownYesNo( 'nodelegate', params['nodelegate'], __('This ticket concerns me'), base_field_options|merge({ 'add_field_html': actor_add_form }) ) }}
{% set personal_information %}
{% set user = get_current_user() %} {% set user_fields = user.fields %} {% set user_fields = user_fields|merge({user_name: user.getFriendlyName()|verbatim_value}) %} {% set user_fields = user_fields|merge({email: user.getDefaultEmail()}) %} {{ include('components/user/info_card.html.twig', { 'user': user_fields, 'can_edit': true }, with_context = false) }}
{% endset %} {{ fields.field( '', personal_information, __('Check your personnal information'), base_field_options ) }}
{% else %} {% endif %}
{{ fields.field( 'type', item.dropdownType('type', { 'value': params['type'], 'width': '100%', 'display': false, 'on_change': 'this.form.submit()', }|merge(right_field_options)), _n('Type', 'Types', 1), right_field_options ) }} {% set cat_params = right_field_options|merge({ 'on_change': 'this.form.submit()', }) %} {% set condition = { 'is_helpdeskvisible': 1 } %} {% if params['type'] == constant('Ticket::INCIDENT_TYPE') %} {% set condition = condition|merge({'is_incident': 1}) %} {% elseif params['type'] == constant('Ticket::DEMAND_TYPE') %} {% set condition = condition|merge({'is_request': 1}) %} {% endif %} {{ fields.dropdownField( 'ITILCategory', 'itilcategories_id', params['itilcategories_id'], _n('Category', 'Categories', 1), cat_params|merge({'condition': condition}), ) }} {{ fields.field( 'urgency', item.dropdownUrgency({ 'value': params['urgency'], 'width': '100%', 'display': false, 'required': right_field_options.fields_template.isMandatoryField('urgency'), }), __('Urgency'), right_field_options ) }} {% if session('glpiactiveprofile')['helpdesk_hardware'] and session('glpiactiveprofile')['helpdesk_item_type']|length %} {% set associated_items %}
{% do call('Item_Ticket::itemAddForm', [item, params|merge({ '_canupdate': has_profile_right('ticket', constant('CREATE')), '_tickettemplate': itiltemplate, })]) %}
{% endset %} {{ fields.field( 'items_id', associated_items, _n('Associated element', 'Associated elements', get_plural_number()), right_field_options ) }} {% endif %} {% if not itiltemplate.isHiddenField('_users_id_observer') or not itiltemplate.isHiddenField('_groups_id_observer') %} {% set observer_field %} {{ include('components/itilobject/actors/main.html.twig', { 'item': item, 'entities_id': entities_id, 'itiltemplate': itiltemplate, 'field_options': right_field_options, 'canupdate': true, 'returned_itemtypes': ['User'], 'display_actortypes': ['observer'], 'display_labels': false, 'canassigntome': false, }) }} {% endset %} {{ fields.field( 'observer', observer_field, _n('Watcher', 'Watchers', get_plural_number()), right_field_options|merge({ required: itiltemplate.isMandatoryField('_users_id_observer') or itiltemplate.isMandatoryField('_groups_id_observer') }) ) }} {% endif %} {{ fields.dropdownField( 'Location', 'locations_id', params['locations_id'], 'Location'|itemtype_name, right_field_options|merge({ 'hide_if_no_elements': true }) ) }} {{ fields.textField( 'name', params['name'], __('Title'), right_field_options ) }} {% set uploads = [] %} {% if params._content is defined %} {% set uploads = uploads|merge({'_content': params._content, '_tag_content': params._tag_content}) %} {% endif %} {% if params._filename is defined %} {% set uploads = uploads|merge({'_filename': params._filename, '_tag_filename': params._tag_filename}) %} {% endif %} {{ fields.textareaField( 'content', params['content'], __('Description'), right_field_options|merge({ 'enable_richtext': true, 'enable_fileupload': (itiltemplate.isHiddenField('_documents_id')) ? false : true, 'uploads': uploads, }) ) }}
{{ call_plugin_hook(constant('Glpi\\Plugin\\Hooks::POST_ITEM_FORM'), {'item': item, 'options': params}) }}
{{ include('components/itilobject/mainform_close.html.twig') }}