{# # --------------------------------------------------------------------- # # GLPI - Gestionnaire Libre de Parc Informatique # # http://glpi-project.org # # @copyright 2015-2025 Teclib' and contributors. # @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 "layout/page_without_tabs.html.twig" %} {% set container_size = "narrow" %} {# TODO: rework this page style to use the standard tabler_title name for the form's title #} {% block content_body %} {# Is this a single or multi sections forms ? #} {% set is_single_section_form = form.getSections()|length == 1 %} {# Check render layout to determine display behavior #} {% set is_single_page_layout = form.fields.render_layout == constant('Glpi\\Form\\RenderLayout::SINGLE_PAGE').value %} {% set use_step_by_step = not is_single_page_layout and not is_single_section_form %}
{# Form header: title and description #}

{{ translate_form_item_key(form, constant('TRANSLATION_KEY_NAME', form)) }}

{{ translate_form_item_key(form, constant('TRANSLATION_KEY_HEADER', form))|safe_html }}
{% include "components/helpdesk_forms/delegation_alert.html.twig" %}
{% for section in form.getSections() %} {% set is_first_section = loop.index0 == 0 %} {% set section_index = loop.index0 %}
{% if not is_single_section_form %}

{{ translate_form_item_key(section, constant('TRANSLATION_KEY_NAME', section))|default(__('Untitled section')) }}

{% endif %}
{% if not is_single_section_form and section.fields.description is not empty %}
{{ translate_form_item_key(section, constant('TRANSLATION_KEY_DESCRIPTION', section))|safe_html }}
{% endif %} {% for form_group_blocks in section.getBlocks() %} {# Ensure form_group_blocks is iterable (may be a single question) #} {% if form_group_blocks is not iterable %} {% set form_group_blocks = [form_group_blocks] %} {% endif %}
{% set previous_index = -1 %} {% for form_block in form_group_blocks %} {% if form_block.fields.horizontal_rank > previous_index + 1 %} {% for i in 1..(form_block.fields.horizontal_rank - (previous_index + 1)) %}
{% endfor %} {% endif %} {% set previous_index = form_block.fields.horizontal_rank %} {% if form_block is instanceof('Glpi\\Form\\Question') %} {% set question_type = form_block.getQuestionType() %} {{ form_block.setDefaultValueFromParameters(params) }} {% endif %} {% set skip_question = false %} {# Skip unknown types (may be a disabled plugin) #} {% if form_block is instanceof('Glpi\\Form\\Question') and question_type is null %} {% set skip_question = true %} {% endif %} {# Skip questions not allowed for anonymous forms #} {% if not skip_question and form_block is instanceof('Glpi\\Form\\Question') and unauthenticated_user and not question_type.isAllowedForUnauthenticatedAccess() %} {% set skip_question = true %} {% endif %} {% if not skip_question %}

{{ translate_form_item_key(form_block, constant('TRANSLATION_KEY_NAME', form_block))|default(form_block.getUntitledLabel()) }} {% if form_block.fields.is_mandatory ?? false %} * {% endif %}

{{ translate_form_item_key(form_block, constant('TRANSLATION_KEY_DESCRIPTION', form_block))|safe_html }}
{% if form_block is instanceof('Glpi\\Form\\Question') %} {{ question_type.renderEndUserTemplate(form_block)|raw }} {% endif %}
{% endif %} {% endfor %}
{% endfor %}
{% endfor %} {# Form reference #}
{# Altcha #} {% if unauthenticated_user %} {{ include( 'components/altcha/widget.html.twig', {}, with_context: false ) }} {% endif %}
{# Actions #}
{% if use_step_by_step and not is_single_section_form %} {# Navigation buttons for step-by-step mode #} {% endif %}
{# Final "success" confirmation #}
{{ __("Form submitted") }}

{{ __("Your form has been submitted successfully.") }}

{% if not unauthenticated_user %}
{% if get_current_interface() == 'central' %} {{ __("Go back to service catalog") }} {% else %} {{ __("Take me home") }} {% endif %} {{ __("See my tickets") }}
{% endif %}
{% endblock content_body %}