<?php
/**
 * The template part for Middle Header
 *
 * @package Commercial Automation Services 
 * @subpackage commercial-automation-services
 * @since commercial-automation-services 1.0
 */
?>

<div class="middle-header <?php if( get_theme_mod( 'commercial_automation_services_sticky_header', false) == 1 || get_theme_mod( 'commercial_automation_services_stickyheader_hide_show', false) == 1) { ?> header-sticky"<?php } else { ?>close-sticky <?php } ?>">
	<div class="container">
		<div class="row">
			<div class="col-xl-2 col-lg-2 col-md-4 col-sm-4 col-8 align-self-center">
				<div class="logo ">
		          <?php if ( has_custom_logo() ) : ?>
		            <div class="site-logo"><?php the_custom_logo(); ?></div>
		          <?php endif; ?>
		          <?php $commercial_automation_services_blog_info = get_bloginfo( 'name' ); ?>
		            <?php if ( ! empty( $commercial_automation_services_blog_info ) ) : ?>
		              <?php if ( is_front_page() && is_home() ) : ?>
		                <?php if( get_theme_mod('commercial_automation_services_logo_title_hide_show',true) == 1){ ?>
		                  <p class="site-title mb-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
		                <?php } ?>
		              <?php else : ?>
		                <?php if( get_theme_mod('commercial_automation_services_logo_title_hide_show',true) == 1){ ?>
		                  <p class="site-title mb-0"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
		                <?php } ?>
		              <?php endif; ?>
		            <?php endif; ?>
		            <?php
		              $commercial_automation_services_description = get_bloginfo( 'description', 'display' );
		              if ( $commercial_automation_services_description || is_customize_preview() ) :
		            ?>
		            <?php if( get_theme_mod('commercial_automation_services_tagline_hide_show',false) == 1){ ?>
		              <p class="site-description mb-0">
		                <?php echo esc_html($commercial_automation_services_description); ?>
		              </p>
		            <?php } ?>
		          <?php endif; ?>
		        </div>
			</div>
			<div class="col-xl-7 col-lg-7 col-md-4 col-sm-2 col-4 align-self-center menu-col ">
				<?php get_template_part('template-parts/header/navigation'); ?>
			</div>
			<div class="col-xl-3 col-lg-3 col-md-4 col-sm-6 align-self-center text-lg-end">
				<div class="d-flex gap-2 topbar-icons justify-content-end">
					<!-- product search -->
					<?php if(class_exists('woocommerce')){ ?>
		                <div class="search-box">
		                  <span><a href="#"><i class='<?php echo esc_attr(get_theme_mod('commercial_automation_services_search_open_icon','fas fa-search')); ?>'></i></a></span>
		                </div>
		                <div class="serach_outer" style="display:none;">
		                  <div class="closepop"><a href="#maincontent"><i class="<?php echo esc_attr(get_theme_mod('commercial_automation_services_search_close_icon','fa-solid fa-xmark')); ?>"></i></a></div>
		                    <div class="serach_inner">
		                      <?php get_product_search_form(); ?>
		                    </div>
		                </div>
	             	 <?php }?>
	             	 <!-- product cart -->
	             	 <?php if( get_theme_mod( 'commercial_automation_services_cart_hide_show', true) == 1) { ?>
		              <?php if(class_exists('woocommerce')){ ?>
		                <span class="cart_shop">
		                  <a href="<?php if(function_exists('wc_get_cart_url')){ echo esc_url(wc_get_cart_url()); } ?>" title="<?php esc_attr_e( 'shopping cart','commercial-automation-services' ); ?>"><i class="<?php echo esc_attr(get_theme_mod('commercial_automation_services_cart_icon','fa-solid fa-cart-shopping')); ?>"></i><span class="screen-reader-text"><?php esc_html_e( 'Shopping Cart','commercial-automation-services' );?></span></a>
		                </span>
		            <?php }} ?>
		            <!-- wishlist -->
	                <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','commercial-automation-services'); ?>"><i class="<?php echo esc_attr(get_theme_mod('commercial_automation_services_heart_icon','far fa-heart')); ?> "></i>
	                        </a>
	                      <?php }?>
	                    <?php }?>
	                  </div>
	                </span>
	                <!-- my account -->
	                <?php if(class_exists('woocommerce')){ ?>
			          <?php if ( is_user_logged_in() ) { ?>
			            <a class="myaccount-icon" href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>"><i class="<?php echo esc_attr(get_theme_mod('commercial_automation_services_topbar_myaccount_icon','fas fa-user')); ?>"></i></a>
			          <?php }
			          else { ?>
			            <a class="myaccount-icon" href="<?php echo esc_url( get_permalink( get_option('woocommerce_myaccount_page_id') ) ); ?>" title="<?php esc_attr_e('Login / Register','commercial-automation-services'); ?>"><i class="<?php echo esc_attr(get_theme_mod('commercial_automation_services_topbar_myaccount_icon','fas fa-user')); ?>"></i><span class="screen-reader-text"></span></a>
			          <?php } ?>
			        <?php }?>
				</div>
			</div>
		</div>
	</div>
</div>