<div class="flexcol flex-nowrap gap-0 w-[200px] h-full [% IF menu_states.exists('cl') && menu_states.cl == 1 %]collapsed[% END %]" id="nav-container" onmouseover="resetRefresh()">

  <header class="header flex-shrink-0 hidden lg:flex h-[50px]">
    <a href="[% c.config.home_link %]" target="[% c.config.home_link_target %]" class="m-auto block">
      <img src="[% url_prefix %]themes/[% theme %]/images/logo_thruk_small.png" alt="Thruk" title="Thruk" class="h-[42px]" />
      <img src="[% url_prefix %]themes/[% theme %]/images/logo_thruk_small_icon.png" alt="Thruk" title="Thruk" class="h-[36px] collapsed-only" />
    </a>
  </header>

  <div class="navsectionlinks sticky scrollauto overflow-x-hidden grow">
    <ul class="p-1 pt-0">
      [%- IF navigation != "" && navigation != "off" -%]
      [%- FOREACH section = navigation -%]
      [%- cookie_section_name = section.name.replace(' ', '_') | lower %]
        <li>
          <a class="navsectiontitle navitem">
            <i class="uil [% IF section.defined('icon') && section.icon != "" %][% section.icon | html %][% ELSE %]uil-folder[% END %] text-base h-fit"></i>
            <span>[% section.name | html %]</span>
            <i class="uil uil-angle-down h-fit ml-auto text-2xl"></i>
          </a>

          <ul class="navsectionlinks" [% IF !menu_states.exists(cookie_section_name) || menu_states.$cookie_section_name == 0 %] style="display:none;"[% END %]>
            [%- FOREACH link = section.links -%]
              [%- IF link.href %]
                <li class="relative"><a class="navsectionsubtitle navitem" href="[% escape_html(link.href) %]" target="[% link.target %]">[% link.name | html %]</a>
                  [%- IF link.defined("html") %][% link.html %][% END -%]
                  [%- IF link.links.size > 0 %]
                    <i class="uil uil-angle-down w-fit h-fit absolute right-0 top-0 mr-[-2px] px-1 rounded text-lg clickable hoverable navsectionsubtoggle"></i>
                    [%- cookie_section_sub_name = cookie_section_name _ '.' _ link.name.replace(' ', '_') | lower %]
                    <ul class="navsectionsublinks" [% IF !menu_states.exists(cookie_section_sub_name) || menu_states.$cookie_section_sub_name == 0 %] style="display:none;"[% END %]>
                      [%- FOREACH sublink = link.links -%]
                        [%- IF sublink.defined("href") && sublink.href %]
                          <li><a class="sublink navitem" href="[% escape_html(sublink.href) %]" target="[% sublink.target %]">[% sublink.name | html %]</a>
                            [%- IF sublink.defined("html") %][% sublink.html %][% END -%]</li>
                        [%- END -%]
                        [%- IF sublink.defined("html") %]
                          <li>[% sublink.html %]</li>
                        [%- END -%]
                      [%- END %]
                    </ul>
                  [%- END -%]</li>
              [%- ELSIF link.defined("search") && link.search %]
                <li>
                  <div class="js-advanced-toggle">
                    <form method="GET" action="[% url_prefix %]cgi-bin/status.cgi" target="[% link.target %]" class="pl-6 pr-[10px]">
                      <fieldset>
                        [%- IF link.defined("name") &&  link.name != "" -%]
                        <span class="searchlabel">[% link.name | html %]</span>
                        [%- END %]
                        <input type='hidden' name='style' value='detail' />
                        <input type='hidden' name='s0_op' value='~' id="s0_to" />
                        <input type='hidden' name='s0_type' value='search' />
                        <input type='hidden' name='add_default_service_filter' value='1' />
                        <input type='search' name='s0_value' class="deletable autosubmit js-suggest-advanced w-full my-[1px]" id="s0_value" placeholder="search..." />
                        <input type='search' name='q' onfocus="initAutoCompleteQuery(this, queryCodeCompletions)" class="w-full js-advancedfilter" placeholder="advanced search..." autocomplete="off" style="display: none;" disabled />
                      </fieldset>
                    </form>
                  </div>
                </li>
              [%- ELSIF link.defined("html") %]
                <li>[% link.html %]</li>
              [%- END -%]
            [%- END %]
          </ul>
        </li>
      [%- END -%]
      [%- END %]
    </ul>
  </div>

  <div class="h-8 flex-shrink-0 mt-auto w-full m-0 hidden lg:block collapse-btn">
    <div class="flexrow flex-nowrap gap-0">
      <button class="iconOnly w-full py-0 px-1.5 pl-[15px] m-0 h-8 block text-left hoverable js-menu-collapse" title="toggle collapsed side navigation.">
        <i class="uil uil-angle-double-left text-2xl contents" title="collapse navigation"></i>
      </button>
      <button class="iconOnly w-full py-0 px-1.5 pl-[15px] m-0 h-8 block hoverable btn-nav-hide js-menu-hide" title="toggle hover side navigation.">
        <i class="uil uil-angle-double-up text-2xl contents" title="hide navigation"></i>
      </button>
    </div>
  </div>
</div>

[%- PROCESS _ajax_search.tt -%]
