{#
 # ---------------------------------------------------------------------
 #
 # 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/>.
 #
 # ---------------------------------------------------------------------
 #}

{% set links = menu[sector]['content'][item]['options'][option]['links'] ?? menu[sector]['content'][item]['links'] ?? '' %}
{% set lists_itemtype = menu[sector]['content'][item]['options'][option]['lists_itemtype'] ?? menu[sector]['content'][item]['lists_itemtype'] ?? '' %}
{% if lists_itemtype is empty %}
    {% set lists_itemtype = item %}
{% endif %}

{% set display_divider = (links['add'] is defined or links|length > 0) %}

{% if display_divider %}
   {# @TODO  border-start is not implemented in current boostrap beta (remove border-left when done)  #}
   <ul class="nav navbar-nav border-start border-left ps-1 ps-sm-2 flex-row">
{% endif %}

{% if links['add'] is defined %}
<li class="nav-item">
   <a href="{{ path(links['add']) }}" class="btn btn-sm btn-primary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Add') }}">
      <i class="ti ti-plus"></i>
      <span class="d-none d-xxl-block">{{ __('Add') }}</span>
   </a>
</li>
{% endif %}

{% for type, link in links %}
   {% if type == 'add' or type == 'search' or type == 'lists' %}
   {% elseif type == 'template' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Manage templates...') }}">
            <i class="ti ti-template"></i>
            <span class="d-none d-xxl-block">{{ __('Templates') }}</span>
         </a>
      </li>
   {% elseif type == 'showall' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Show all') }}">
            <i class="ti ti-eye-check"></i>
            <span class="d-none d-xxl-block">{{ __('Show all') }}</span>
         </a>
      </li>
   {% elseif type == 'summary' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Summary') }}">
            <i class="ti ti-notes"></i>
            <span class="d-none d-xxl-block">{{ __('Summary') }}</span>
         </a>
      </li>
   {% elseif type == 'summary_kanban' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Global Kanban') }}">
            <i class="ti ti-layout-columns"></i>
            <span class="d-none d-xxl-block">{{ __('Global Kanban') }}</span>
         </a>
      </li>
   {% elseif type == 'transfer_list' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Transfer list') }}">
            <i class="ti ti-list-check"></i>
            <span class="d-none d-xxl-block">{{ __('Transfer list') }}</span>
         </a>
      </li>
   {% elseif type == 'config' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Setup') }}">
            <i class="ti ti-tool"></i>
            <span class="d-none d-xxl-block">{{ __('Setup') }}</span>
         </a>
      </li>
   {% elseif type == 'view_form_categories' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" role="button" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ 'Glpi\\Form\\Category'|itemtype_name(get_plural_number()) }}">
            <i class="ti ti-folder"></i>
            <span class="d-none d-xxl-block">{{ 'Glpi\\Form\\Category'|itemtype_name(get_plural_number()) }}</span>
         </a>
      </li>
   {% elseif type == 'import_forms' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" role="button" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ __('Import forms') }}">
            <i class="ti ti-file-arrow-left"></i>
            <span class="d-none d-xxl-block">{{ __('Import forms') }}</span>
         </a>
      </li>
   {% elseif type == 'Glpi\\Dropdown\\DropdownDefinition' %}
      <li class="nav-item">
         <a href="{{ path(link) }}" role="button" class="btn btn-sm btn-ghost-secondary me-1 pe-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ 'Glpi\\Dropdown\\DropdownDefinition'|itemtype_name }}">
            <i class="{{ 'Glpi\\Dropdown\\DropdownDefinition'|itemtype_icon }}"></i>
            <span class="d-none d-xxl-block">{{ 'Glpi\\Dropdown\\DropdownDefinition'|itemtype_name }}</span>
         </a>
      </li>
   {% else %}
      <li class="nav-item">
         <a href="{{ path(link) }}" class="btn btn-sm btn-ghost-secondary me-1 pe-2">
            {{ type|raw }}
         </a>
      </li>
   {% endif %}

{% endfor %}

{% if display_divider %}
   </ul>
{% endif %}
