<?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package StoreZ
 */

?>
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="profile" href="https://gmpg.org/xfn/11">

	<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<div id="page" class="site">
	
	<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'storez' ); ?></a>
	
	<header id="masthead" class="site-header">
		<?php if(get_theme_mod('storez_topbar_enable', true)): ?>
		<div class="header-topbar">
			<div class="container">
				<div class="row">
					<div class="col-md-6 text-sm-center text-md-start left-block"><?php  storez_get_contact_block(); ?></div>
					<div class="col-md-6 text-sm-center text-md-end right-block"><?php
						wp_nav_menu(array(
							'theme_location'    => 'top_nav',
							'depth'             => 1,
							'container'         => false,
							'menu_class'        => 'topbar-menu',
							'menu_id'           => 'topbar-menu',
							'fallback_cb'       => false,
						));
						storez_get_social_block();
					?></div>
				</div>
			</div>
		</div>
		<?php endif; ?>
		<div class="header-middle">
			<div class="container">
				<div class="row align-items-center">
					<div class="col-md-3 col-sm-12">
						<div class="site-branding">
						<?php
							the_custom_logo();
							if ( is_front_page() && is_home() ) :
								?>
								<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
								<?php
							else :
								?>
								<p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></p>
								<?php
							endif;
							$storez_description = get_bloginfo( 'description', 'display' );
							if ( $storez_description || is_customize_preview() ) :
								?>
								<p class="site-description"><?php echo $storez_description; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
							<?php endif; ?>
						</div><!-- .site-branding -->
					</div>
					<?php if(class_exists('WooCommerce')): ?>
					<div class="col-md-9 col-sm-12">
						<div class="row">
							<div class="col-md-8"><?php get_search_form(array('header'=>true)); ?></div>
							<div class="col-md-4">
								<div class="header-middle-r-container">
									<div class="myaccount-links">
										<?php echo wp_kses_post( storez_get_page_links_dropdown() ); ?>
									</div>
									<div class="header-wishlist-container">
										<?php storez_tfwctool_wishlist_link(); ?>
									</div>
									<div class="header-cart-container">
										<?php storez_woocommerce_header_cart(); ?>
									</div>
								</div>
							</div>
						</div>
					</div>
					<?php else: ?>
					<div class="col-md-9 col-sm-12">
						<div class="row">
							<div class="col-md-12"><div class="no-wc-searchform"><?php get_search_form(); ?></div></div>
						</div>
					</div>
					<?php endif; ?>
				</div>
			</div>
		</div>
		<div class="header-bottom">
			<div class="container">
				<nav id="site-navigation" class="main-navigation navbar navbar-expand-md navbar-light row" role="navigation">
					<div class="col catalogue-container">
						<button class="product-catalogue-heading"><i class="fa fa-bars"></i> <span><?php echo esc_html(get_theme_mod('storez_catalogue_menu_text',__('Products Catalogue','storez'))); ?></span></button>
						<?php 
							wp_nav_menu(array(
									'theme_location'    => 'product_catalog',
									'depth'             => 0,
									'container'         => 'div',
									'container_class'   => 'product-catalogue-container',
									'menu_class'        => 'product-catalogue-menu',
									'menu_id'           => 'product-catalogue-menu',
									'walker'            => 'WP_Bootstrap_Navwalker',
									'fallback_cb'       => 'WP_Bootstrap_Navwalker::fallback',
								));
						?>
					</div>
					<button class="navbar-toggler main-navbar-toggle collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#TF-Navbarbs5" aria-controls="TF-Navbarbs5" aria-expanded="false" aria-label="<?php esc_html__( 'Toggle navigation', 'storez' ); ?>">
				      	<span class="button-icon-bar"></span>
				      	<span class="button-icon-bar"></span>
				      	<span class="button-icon-bar"></span>
				      	<span class="button-icon-bar"></span>
				      	<span class="button-icon-bar"></span>
				    </button>
				    <?php
						wp_nav_menu(array(
							'theme_location'    => 'primary',
							'depth'             => 0,
							'container'         => 'div',
							'container_class'   => 'collapse navbar-collapse col-md-10',
							'container_id'      => 'TF-Navbarbs5',
							'menu_class'        => 'navbar-nav primary-menu',
							'menu_id'           => 'primary-menu',
							'fallback_cb'       => 'WP_Bootstrap_Navwalker::fallback',
							'walker'            => 'WP_Bootstrap_Navwalker',
						));
					?>
					<div class="clearfix"></div>
				</nav><!-- #site-navigation -->
				<div class="clearfix"></div>
			</div>
		</div>
	</header><!-- #masthead -->
	<div id="content" class="site-content">
