{# # --------------------------------------------------------------------- # # 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 "generic_show_form.html.twig" %} {% import 'components/form/fields_macros.html.twig' as fields %} {% set params = params ?? [] %} {% block more_fields %} {{ fields.dropdownField( 'CableStrand', 'cablestrands_id', item.fields['cablestrands_id'], 'CableStrand'|itemtype_name, field_options ) }} {{ fields.colorField( 'color', item.fields['color'], __('Color'), field_options ) }}
{% for side in ['a', 'b'] %} {% set rand_side = random() %} {% set side_options = field_options|merge({ 'full_width': true, 'full_width_adapt_column': false, 'rand': rand_side, }) %} {% set html_side %}
{% set side_heading %}

{{ __('Endpoint %s')|format(side|upper()) }}

{% endset %}
{{ fields.field( '', side_heading, '', side_options ) }}
{% set dropdown_item %} {% set current_itemtype = item.fields['itemtype_endpoint_' ~ side] %} {{ fields.dropdownField( current_itemtype, 'items_id_endpoint_' ~ side, item.fields['items_id_endpoint_' ~ side], '', side_options|merge({ no_label: true, }) ) }} {% endset %} {{ fields.dropdownArrayField( 'itemtype_endpoint_' ~ side, item.fields['itemtype_endpoint_' ~ side], call('Glpi\\Socket::getSocketLinkTypes'), _n('Asset', 'Assets', 1), side_options|merge({ 'add_field_html': dropdown_item }) ) }} {% do call('Ajax::updateItemOnSelectEvent', [ 'dropdown_itemtype_endpoint_' ~ side ~ rand_side, 'show_items_id_endpoint_' ~ side ~ '_field', config('root_doc') ~ '/ajax/cable.php', { 'itemtype': '__VALUE__', 'dom_name': 'items_id_endpoint_' ~ side, 'action': 'get_items_from_itemtype', 'dom_rand': rand_side } ]) %} {{ fields.dropdownField( 'Glpi\\SocketModel', 'socketmodels_id_endpoint_' ~ side, item.fields['socketmodels_id_endpoint_' ~ side], 'Glpi\\SocketModel'|itemtype_name, side_options ) }} {{ fields.dropdownField( 'Glpi\\Socket', 'sockets_id_endpoint_' ~ side, item.fields['sockets_id_endpoint_' ~ side], 'Glpi\\Socket'|itemtype_name, side_options|merge({ 'condition': { 'socketmodels_id': item.fields['socketmodels_id_endpoint_' ~ side], 'itemtype': item.fields['itemtype_endpoint_' ~ side], 'items_id': item.fields['items_id_endpoint_' ~ side] }, 'used': item.fields['items_id_endpoint_' ~ side] is not empty ? call('Glpi\\Socket::getSocketAlreadyLinked', [item.fields['itemtype_endpoint_' ~ side], item.fields['items_id_endpoint_' ~ side]]) : [] }) ) }} {% set asset_breadcrumb %} {% if item.fields['items_id_endpoint_' ~ side]|length > 0 %} {% set breadcrumb = call(item.fields['itemtype_endpoint_' ~ side] ~ '::getDcBreadcrumbSpecificValueToDisplay', [ item.fields['items_id_endpoint_' ~ side], ]) %} {{ breadcrumb|raw }} {% endif %} {% endset %} {{ fields.htmlField( 'position', asset_breadcrumb, __('Position'), side_options ) }}
{% endset %} {{ fields.noLabelField( html_side ) }} {% endfor %}
{% endblock %}