<!-- Main menu -->

%   use SrvMngr qw( getNavigation );
%   my %nav = %{SrvMngr->getNavigation( $c->languages(), 'A' )};

%if (config->{debug} == 1) {
    <li class="nav-header">tmpl: _navig2</li>
% }

%    # Define a hash mapping headings to icons
% my %icon_map = (
%    "User management" => "bi-people-fill",
%    "Network"         => "bi-shuffle",
%    "Investigation"   => "bi-question",
%    "System"          => "bi-pc-display-horizontal",
%    "Legacy"          => "bi-archive",
% );

<li class="nav-header">ADMINISTRATION</li>

    %    my $cc = 100;
    %    foreach my $h (sort { ($nav{$a}{'WEIGHT'}/$nav{$a}{'COUNT'}) 
    %        <=> ($nav{$b}{'WEIGHT'}/$nav{$b}{'COUNT'}) } keys %nav) {

    % # Retrieve the icon based on the value of $h
    % my $icon = $icon_map{$h} // ""; # Default to an empty string if $h is not found

        <!-- Group Header-->
        <li class="nav-item">
            <a href='#' class="nav-link">
                <i class="nav-icon bi <%= $icon %> "></i>
                <%= $h %>
                <i class="nav-arrow bi bi-chevron-right"></i>
            </a>
            <ul class="nav nav-treeview">
    
            %   my ($classNew, $target, $href) = '';
            %   foreach (sort { $a->{'WEIGHT'} <=> $b->{'WEIGHT'} }  @{$nav{$h}{'DESCRIPTIONS'}}) {
            %       next if ($_->{'MENUCAT'} ne 'A' );  # menu Admin 
            %       if ( $_->{'FILENAME'} =~ m/^2\// ) {
            %       $target = '_self';
            %           (my $file2 = $_->{'FILENAME'}) =~ s|^2/||;
            %           $href = '/smanager/' . $file2;
            %       } else {
            %       $target = 'main';
            %           my $host = $c->req->url->to_abs->host;
            %           $href = "/smanager/legacypanel?url=https://$host/server-manager" . $_->{'FILENAME'};
            % 
            %       }

            <li class="nav-item">
                 <a  target='<%= $target %>' href='<%= $href %>' class="nav-link">
                 <i class="nav-icon bi bi-dot"></i>
                 <%= $_->{'DESCRIPTION'} %>
                 </a>
            </li>
    
    
            <!-- End trying tree view menus -->
            %           $cc++;
            %   }
            
            </ul>
        </li>
    % }

