<?php
/*
* Display Theme menus
*/

$home_interior_decor_sticky = get_theme_mod('home_interior_decor_sticky');
    $home_interior_decor_data_sticky = "false";
    if ($home_interior_decor_sticky) {
    $home_interior_decor_data_sticky = "true";
    }
    global $wp_customize;
?>
<div class="menubar py-2 <?php if( is_user_logged_in() && !isset( $wp_customize ) ){ echo "login-user";} ?>" data-sticky="<?php echo esc_attr($home_interior_decor_data_sticky); ?>">
  	<div class="container right_menu">
  		<div class="row">
  			<!-- Category Button Section -->
            <div class="col-lg-3 col-md-4 align-self-center my-md-0 my-2">
                <?php if (class_exists('WooCommerce')) : ?>
                    <button class="category-btn text-md-start text-center" aria-haspopup="true" aria-expanded="false">
                        <?php echo esc_html(get_theme_mod('home_interior_decor_category_text', __('SHOP CATEGORIES', 'home-interior-decor'))); ?>
                        <i class="fa fa-bars"></i>
                    </button>
                    <div class="category-dropdown">
                        <?php
                        $args = array(
                            'number'     => absint(get_theme_mod('home_interior_decor_product_category_number')),
                            'orderby'    => 'title',
                            'order'      => 'ASC',
                            'hide_empty' => 0,
                            'parent'     => 0,
                        );
                        $home_interior_decor_product_categories = get_terms('product_cat', $args);
                        if (!empty($home_interior_decor_product_categories)) {
                            foreach ($home_interior_decor_product_categories as $product_category) { ?>
                                <li class="drp_dwn_menu">
                                    <a href="<?php echo esc_url(get_term_link($product_category)); ?>">
                                        <?php echo esc_html($product_category->name); ?>
                                    </a>
                                </li>
                            <?php }
                        } ?>
                    </div>
                <?php endif; ?>
            </div>
            <div class="col-lg-5 col-md-2 align-self-center">
		    	<div class="menubox align-self-center">
		      		<div class="innermenubox">
			      			<div class="toggle-nav mobile-menu">
		            			<button onclick="home_interior_decor_menu_open_nav()" class="responsivetoggle"><i class="fas fa-bars"></i><span class="screen-reader-text"><?php esc_html_e('Open Button','home-interior-decor'); ?></span></button>
		          			</div>
	         	 		<div id="mySidenav" class="nav sidenav">
	            			<nav id="site-navigation" class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu', 'home-interior-decor' ); ?>">
				              	<?php 
				                  	wp_nav_menu( array(
					                    'theme_location' => 'primary-menu',
					                    '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="home_interior_decor_menu_close_nav()"><i class="fas fa-times"></i><span class="screen-reader-text"><?php esc_html_e('Close Button','home-interior-decor'); ?></span></a>
		            		</nav>
		          		</div>
	          			<div class="clearfix"></div>
	        		</div>
		    	</div>
		    </div>
		    <div class="col-lg-4 col-md-6 col-12 align-self-center top-right-content text-md-end align-self-center text-center">
		    	<?php if (!empty(get_theme_mod('home_interior_decor_help_center_text')) || !empty(get_theme_mod('home_interior_decor_order_tracking_text')) || get_theme_mod('home_interior_decor_currency_switcher')) : ?>
				    <div class="bottom-right-box">
				        <?php if (!empty(get_theme_mod('home_interior_decor_help_center_link')) || !empty(get_theme_mod('home_interior_decor_help_center_text'))) : ?>
				            <span class="abt-btn pe-md-2">
				                <a class="text-center" href="<?php echo esc_url(get_theme_mod('home_interior_decor_help_center_link', '')); ?>">
				                    <?php if (!empty(get_theme_mod('home_interior_decor_help_center_text'))) : ?>
				                        <i class="fas fa-info-circle me-1" aria-hidden="true"></i>
				                        <?php echo esc_html(get_theme_mod('home_interior_decor_help_center_text', '')); ?>
				                    <?php endif; ?>
				                </a>
				            </span>
				        <?php endif; ?>

				        <?php if (!empty(get_theme_mod('home_interior_decor_order_tracking_link')) || !empty(get_theme_mod('home_interior_decor_order_tracking_text'))) : ?>
				            <span class="track-btn">
				                <a class="text-center" href="<?php echo esc_url(get_theme_mod('home_interior_decor_order_tracking_link', '')); ?>">
				                    <?php if (!empty(get_theme_mod('home_interior_decor_order_tracking_text'))) : ?>
				                        <i class="fas fa-truck me-1" aria-hidden="true"></i>
				                        <?php echo esc_html(get_theme_mod('home_interior_decor_order_tracking_text', '')); ?>
				                    <?php endif; ?>
				                </a>
				            </span>
				        <?php endif; ?>
				        
				        <span class="langauge-box">
				            <span class="currency mb-md-0 mb-2">
				                <?php if (get_theme_mod('home_interior_decor_currency_switcher', true) && class_exists('WooCommerce')) : ?>
				                    <span class="text-center currency-box d-md-inline-block">
				                        <?php echo wp_kses_post(do_shortcode('[woocommerce_currency_switcher_drop_down_box]')); ?>
				                    </span>
				                <?php endif; ?>
				            </span>
				        </span>
				    </div>
				<?php endif; ?>
            </div>
  	</div>
</div>