<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div class="container">
 *
 * @package Mediquip Plus
 */
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<?php if ( function_exists( 'wp_body_open' ) ) {
  wp_body_open();
} else {
  do_action( 'wp_body_open' );
} ?>

<?php if ( get_theme_mod('mediquip_plus_preloader',false) != "") { ?>
<div id="preloader">
  <div id="status">&nbsp;</div>
</div>
<?php }?>

<a class="screen-reader-text skip-link" href="#content"><?php esc_html_e( 'Skip to content', 'mediquip-plus' ); ?></a>

<div id="pageholder" <?php if( get_theme_mod( 'mediquip_plus_box_layout',false ) != "") { echo 'class="boxlayout"'; } ?>>

<div class="header-info">
  <div class="container-fluid">
    <div class="row m-0">
      <div class="col-lg-5 col-md-5 align-self-center">
        <div class="logo">
          <?php mediquip_plus_the_custom_logo(); ?>
          <div class="site-branding-text">
            <?php if ( get_theme_mod('mediquip_plus_title_enable',false) != "") { ?>
              <?php if ( is_front_page() && is_home() ) : ?>
                <h1 class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a></h1>
              <?php else : ?>
                <p class="site-title"><a href="<?php echo esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a></p>
                <?php endif; ?>
              <?php } ?>
            <?php $description = get_bloginfo( 'description', 'display' );
            if ( $description || is_customize_preview() ) : ?>
              <?php if ( get_theme_mod('mediquip_plus_tagline_enable',true) != "") { ?>
                <span class="site-description"><?php echo esc_html( $description ); ?></span>
              <?php } ?>
            <?php endif; ?> 
          </div>
        </div>
      </div>
      <div class="col-lg-3 col-md-3 border-right align-self-center">
        <?php if ( get_theme_mod('mediquip_plus_location_text') != ""|| get_theme_mod('mediquip_plus_location') != "") { ?> 
          <div class="row mb-2 mb-md-0 mb-lg-0">
            <div class="col-lg-2 col-md-3">
              <i class="fas fa-map-marker-alt"></i>
            </div>
            <div class="col-lg-10 col-md-9">
              <p class="mb-2"><?php echo esc_html(get_theme_mod ('mediquip_plus_location_text','')); ?></p>
              <h6><?php echo esc_html(get_theme_mod ('mediquip_plus_location','')); ?></h6>
            </div>
          </div>
        <?php }?>
      </div>
      <div class="col-lg-3 col-md-3 border-right align-self-center time">
        <?php if ( get_theme_mod('mediquip_plus_time_text') != ""|| get_theme_mod('mediquip_plus_time') != "") { ?> 
          <div class="row">
            <div class="col-lg-2 col-md-3">
              <i class="far fa-clock"></i>
            </div>
            <div class="col-lg-10 col-md-9">
              <p class="mb-2"><?php echo esc_html(get_theme_mod ('mediquip_plus_time_text','')); ?></p>
              <h6><?php echo esc_html(get_theme_mod ('mediquip_plus_time','')); ?></h6>
            </div>
          </div>
        <?php }?>
      </div>
      <div class="col-lg-1 col-md-1 align-self-center">
        <div class="search-box text-center me-3">
          <?php if(get_theme_mod('mediquip_plus_search_option',false) != ''){ ?>
            <button type="button" class="search-open"><i class="fas fa-search"></i></button>
          <?php }?>
        </div>
      </div>
        <div class="search-outer">
          <div class="serach_inner w-100 h-100">
            <?php get_search_form(); ?>
          </div>
          <button type="button" class="search-close"><span>X</span></button>
        </div>
    </div>
  </div>
</div>

<div class="header <?php echo esc_attr(mediquip_plus_sticky_menu()); ?>">
  <div class="container-fuid">
    <div class="row m-0">
      <div class="col-lg-9 col-md-7 col-12 align-self-center">
        <div class="toggle-nav">
          <button role="tab"><?php esc_html_e('MENU','mediquip-plus'); ?></button>
        </div>
        <div id="mySidenav" class="nav sidenav">
          <nav id="site-navigation" class="main-nav" role="navigation" aria-label="<?php esc_attr_e( 'Top Menu','mediquip-plus' ); ?>">
            <?php 
              wp_nav_menu( array( 
                'theme_location' => 'primary',
                '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="close-button"><?php esc_html_e('CLOSE','mediquip-plus'); ?></a>
          </nav>
        </div>
      </div>
      <?php if ( get_theme_mod('mediquip_plus_phone_number_text') != "" && get_theme_mod('mediquip_plus_phone_number') != "") { ?> 
        <div class="col-lg-3 col-md-5 col-12 align-self-center phn-box">
          <a class="phn" href="tel:<?php echo esc_url( get_theme_mod('mediquip_plus_phone_number_text','' )); ?>"><i class="fas fa-phone me-2"></i><?php echo esc_html(get_theme_mod ('mediquip_plus_phone_number_text','')); ?> : <?php echo esc_html(get_theme_mod ('mediquip_plus_phone_number','')); ?></a>
        </div>
      <?php } ?>
    </div>
  </div>
</div>