<?php
/**
 * The template part for Middle Header
 *
 * @package Auction Bidding 
 * @subpackage auction-bidding
 * @since auction-bidding 1.0
 */
?>
  
<!-- Middle Header -->
<div class="middle-header">
  <div class="container">
    <div class="row">
      <div class="col-lg-2 col-md-3 col-12 text-lg-start text-md-start text-center align-self-center">
        <?php if(class_exists('woocommerce')){ ?>
          <div class=" position-relative">
            <button class="product-btn text-lg-start text-md-start text-center"><i class="fas fa-bars"></i><?php esc_html_e('Categories','auction-bidding'); ?></button>
              <div class="product-cat">
                <?php
                  $args = array(
                    'orderby'    => 'title',
                    'order'      => 'ASC',
                    'hide_empty' => 0,
                    'parent'  => 0
                  );
                  $product_categories = get_terms( 'product_cat', $args );
                  $count = count($product_categories);
                  if ( $count > 0 ){
                      foreach ( $product_categories as $product_category ) {
                        $product_cat_id = $product_category->term_id;
                        $cat_link = get_category_link( $product_cat_id );
                        if ($product_category->category_parent == 0) { ?>
                      <li class="drp_dwn_menu"><a href="<?php echo esc_url(get_term_link( $product_category ) ); ?>">
                      <?php
                    }
                    echo esc_html( $product_category->name ); ?></a><i class="fas fa-chevron-right"></i></li>
                <?php } } ?>
              </div>
          </div>
        <?php }?>
      </div>
      <div class="col-lg-10 col-md-9 align-self-center">
        <div class="row">
          <div class="col-lg-4 col-md-1 align-self-center">
            <div class="primary-left">
              <div id="mySidenav" class="nav sidenav">
                <nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu', 'auction-bidding' ); ?>">
                  <?php 
                      wp_nav_menu( array( 
                        'theme_location' => 'primary-left',
                        'container_class' => 'main-menu clearfix' ,
                        'menu_class' => 'clearfix',
                        'items_wrap' => '<ul id="%1$s" class="%2$s mobile_nav">%3$s</ul>',
                        'fallback_cb' => 'wp_page_menu',
                      ) ); 
                  ?>
                  <a href="javascript:void(0)" class="closebtn mobile-menu" onclick="auction_bidding_menu_close_nav()"><i class="fas fa-times"></i><span class="screen-reader-text"><?php esc_html_e('Close Button','auction-bidding'); ?></span></a>
                </nav>
              </div>
            </div>
            </div>
            <div class="col-lg-2 col-md-5 text-center align-self-center pt-lg-0 pt-md-0 pt-2">
              <div class="logo_outer_box">
                <div class="logo_outer">
                  <div class="logo">
                    <?php if ( has_custom_logo() ) : ?>
                      <div class="site-logo"><?php the_custom_logo(); ?></div>
                    <?php endif; ?>
                    <?php $blog_info = get_bloginfo( 'name' ); ?>
                      <?php if ( ! empty( $blog_info ) ) : ?>
                        <?php if ( is_front_page() && is_home() ) : ?>
                          <?php if( get_theme_mod('auction_bidding_logo_title_hide_show',true) == 1){ ?>
                            <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                          <?php } ?>
                        <?php else : ?>
                          <?php if( get_theme_mod('auction_bidding_logo_title_hide_show',true) == 1){ ?>
                            <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
                          <?php } ?>
                        <?php endif; ?>
                      <?php endif; ?>
                      <?php
                        $description = get_bloginfo( 'description', 'display' );
                        if ( $description || is_customize_preview() ) :
                      ?>
                      <?php if( get_theme_mod('auction_bidding_tagline_hide_show',false) == 1){ ?>
                        <p class="site-description">
                          <?php echo esc_html( $description ); ?>
                        </p>
                      <?php } ?>
                    <?php endif; ?>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-lg-4 col-md-1 align-self-center">
              <div class="primary-right">
                <div id="mySidenav" class="nav sidenav">
                  <nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu', 'auction-bidding' ); ?>">
                    <?php 
                        wp_nav_menu( array( 
                          'theme_location' => 'primary-right',
                          'container_class' => 'main-menu clearfix' ,
                          'menu_class' => 'clearfix',
                          'items_wrap' => '<ul id="%1$s" class="%2$s mobile_nav">%3$s</ul>',
                          'fallback_cb' => 'wp_page_menu',
                        ) ); 
                    ?>
                    <a href="javascript:void(0)" class="closebtn mobile-menu" onclick="auction_bidding_menu_close_nav()"><i class="fas fa-times"></i><span class="screen-reader-text"><?php esc_html_e('Close Button','auction-bidding'); ?></span></a>
                  </nav>
                </div>
              </div>
            </div>
          <div class="col-lg-1 col-md-2 col-6 align-self-center text-lg-end text-end py-lg-0 py-md-0 py-3">
            <?php if( get_theme_mod( 'auction_bidding_header_search',true) == 1) { ?>
              <div class="search-box">
                <span><a href="#"><i class='fas fa-search'></i></a></span>
              </div>
            <?php }?>
            <div class="serach_outer">
              <div class="closepop"><a href="#maincontent"><i class="<?php echo esc_attr(get_theme_mod('auction_bidding_search_close_icon','fa fa-window-close')); ?>"></i></a></div>
              <div class="serach_inner">
                <?php get_search_form(); ?>
              </div>
            </div>
          </div>
          <div class="col-lg-1 col-md-3 col-6 align-self-center text-lg-end text-start py-lg-0 py-md-0 py-3">
            <span class="cart_no">
              <div class="wishlist">
                <?php if(class_exists('woocommerce')){ ?>
                  <?php if(defined('YITH_WCWL')){ ?>
                    <a class="wishlist_view" href="<?php echo YITH_WCWL()->get_wishlist_url(); ?>" title="<?php esc_attr_e('Wishlist','auction-bidding'); ?>"><i class="far fa-heart me-2"></i>
                    </a>
                  <?php }?>
                <?php }?>
              </div> 
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
