{#
# ---------------------------------------------------------------------
#
# 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 rand = random() %}
{% set several = several|default(false) %}
{{ fields.dropdownArrayField('itemtype', itemtype, call('Glpi\\Socket::getSocketLinkTypes'), null, {
no_label: true,
rand: rand,
mb: '',
field_class: 'col-12'
}) }}
{% do call('Ajax::updateItemOnSelectEvent', [
'dropdown_itemtype' ~ rand,
'show_items_id_field',
CFG_GLPI.root_doc ~ '/ajax/cable.php',
{
itemtype: '__VALUE__',
dom_rand: rand,
dom_name: 'items_id',
action: 'get_items_from_itemtype'
}
]) %}
{% if itemtype is not empty %}
{{ fields.dropdownField(itemtype, 'items_id', items_id, null, {
no_label: true,
display_emptychoice: true,
display_dc_position: itemtype in config('rackable_types'),
rand: rand,
mb: '',
field_class: 'col-12'
}) }}
{% endif %}
{% if not several %}
{{ fields.dropdownField('NetworkPort', 'networkports_id', networkports_id, null, {
no_label: true,
condition: {
items_id: items_id,
itemtype: itemtype
},
display_emptychoice: true,
comments: false,
mb: '',
field_class: 'col-12'
}) }}
{% endif %}