<?php
/**
 * Header Layout
 * @package Omega Food Delivery
 */

$omega_food_delivery_default = omega_food_delivery_get_default_theme_options();


$omega_food_delivery_header_layout_wishlist_url = esc_url( get_theme_mod( 'omega_food_delivery_header_layout_wishlist_url',
$omega_food_delivery_default['omega_food_delivery_header_layout_wishlist_url'] ) );

$omega_food_delivery_header_search = esc_html( get_theme_mod( 'omega_food_delivery_header_search',
$omega_food_delivery_default['omega_food_delivery_header_search'] ) );

$omega_food_delivery_header_layout_button_text = esc_html( get_theme_mod( 'omega_food_delivery_header_layout_button_text',
$omega_food_delivery_default['omega_food_delivery_header_layout_button_text'] ) );

$omega_food_delivery_header_layout_button_link = esc_url( get_theme_mod( 'omega_food_delivery_header_layout_button_link',
$omega_food_delivery_default['omega_food_delivery_header_layout_button_link'] ) );

$omega_food_delivery_sticky = get_theme_mod('omega_food_delivery_sticky');
$omega_food_delivery_data_sticky = "false";
if ($omega_food_delivery_sticky) {
$omega_food_delivery_data_sticky = "true";
}
global $wp_customize;

?>
<div class="main-header">
    <section id="center-header" class="header-navbar <?php if( is_user_logged_in() && !isset( $wp_customize ) ){ echo "login-user";} ?>" data-sticky="<?php echo esc_attr($omega_food_delivery_data_sticky); ?>">
        <div class="wrapper header-wrapper header-box">
            <div class="header-titles">
                <?php
                    omega_food_delivery_site_logo();
                    omega_food_delivery_site_description();
                ?>
            </div>
            <div class="theme-header-areas header-areas-right menu-box">
                <div class="site-navigation">
                    <nav class="primary-menu-wrapper" aria-label="<?php esc_attr_e('Horizontal', 'omega-food-delivery'); ?>" role="navigation">
                        <ul class="primary-menu theme-menu">
                            <?php
                            if (has_nav_menu('omega-food-delivery-primary-menu')) {
                                wp_nav_menu(
                                    array(
                                        'container' => '',
                                        'items_wrap' => '%3$s',
                                        'theme_location' => 'omega-food-delivery-primary-menu',
                                    )
                                );
                            } else {
                                wp_list_pages(
                                    array(
                                        'match_menu_classes' => true,
                                        'show_sub_menu_icons' => true,
                                        'title_li' => false,
                                        'walker' => new Omega_Food_Delivery_Walker_Page(),
                                    )
                                );
                            } ?>
                        </ul>
                    </nav>
                </div>
                <div class="navbar-controls twp-hide-js">
                    <button type="button" class="navbar-control navbar-control-offcanvas">
                        <span class="navbar-control-trigger" tabindex="-1">
                            <?php omega_food_delivery_the_theme_svg('menu'); ?>
                        </span>
                    </button>
                </div>
            </div>
            <div class="theme-header-areas header-areas-right header-meta">
                <?php if( $omega_food_delivery_header_search ){ ?>
                    <a class="header-search" href="#search">
                        <svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512">
                            <path d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6 .1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"/>
                        </svg>
                    </a>

                    <!-- Search Form -->
                    <div id="search" role="dialog" aria-modal="true">
                        <button class="close" aria-label="Close Search">X</button>
                        <?php get_search_form(); ?>
                    </div>
                <?php } ?>
                <?php if( $omega_food_delivery_header_layout_button_text || $omega_food_delivery_header_layout_button_link ){ ?>
                    <a href="<?php echo esc_url( $omega_food_delivery_header_layout_button_link ); ?>" class="btn-fancy btn-fancy-primary header-button"><?php echo esc_html( $omega_food_delivery_header_layout_button_text ); ?></a>
                <?php } ?>
            </div>
        </div>
    </section>
</div>