<!-- Support menu -->

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

%    # Define a hash mapping headings to icons
%    my %icon_map = (
%        "Home"                        => "bi-house",
%        "Online manual"               => "bi-book",
%        "Support and licensing"       => "bi-card-text",
%    );

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

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

    <!-- Add the section header -->
    <li class="nav-header"><%= $h %></li>

    <!-- Then loop and add the actual links -->
    %   my ($classNew, $target, $href) = '';
    %   foreach (sort { $a->{'WEIGHT'} <=> $b->{'WEIGHT'} }  @{$nav{$h}{'DESCRIPTIONS'}}) {
    %       next if ($_->{'MENUCAT'} ne 'N' );  # menu Navigation 
    %       if ( $_->{'FILENAME'} =~ m/^2\// ) {
    %       $target = '_self';
    %           (my $file2 = $_->{'FILENAME'}) =~ s|^2/||;
    %           $href = '/smanager/' . $file2;
    %       } else {
    %       $target = 'main';
    %           $href = '/server-manager' . $_->{'FILENAME'};
    %       }


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

    <li class="nav-item">
        <a  target='<%= $target %>' href='<%= $href %>' class="nav-link">
        <i class="nav-icon bi <%= $icon %>"></i>
        <%= $_->{'DESCRIPTION'} %>
        </a>
    </li>


    %  $cc++;
    %  }

    <!-- Fix missing mobile login button in header -->
    % if ( not defined $c->session->{username} ) {
    <li class="nav-item">
        <a href="login" class="nav-link">
        <i class="nav-icon bi bi-key"></i>
        Login</a>
    </li>

            % }

% }

