{#
 # ---------------------------------------------------------------------
 #
 # GLPI - Gestionnaire Libre de Parc Informatique
 #
 # http://glpi-project.org
 #
 # @copyright 2015-2026 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 <https://www.gnu.org/licenses/>.
 #
 # ---------------------------------------------------------------------
 #}

{#
    REQUIRED:
        - `destination`: FormDestination
        - `form`: Form
        - `can_update`: bool
        - `concrete_destination`: FormDestinationInterface|null
#}

{% set _source = destination.fields['itemtype']|itemtype_plugin_key|default('glpi') %}

<form id="form-destination-{{ destination.getID() }}">
    <div class="overflow-x-hidden px-4">
        {% if concrete_destination %}
            {{ concrete_destination.renderConfigForm(
                form,
                destination,
                destination.getConfig()
            )|raw }}
        {% else %}
            <div class="mt-2 alert alert-danger" role="alert">
                {{ __('This destination is not available, the plugin "%1$s" is deactivated or removed.')|format(_source) }}
            </div>
        {% endif %}
        {% if (concrete_destination ? concrete_destination.useDefaultConfigLayout() : true) and can_update %}
            <div class="mt-3 mb-3">
                {{ include('pages/admin/form/form_destination_actions.html.twig', {
                    form: form,
                    destination: destination
                }, with_context = false) }}
            </div>
        {% endif %}
    </div>

    {# Hidden values #}
    <input type="hidden" name="id" value="{{ destination.getID() }}"/>
    <input type="hidden" name="_glpi_csrf_token" value="{{ csrf_token() }}"/>
</form>
