<?php
/**
 * Template Name: Home Template
 */

get_header(); ?>

<main id="skip-content">
  <?php if (get_theme_mod('spa_sauna_slider_section_setting', true) != '') { ?>
  <section id="top-slider">
    <?php $spa_sauna_slide_pages = array();
      for ( $spa_sauna_count = 1; $spa_sauna_count <= 3; $spa_sauna_count++ ) {
        $spa_sauna_mod = intval( get_theme_mod( 'spa_sauna_top_slider_page' . $spa_sauna_count ));
        if ( 'page-none-selected' != $spa_sauna_mod ) {
          $spa_sauna_slide_pages[] = $spa_sauna_mod;
        }
      }
      if( !empty($spa_sauna_slide_pages) ) :
        $spa_sauna_args = array(
          'post_type' => 'page',
          'post__in' => $spa_sauna_slide_pages,
          'orderby' => 'post__in'
        );
        $spa_sauna_query = new WP_Query( $spa_sauna_args );
        if ( $spa_sauna_query->have_posts() ) :
          $i = 1;
    ?>
    <div class="owl-carousel" role="listbox">
      <?php  while ( $spa_sauna_query->have_posts() ) : $spa_sauna_query->the_post(); ?>
      <div class="slide-box">
        <div class="row m-0">
          <div class="col-lg-5 col-md-6 slider-left p-0" style="background: url(<?php echo esc_url(get_template_directory_uri()); ?>/assets/img/slider-left.png);">
            <div class="slider-inner-box">
              <?php if(get_theme_mod('spa_sauna_slider_short_heading') != ''){ ?>
              <h5 class="main-heading mb-4">
                <?php echo esc_html(get_theme_mod('spa_sauna_slider_short_heading')); ?></h5>
              <?php }?>
              <h3 class="m-0"><?php the_title(); ?></h3>
              <p class="content mt-3"><?php echo esc_html( wp_trim_words( get_the_content(),70 )); ?><p>
                  <div class="slide-btn mt-4">
                    <a href="<?php the_permalink(); ?>"><?php esc_html_e('Shop Now','spa-sauna'); ?></a>
                  </div>
            </div>
          </div>
          <div class="col-lg-7 col-md-6 p-0 right-image">
            <div class="slider-image">
              <?php if(has_post_thumbnail()){
                  the_post_thumbnail();
                  } else{?>
              <img src="<?php echo esc_url(get_template_directory_uri()); ?>/assets/img/slider.png" alt="" />
              <?php } ?>
              <div class="social-link text-end">
                <?php if(get_theme_mod('spa_sauna_facebook_url') != ''){ ?>
                    <a href="<?php echo esc_url(get_theme_mod('spa_sauna_facebook_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('spa_sauna_facebook_icon') ); ?>"></i></a>
                <?php }?>
                <?php if(get_theme_mod('spa_sauna_twitter_url') != ''){ ?>
                    <a href="<?php echo esc_url(get_theme_mod('spa_sauna_twitter_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('spa_sauna_twitter_icon') ); ?>"></i></a>
                <?php }?>
                  <?php if(get_theme_mod('spa_sauna_intagram_url') != ''){ ?>
                      <a href="<?php echo esc_url(get_theme_mod('spa_sauna_intagram_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('spa_sauna_intagram_icon') ); ?>"></i></a>
                  <?php }?>
                  <?php if(get_theme_mod('spa_sauna_linkedin_url') != ''){ ?>
                      <a href="<?php echo esc_url(get_theme_mod('spa_sauna_linkedin_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('spa_sauna_linkedin_icon') ); ?>"></i></a>
                  <?php }?>
                  <?php if(get_theme_mod('spa_sauna_pintrest_url') != ''){ ?>
                      <a href="<?php echo esc_url(get_theme_mod('spa_sauna_pintrest_url','')); ?>"><i class="<?php echo esc_attr( get_theme_mod('spa_sauna_pintrest_icon') ); ?>"></i></a>
                  <?php }?>
              </div>
            </div>
          </div>
        </div>
      </div>
      <?php $i++; endwhile;
      wp_reset_postdata();?>
    </div>
    <?php else : ?>
    <div class="no-postfound"></div>
    <?php endif;
    endif;?>
  </section>
  <?php }?>

  <?php if (get_theme_mod('spa_sauna_activities_section_setting', true) != '') { ?>
  <section class="featured py-5">
    <div class="container">
      <?php if(get_theme_mod('spa_sauna_services_short_heading') != ''){ ?>
      <p class="short-heading"><?php echo esc_html(get_theme_mod('spa_sauna_services_short_heading')); ?></p>
      <?php }?>
      <?php if(get_theme_mod('spa_sauna_services_heading') != ''){ ?>
      <h3 class="main-heading mb-4"><?php echo esc_html(get_theme_mod('spa_sauna_services_heading')); ?></h3>
      <?php }?>
      <div class="row">
        <div class="col-lg-4 align-self-center">
          <?php for ($i=1; $i <=3 ; $i++) { ?>
            <div class="row mb-4 pb-2">
              <div class="col-lg-2 col-md-2 col-sm-2 col-3 price-icon align-self-center">
                <?php if(get_theme_mod('spa_sauna_pricing_section_icon_left'.$i) != ''){ ?>
                  <i class="<?php echo esc_attr(get_theme_mod('spa_sauna_pricing_section_icon_left'.$i)); ?>"></i>
                <?php }?>
              </div>
              <div class="col-lg-7 col-md-7 col-sm-7 col-6 align-self-center">
                <?php if(get_theme_mod('spa_sauna_pricing_heading_left'.$i) != ''){ ?>
                  <h3 class="price-heading"><?php echo esc_html(get_theme_mod('spa_sauna_pricing_heading_left'.$i)); ?></h3>
                <?php }?>
                <?php if(get_theme_mod('spa_sauna_pricing_text_left'.$i) != ''){ ?>
                  <p class="price-text"><?php echo esc_html(get_theme_mod('spa_sauna_pricing_text_left'.$i)); ?></p>
                <?php }?>
              </div>
              <div class="col-lg-3 col-md-3 col-sm-3 col-3 align-self-center text-end">
                <?php if(get_theme_mod('spa_sauna_pricing_price_left'.$i) != ''){ ?>
                  <p class="pricing-price"><?php echo esc_html(get_theme_mod('spa_sauna_pricing_price_left'.$i)); ?></p>
                <?php }?>
              </div>
            </div>
          <?php } ?>
        </div>
        <div class="col-lg-4 center-image align-self-center">
          <?php if(get_theme_mod('spa_sauna_pricing_center_image') != ''){ ?>
            <img src="<?php echo esc_url(get_theme_mod('spa_sauna_pricing_center_image')); ?>">
          <?php }?>
        </div>
        <div class="col-lg-4 align-self-center">
          <?php for ($i=1; $i <=3 ; $i++) { ?>
            <div class="row mb-4 pb-2">
              <div class="col-lg-2 col-md-2 col-sm-2 col-3 price-icon align-self-center">
                <?php if(get_theme_mod('spa_sauna_pricing_section_icon_right'.$i) != ''){ ?>
                  <i class="<?php echo esc_attr(get_theme_mod('spa_sauna_pricing_section_icon_right'.$i)); ?>"></i>
                <?php }?>
              </div>
              <div class="col-lg-7 col-md-7 col-sm-7 col-6 align-self-center">
                <?php if(get_theme_mod('spa_sauna_pricing_heading_right'.$i) != ''){ ?>
                  <h3 class="price-heading"><?php echo esc_html(get_theme_mod('spa_sauna_pricing_heading_right'.$i)); ?></h3>
                <?php }?>
                <?php if(get_theme_mod('spa_sauna_pricing_text_right'.$i) != ''){ ?>
                  <p class="price-text"><?php echo esc_html(get_theme_mod('spa_sauna_pricing_text_right'.$i)); ?></p>
                <?php }?>
              </div>
              <div class="col-lg-3 col-md-3 col-sm-3 col-3 align-self-center text-end">
                <?php if(get_theme_mod('spa_sauna_pricing_price_right'.$i) != ''){ ?>
                  <p class="pricing-price"><?php echo esc_html(get_theme_mod('spa_sauna_pricing_price_right'.$i)); ?></p>
                <?php }?>
              </div>
            </div>
          <?php } ?>
        </div>
      </div>
    </div>
  </section>
  <?php }?>
  <section id="page-content">
    <div class="container">
      <div class="py-5">
        <?php
          if ( have_posts() ) :
            while ( have_posts() ) : the_post();
              the_content();
            endwhile;
          endif;
        ?>
      </div>
    </div>
  </section>
</main>

<?php get_footer(); ?>