<!-- HEADER -->
<div id="divHeaderWrapper">
  <header class="top_header fondo_principal">
    <div class="container">
      <div class="row">
        <div class="col-sm-6 hidden-xs contacto_header">
          <% if @current_agency.phone_number_primary %>
            <%= icon(:phone, size: :sm) %><%= @current_agency.phone_number_primary %> &nbsp;&nbsp;
          <% end %>
          <% if @current_agency.email_primary %>
            <%= icon(:email, size: :sm) %><%= @current_agency.email_primary %>
          <% end %>
        </div>
        <div class="col-sm-6">
          <% if @current_website.is_multilingual && not_devise %>
            <div class="contenedor_idiomas" style="">
              <ul class="idiomas">
                <% @current_website.supported_locales_with_variants.each do |locale_with_var| %>
                  <li class=<%="#{'selected' if locale.to_s == locale_with_var["locale"]}" %>>
                    <%= localized_link_to locale_with_var, params.permit(:locale,).merge({:locale => locale_with_var["locale"]}), class: locale_with_var["variant"] %>
                  </li>
                <% end %>
              </ul>
            </div>
          <% end %>
        </div>
      </div>
    </div>
  </header>
  <header class="header-standard-2">
    <!-- MAIN NAV -->
    <div class="navbar navbar-wp navbar-arrow mega-nav" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <%= icon(:menu, class: "icon-custom") %>
          </button>
          <%= link_to main_app.root_path(locale: locale), class: "navbar-brand" do %>
            <% if @current_website.logo_url  %>
              <img src="<%= @current_website.logo_url %>" alt="Logo" loading="eager" fetchpriority="high">
            <% else %>
              <div class="text-navbar-brand" style="">
                <%= company_display_name %>
              </div>
            <% end %>
          <% end %>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            <% @current_website.links.ordered_visible_top_nav.each do |page| %>
              <% next if page.slug == "top_nav_admin" %>
              <% target_path = nil %>
              <% begin %>
                <% if page.link_path.present? %>
                  <% target_path = main_app.send(page.link_path, page.link_path_params, { locale: locale }) %>
                <% elsif page.link_url.present? %>
                  <% target_path = page.link_url %>
                <% end %>
              <% rescue StandardError %>
              <% end %>

              <% if target_path %>
                <% style_class = "selected active" if current_page?(target_path) %>
                <% if current_page?("/") && (page.link_path == "home_path") %>
                  <% style_class = "selected active" %>
                <% end %>
                <li class="<%= style_class %>">
                  <%= link_to page.link_title, target_path, target: page.href_target %>
                </li>
              <% end %>
            <% end %>


            <% if @show_admin_link  %>
              <li class="">
                <%= link_to I18n.t("navbar.admin"), main_app.admin_with_locale_path(locale: locale)  %>
              </li>
            <% end %>
            <% if current_user %>
              <li class="<%= 'selected' if current_page?(main_app.admin_with_locale_path(locale: locale)) %>">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                  <%= t "navbar.admin" %>
                </a>
                <ul class="dropdown-menu">
                  <li>
                    <%= link_to I18n.t("navbar.admin"), main_app.admin_with_locale_path(locale: locale)  %>
                  </li>
                  <li>
                    <%= link_to I18n.t("changePassword"), main_app.edit_user_registration_path() %>
                  </li>
                  <li>
                    <%= auth_logout_link I18n.t("signOut") %>
                  </li>
                </ul>
              </li>
            <% end %>
          </ul>
        </div>
        <!--/.nav-collapse -->
      </div>
    </div>
  </header>
</div>
