<?php global $dicom_opt;
/**
 * @package Dicom
*/

if( function_exists('acf_add_options_page') ) {
	$hide_banner  = get_field( 'enable_page_banner' );
} else {
	$hide_banner  = false;
}

if ( isset( $dicom_opt['blog_title'] ) ) {
    $hide_blog_banner      = $dicom_opt['hide_blog_banner'];
    $hide_service_banner   = $dicom_opt['hide_service_banner'];
} else {
    $hide_blog_banner      = false;
    $hide_service_banner   = false;
}

// After Hiding Banner add spacing
if( $hide_banner == true || $hide_blog_banner == true  || $hide_service_banner == true ) {
    $nav_class = 'nav-color';
} else {
    $nav_class = '';
}

if ( class_exists('ACF') && get_field('choose_full_container') == 1 ) {
    $container_class = 'container';
} else {
    $container_class = 'container-fluid'; 
}

// WP admin bar
$hide_wp_nav = 'hide-wp-nav';

if ( !is_404() ) : ?>
    <div class="navbar-area <?php if( !is_front_page() ){ echo esc_attr( $nav_class ); } ?> <?php if ( is_user_logged_in() ) { echo esc_attr( $hide_wp_nav ); } ?>">
        <div class="dibiz-responsive-nav">
            <div class="container-fluid">
                <div class="dibiz-responsive-menu">
                    <div class="logo">
                        <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
                            <?php dicom_mobile_logo(); ?>
                        </a>
                    </div>
                </div>
            </div>
        </div>

        <div class="dibiz-nav">
            <div class="<?php echo esc_attr( $container_class ); ?>">
                <nav class="navbar navbar-expand-md navbar-light">
                    <a class="navbar-brand" href="<?php echo esc_url( home_url( '/' ) ); ?>">
                        <?php dicom_black_logo(); ?>
                    </a>

                    <div class="collapse navbar-collapse mean-menu">

                        <?php $primary_nav_arg = [
                            'menu'            => 'primary',
                            'theme_location'  => 'primary',
                            'container'       => null,
                            'menu_class'      => 'navbar-nav',
                            'depth'           => 3,
                            'walker'          => new Dicom_Bootstrap_Navwalker(),
                            'fallback_cb'     => 'Dicom_Bootstrap_Navwalker::fallback',
                        ];
                
                        if ( has_nav_menu('primary') ) :
                            wp_nav_menu( $primary_nav_arg );
                        endif; ?>

                        <?php if( ( isset( $dicom_opt['enable_search'] ) && $dicom_opt['enable_search'] == true ) || ( isset( $dicom_opt['enable_burger_menu'] ) && $dicom_opt['enable_burger_menu'] == true ) || (isset( $dicom_opt['enable_cart_btn'] ) && $dicom_opt['enable_cart_btn'] == true)  ) : ?>
                            <div class="others-option d-flex align-items-center">
                                <?php if( isset( $dicom_opt['enable_cart_btn'] ) && $dicom_opt['enable_cart_btn'] == true ) {
                                    if ( class_exists( 'WooCommerce' ) ) { ?>

                                        <div class="option-item">
                                            <div class="cart-btn">
                                                <a href="<?php echo esc_url(wc_get_cart_url()) ?>">
                                                    <i class="flaticon-shopping-cart"></i>
                                                    <span class="mini-cart-count"></span>
                                                </a>
                                            </div>
                                        </div>
                                        <?php 
                                    }
                                } ?>
                                <?php if( isset( $dicom_opt['enable_search'] ) && $dicom_opt['enable_search'] == true  ) : ?>
                                    <div class="option-item">
                                        <div class="search-box">
                                            <i class="flaticon-search"></i>
                                        </div>
                                    </div>
                                <?php endif; ?>

                                <?php if( isset( $dicom_opt['enable_burger_menu'] ) && $dicom_opt['enable_burger_menu'] == true  ): ?>
                                    <div class="option-item">
                                        <div class="side-menu-btn">
                                           <i class="flaticon-menu" data-bs-toggle="modal" data-bs-target="#sidebarModals"></i>
                                        </div>
                                    </div>
                                <?php endif; ?>
                            </div>
                        <?php endif; ?>

                    </div>
                </nav>
            </div>
        </div>

        <?php if( ( isset( $dicom_opt['enable_search'] ) && $dicom_opt['enable_search'] == true ) || ( isset( $dicom_opt['enable_burger_menu'] ) && $dicom_opt['enable_burger_menu'] == true ) || (isset( $dicom_opt['enable_cart_btn'] ) && $dicom_opt['enable_cart_btn'] == true) ): ?>
            <div class="others-option-for-responsive">
                <div class="container">
                    <div class="dot-menu">
                        <div class="inner">
                            <div class="circle circle-one"></div>
                            <div class="circle circle-two"></div>
                            <div class="circle circle-three"></div>
                        </div>
                    </div>
                    
                    <div class="container">
                        <div class="option-inner">
                            <div class="others-option justify-content-center d-flex align-items-center">
                                <?php if( isset( $dicom_opt['enable_cart_btn'] ) && $dicom_opt['enable_cart_btn'] == true ) {
                                    if ( class_exists( 'WooCommerce' ) ) { ?>

                                        <div class="option-item">
                                            <div class="cart-btn">
                                                <a href="<?php echo esc_url(wc_get_cart_url()) ?>">
                                                    <i class="flaticon-shopping-cart"></i>
                                                    <span class="mini-cart-count"></span>
                                                </a>
                                            </div>
                                        </div>
                                        <?php 
                                    }
                                } ?>
                                <?php if( isset( $dicom_opt['enable_search'] ) && $dicom_opt['enable_search'] == true  ): ?>
                                    <div class="option-item">
                                        <div class="search-box">
                                            <i class="flaticon-search"></i>
                                        </div>
                                    </div>
                                <?php endif; ?>

                                <?php if( isset( $dicom_opt['enable_burger_menu'] ) && $dicom_opt['enable_burger_menu'] == true ): ?>
                                    <div class="option-item">
                                        <div class="side-menu-btn">
                                           <i class="flaticon-menu" data-bs-toggle="modal" data-bs-target="#sidebarModals"></i>
                                        </div>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </div>
<?php endif; ?>