{#
 # ---------------------------------------------------------------------
 #
 # 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 anonymous = session('glpiactiveprofile') is null %}

{% set is_vertical = user_pref('page_layout') == 'vertical' %}

<body class="{{ user_pref('fold_menu') and is_vertical ? 'navbar-collapsed' : '' }} {{ is_vertical ? 'vertical-layout' : 'horizontal-layout' }} {{ is_debug_active ? 'debug-active' : '' }}">
   {% if constant('SKIP_UPDATES') is defined and call('Update::isDbUpToDate') == false %}
      <div class="banner-need-update">
         {{ __("You are bypassing a needed update") }}
      </div>
   {% endif %}
   {{ include('layout/parts/impersonate_banner.html.twig') }}
   {{ include('components/messages_after_redirect_toasts.html.twig', {'display_container': true}) }}

   <div class="page">

      {% if is_vertical %}
      <aside class="navbar navbar-vertical navbar-expand-lg sticky-lg-top sidebar">
         <div class="container-fluid">
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
               <span class="navbar-toggler-icon"></span>
            </button>

            <a href="{{ index_path() }}" accesskey="1" title="{{ __('Home') }}"
               class="navbar-brand">
               <span class="glpi-logo"></span>
            </a>

            {% if not anonymous %}
               <span class="d-none d-lg-inline-block">
                   {{ include('layout/parts/goto_button.html.twig') }}
               </span>
            {% endif %}

            {% if user is not null %}
               {# There may still be a user logged in without a profile or entity. This is seen when they need to reset their password. #}
               <div class="d-lg-none">
                  {{ include('layout/parts/user_header.html.twig') }}
               </div>
            {% endif %}

            {% if not anonymous %}
               <div class="collapse navbar-collapse" id="navbar-menu">
                   <span class="d-inline-block d-lg-none ms-2">
                       {{ include('layout/parts/goto_button.html.twig') }}
                   </span>
                   {{ include('layout/parts/menu.html.twig') }}


                  <p class="text-start">
                     <button class="btn btn-sm btn-ghost-secondary  {{ is_debug_active ? 'mb-4' : 'mb-2' }} reduce-menu d-none d-md-block">
                        <span class="menu-label">{{ __('Collapse menu') }}</span>
                     </button>
                  </p>
               </div>
            {% endif %}
         </div>
      </aside>
      {% endif %}

      <header class="navbar d-print-none sticky-lg-top shadow-sm {{ user_pref('page_layout') == 'vertical' ? 'navbar-light navbar-expand-md' : 'navbar-dark navbar-expand-xl topbar' }}">
         <div class="container-fluid flex-xl-nowrap pe-xl-0">
            {% if user_pref('page_layout') == 'vertical' %}
               {{ include('layout/parts/breadcrumbs.html.twig') }}

                <div class="ms-lg-auto d-none d-lg-block flex-grow-1 flex-lg-grow-0">
                     {{ include('layout/parts/global_search_form.html.twig') }}
                </div>

            {% elseif user_pref('page_layout') == 'horizontal' %}
               <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-menu">
                  <span class="navbar-toggler-icon"></span>
               </button>

               <a href="{{ index_path() }}" accesskey="1" title="{{ __('Home') }}"
                  class="navbar-brand">
                  <span class="glpi-logo"></span>
               </a>

               <div class="d-lg-none">
                  {{ include('layout/parts/user_header.html.twig') }}
               </div>

               <div class="collapse navbar-collapse justify-content-center" id="navbar-menu">
                  {{ include('layout/parts/menu.html.twig') }}
                  <span class="ms-xl-2 d-inline-block mt-2 mt-xl-2">
                     {{ include('layout/parts/goto_button.html.twig') }}
                  </span>
               </div>
            {% endif %}

            <div class="ms-md-4 d-none d-lg-block">
               {{ include('layout/parts/user_header.html.twig') }}
            </div>
         </div>
      </header>

      {% if user_pref('page_layout') == 'horizontal' %}
      <div class="navbar navbar-expand-md navbar-light secondary-bar sticky-md-top shadow-sm">
         <div class="container-fluid justify-content-start">
            {{ include('layout/parts/breadcrumbs.html.twig') }}
            <div class="ms-md-auto d-none d-md-block flex-grow-1 flex-md-grow-0">
                {{ include('layout/parts/global_search_form.html.twig') }}
            </div>
         </div>
      </div>
      {% endif %}

      <div class="page-wrapper mb-0">
         <div class="page-body container-fluid">
            <main role="main" id="page" class="legacy">
