{# # --------------------------------------------------------------------- # # 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 . # # --------------------------------------------------------------------- #} {% import 'components/form/basic_inputs_macros.html.twig' as inputs %} {% set is_root_entity = entity.getID() == 0 %}

{{ __("Custom illustrations") }}

{% if is_root_entity %} {% set scene_options = { (constant("Entity::SCENE_DEFAULT")): __("Default illustration"), (constant("Entity::SCENE_CUSTOM")) : __("Custom illustration"), } %} {% else %} {% set scene_options = { (constant("Entity::SCENE_DEFAULT")): __("Default illustration"), (constant("Entity::SCENE_CUSTOM")) : __("Custom illustration"), (constant("Entity::SCENE_INHERIT")): __("Inherited from parent entity"), } %} {% endif %}
{% set sides = [ { id: "left_side", label: __("Left side"), dropdown_label: __("Left side configuration"), field: 'custom_helpdesk_home_scene_left', config: entity.getSceneConfigForDropdown( 'custom_helpdesk_home_scene_left' ), default: constant("Entity::DEFAULT_LEFT_SCENE"), }, { id: "right_side", label: __("Right side"), dropdown_label: __("Right side configuration"), field: 'custom_helpdesk_home_scene_right', config: entity.getSceneConfigForDropdown( 'custom_helpdesk_home_scene_right' ), default: constant("Entity::DEFAULT_RIGHT_SCENE"), }, ] %} {% for side in sides %}

{{ side.label }}

{# Main value input dropdown #}
{% do call('Dropdown::showFromArray', [ side.field, scene_options, { value: side.config, width: "100%", aria_label: side.dropdown_label, } ]) %}
{# Default value preview #}
{{ render_scene(side.default, 400) }}
{# Custom value preview #}
{% if side.config == "custom" and not entity.fields[side.field] is empty %} {{ render_scene( constant( 'Glpi\\UI\\IllustrationManager::CUSTOM_SCENE_PREFIX' ) ~ entity.fields[side.field], 400 ) }} {% endif %} {% do call('Html::file', [ { 'name': side.field, } ]) %}
{% if not is_root_entity %} {# Inherited value preview #}
{{ __("The following illustration from the parent entity will be used:") }}
{{ render_scene( entity.getHelpdeskSceneId(side.field), 400 ) }}
{% endif %}
{% endfor %}
{# Form actions #}

{{ __("General") }}

{% if is_root_entity %} {% set title_options = { (constant("Entity::HELPDESK_TITLE_DEFAULT")): __("Default value"), (constant("Entity::HELPDESK_TITLE_CUSTOM")) : __("Custom value"), } %} {% else %} {% set title_options = { (constant("Entity::HELPDESK_TITLE_DEFAULT")): __("Default value"), (constant("Entity::HELPDESK_TITLE_CUSTOM")) : __("Custom value"), (constant("Entity::HELPDESK_TITLE_INHERIT")): __("Inherited from parent entity"), } %} {% endif %} {% set title_config = entity.getHelpdeskHomeTitleConfigForDropdown() %}

{{ __("Main title") }}

{% do call('Dropdown::showFromArray', [ 'custom_helpdesk_home_title', title_options, { value: title_config, width: "100%", aria_label: __('Main title'), } ]) %}
{# Default value preview #}
{{ inputs.text( '_preview', entity.getDefaultHelpdeskHomeTitle(), {disabled: true}, ) }}
{# Custom value preview #}
{{ inputs.text( '_custom_helpdesk_home_title', entity.getHelpdeskHomeTitle(), { additional_attributes: { placeholder: __("Enter a custom title..."), } } ) }}
{# Inherited value preview #}
{{ inputs.text( '_preview', entity.getHelpdeskHomeTitle(), {disabled: true}, ) }}
{% if is_root_entity %} {% set search_bar_options = { 1: __("Enabled"), 0: __("Disabled"), } %} {% else %} {% set search_bar_options_config = entity.isHelpdeskSearchBarEnabled() %} {% set search_bar_options = { 1: __("Enabled"), 0: __("Disabled"), (constant("Entity::CONFIG_PARENT")): __("Inherited from parent entity (%1$s)")|format(search_bar_options_config ? __("Enabled") : __("Disabled")), } %} {% endif %}

{{ __("Search bar") }}

{% do call('Dropdown::showFromArray', [ 'enable_helpdesk_home_search_bar', search_bar_options, { value: entity.fields.enable_helpdesk_home_search_bar, width: "100%", aria_label: __('Search bar'), } ]) %}
{% if is_root_entity %} {% set service_catalog_options = { 1: __("Enabled"), 0: __("Disabled"), } %} {% else %} {% set service_catalog_config = entity.isServiceCatalogEnabled() %} {% set service_catalog_options = { 1: __("Enabled"), 0: __("Disabled"), (constant("Entity::CONFIG_PARENT")): __("Inherited from parent entity (%1$s)")|format(service_catalog_config ? __("Enabled") : __("Disabled")), } %} {% endif %}

{{ __("Service catalog") }}

{% do call('Dropdown::showFromArray', [ 'enable_helpdesk_service_catalog', service_catalog_options, { value: entity.fields.enable_helpdesk_service_catalog, width: "100%", aria_label: __('Service catalog'), } ]) %}
{% if is_root_entity %} {% set expand_categories_options = { 1: __("Enabled"), 0: __("Disabled"), } %} {% else %} {% set expand_categories_config = entity.shouldExpandCategoriesInServiceCatalog() %} {% set expand_categories_options = { 1: __("Enabled"), 0: __("Disabled"), (constant("Entity::CONFIG_PARENT")): __("Inherited from parent entity (%1$s)")|format(expand_categories_config ? __("Enabled") : __("Disabled")), } %} {% endif %}

{{ __("Expand categories in the service catalog") }}

{% do call('Dropdown::showFromArray', [ 'expand_service_catalog', expand_categories_options, { value: entity.fields.expand_service_catalog, width: "100%", aria_label: __('Expand categories in the service catalog'), } ]) %}
{# Form actions #}