<?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 Sparta
 */

$sparta_header_default_logo = get_theme_mod('sparta_header_default_logo', '');
$sparta_header_trans_logo = get_theme_mod('sparta_header_trans_logo', '');
$general_info_address = get_theme_mod('general_info_address', '');
$general_info_phone = get_theme_mod('general_info_phone', '');
$header_menu_left = get_theme_mod('sparta_header_menu_left_center1', '');
$header_menu_right = get_theme_mod('sparta_header_menu_right_center1', '');
$sparta_header_center1_logo = get_theme_mod('sparta_header_center1_logo', '');

$hclass = array();
if (is_page()) :
    global $post;
    $meta_page_header_trans = get_post_meta($post->ID, 'univer_page_header_trans', true);

    if ($meta_page_header_trans !== '' && $meta_page_header_trans === 'yes') :
        $hclass[] = ' vk-header-transparent';
    endif;

endif;

/*Render page loader*/
echo wp_kses_post(Sparta_Helper::sparta_page_loader());
?>
<header class="vk-header header-center1 <?php if (!empty($hclass)) : echo esc_attr(implode(' ', $hclass)); endif; ?>">
    <div class="vk-top-header">
        <div class="container">
            <div class="row">
                <div class="col-lg-8 col-md-8 col-sm-8 col-12 vk-top-header-left">
                    <?php
                    if ($general_info_address !== ''):
                        echo '<span>' . esc_attr($general_info_address) . '</span>';
                    endif;
                    ?>
                </div>
                <div class="col-lg-4 col-md-4 col-sm-4 col-12 vk-top-header-right">
                    <?php if (class_exists('HotelBookingPlugin')): ?>
                        <ul>
                            <li>
                                <a href="<?php echo esc_url(sparta_get_link_page_booking()); ?>" class="btn book-now">
                                    <?php echo esc_html__('BOOK NOW', 'sparta'); ?>
                                </a>
                            </li>
                        </ul>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
    <?php if (is_page('homepage') || is_front_page() || is_home()) : ?>
        <h1 class="homepage-title"><?php the_title(); ?></h1>
    <?php endif; ?>
    <div id="sticky-wrapper" class="sticky-wrapper">
        <div class="vk-main-menu animated uni-sticky">
            <div class="container">
                <div class="row">
                    <div class="col-lg-5 d-lg-block d-none hidden-sm hidden-xs h-center1-left">
                        <?php
                        if (isset($header_menu_left) && $header_menu_left !== '0' && $header_menu_left !== '') :
                            echo '<nav class="vk-navbar navbar">';
                            wp_nav_menu(
                                array(
                                    'container_class' => 'collapse navbar-collapse vk-navbar-collapse',
                                    'container_id' => '',
                                    'menu_class' => 'nav navbar-nav vk-nav vk-navbar-nav',
                                    'menu' => $header_menu_left,
                                )
                            );
                            echo '</nav>';
                        endif;
                        ?>
                    </div>
                    <div class="col-lg-2 col-md-3 col-sm-3 col-5 h-center1-logo">
                        <div class="hcecter-wra-logo">
                            <a href="<?php echo esc_url(home_url('/')); ?>" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?>">
                                <?php
                                if ($sparta_header_center1_logo):
                                    echo '<img src="' . esc_url($sparta_header_center1_logo) . '" alt="' . esc_attr(get_bloginfo('description')) . '">';
                                else:
                                    echo '<img src="' . get_template_directory_uri() . '/assets/images/logo-white.png" alt="' . esc_attr(get_bloginfo('description')) . '" class="logo-df">';
                                endif;
                                ?>
                            </a>
                        </div>
                    </div>
                    <div class="col-lg-5 d-lg-block d-none h-center1-right">
                        <?php
                        if (isset($header_menu_right) && $header_menu_right !== '0' && $header_menu_right !== '') :
                            echo '<nav class="vk-navbar navbar">';
                            wp_nav_menu(
                                array(
                                    'container_class' => 'collapse navbar-collapse vk-navbar-collapse',
                                    'container_id' => '',
                                    'menu_class' => 'nav navbar-nav vk-nav vk-navbar-nav',
                                    'menu' => $header_menu_right,
                                )
                            );
                            echo '</nav>';

                        endif;
                        ?>
                        <div data-toggle="collapse" data-target="#collapseSearch" aria-expanded="false" aria-controls="collapseSearch" class="h-search" role="button">
                            <i class="vk-icon ti-search"></i>
                        </div>
                    </div>
                    <div class="vk-bar-search vk-box collapse" id="collapseSearch">
                        <form role="search" method="get" action="<?php echo esc_url(home_url('/')); ?>">
                            <div class="search-form">
                                <input type="search" class="form-control" placeholder="<?php echo esc_attr_x('Search &hellip;', 'placeholder', 'sparta'); ?>" value="<?php echo get_search_query(); ?>" name="s"/>
                                <button type="submit" class="vk-btn-search vk-btn"><i class="fa fa-search"></i></button>
                            </div>
                        </form>
                    </div>
                    <div class="d-lg-none m-icon-menu col-md-9 col-sm-9 col-7">
                        <i class="vk-icon ti-menu"></i>
                        <i class="vk-icon ti-close"></i>
                    </div>
                    <div class="m-mobile d-lg-none col-sm-12 col-12">
                        <?php
                        if (isset($header_menu_left) && $header_menu_left !== '0' && $header_menu_left !== ''
                            && isset($header_menu_right) && $header_menu_right !== '0' && $header_menu_right !== '') :
                            wp_nav_menu(
                                array(
                                    'container_class' => '',
                                    'container_id' => '',
                                    'menu_class' => 'nav navbar-nav vk-nav vk-navbar-nav',
                                    'menu' => $header_menu_left,
                                )
                            );
                            wp_nav_menu(
                                array(
                                    'container_class' => '',
                                    'container_id' => '',
                                    'menu_class' => 'nav navbar-nav vk-nav vk-navbar-nav',
                                    'menu' => $header_menu_right,
                                )
                            );
                        endif;
                        ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>

