#qi_header_wrapper.fh-fixedHeader
  %nav#admin_nav.navbar.navbar-expand-lg.navbar-dark.bg-light
    %button.navbar-toggler{"type" => "button", "data-toggle" => "collapse", "data-target" => "#navbarSupportedContent", "aria-controls" => "navbarSupportedContent", "aria-expanded" => "false", "aria-label" => "Toggle navigation"}
      %span.navbar-toggler-icon
    #navbarSupportedContent.collapse.navbar-collapse
      %ul.navbar-nav.mr-auto
        -if @qi_menu_active
          -qi_menu_active = @qi_menus[@qi_menu_active]

          -if qi_menu_active[:elements]
            -qi_menu_active[:elements].each do |k,v|
              -if !v[:sub_elements]
                %li.nav-item{class: ("active" if @qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)}
                  =link_to v[:name], v[:link], :class => "nav-link"
              
              -else
                %li.nav-item.dropdown
                  =link_to v[:name], v[:link], class: "nav-link dropdown-toggle "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k) or (v[:sub_elements] and v[:sub_elements][@qi_menu_sub_menu_active])).to_s , id: "navbarDropdown", "role" => "button", "data-toggle" => "dropdown", "aria-haspopup" => "true", "aria-expanded" => "false"
                  %ul.dropdown-menu{"aria-labelledby" => "navbarDropdown"}
                    -v[:sub_elements].each do |k,v|
                      %li=link_to v[:name], v[:link], :class => "dropdown-item"+(" active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s
                



              /   =qi_menu_active[:elements].each do |k,v|
              /     %li.dropdown-item=link_to v[:name], v[:link], :class => "nav-link "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s
              / %li.nav-item= link_to v[:name], v[:link], :class => "nav-link "+("active" if (@qi_menu_sub_menu_active and @qi_menu_sub_menu_active == k)).to_s



      %ul.nav.navbar-nav.navbar-right.ml-auto
        %li.nav-item.qi_help_remove{:style => ("display:none" if !session[:qi_helps] )}

          =link_to ic(:"question-circle"), admin_qi_helps_path(), :onclick => '$(".qi_help").hide();$(".qi_help_add").show();$(".qi_help_remove").hide();', :remote => true, :class => "nav-link"


        %li.nav-item.qi_help_add{:style => ("display:none" if session[:qi_helps] )}
          =link_to ic(:"question-circle-o"), admin_qi_helps_path(:enabled => true), :onclick => '$(".qi_help").show();$(".qi_help_add").hide();$(".qi_help_remove").show();', :remote => true, :class => "nav-link"



        -if session[:qi_helps]
          :scss
            .qi_help{
              display:inherit;

              }
        -else
          :scss
            .qi_help{
              display:none;

            }


        %li.nav-item.dropdown
          -if current_admin
            %a#navbarDropdown.nav-link.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :href => "#", :role => "button"}
              =current_admin.firstname
              =current_admin.name


            .dropdown-menu{"aria-labelledby" => "navbarDropdown"}
              = link_to "Gestion des admins", admin_admins_path, :class => "dropdown-item" if current_admin.super_admin
              .dropdown-divider
              =link_to "Se déconnecter", admin_admin_auth_path(1), method: :delete, :class => "dropdown-item"




        %li.nav-item
          =link_to ic(:refresh), "#", :onclick => "location.reload();", :class => "nav-link"



  = yield :header
