<?php
$section_hide = get_theme_mod( 'vw_book_store_pro_slider_enabledisable' );
if ( 'Disable' == $section_hide ) {
  return;
}

$number = get_theme_mod('vw_book_store_pro_slide_number');
$slide_delay = get_theme_mod('vw_book_store_pro_slide_delay');
  if($number != ''){
?>
  <section id="slider">
      <div id="carouselExampleIndicators" class="carousel slide <?php if ( get_theme_mod('vw_book_store_pro_slide_remove_fade',true) == 1 ) { ?> carousel-fade <?php } ?>" data-bs-ride="carousel" data-bs-interval="<?php echo esc_attr($slide_delay); ?>">
        <div class="carousel-inner" role="listbox">
          <?php for ($i=1,$j=1; $i<=$number; $i++,$j++) { 
            if($j>3){ $j=1; } ?>
            <?php if(get_theme_mod('vw_book_store_pro_slide_image'.$i) != ''){ ?>
              <div <?php if($i == 1){echo 'class="carousel-item active"';} else{ echo 'class="carousel-item"';}?>>
                <?php if ( get_theme_mod('vw_book_store_pro_slide_image',true) != "" ) {?>
                  <img  src="<?php echo esc_url(get_theme_mod('vw_book_store_pro_slide_image'.$i)); ?>" alt="<?php echo esc_attr(get_theme_mod('vw_book_store_pro_slide_title'.$i, true)); ?>" title="#slidecaption<?php echo esc_html($i); ?>">
                <?php } ?>
                <div class="carousel-caption d-none d-md-block">
                  <div class="inner_carousel">
                    <div class="container">
                      <div class="slider-box">
                        <?php if(get_theme_mod('vw_book_store_pro_slide_sub_heading'.$i) != ''){ ?>
                          <h4 class="animated fadeInDown delay-2s"><?php echo esc_html(get_theme_mod('vw_book_store_pro_slide_sub_heading'.$i)); ?></h4>
                        <?php } ?>
                        <?php if(get_theme_mod('vw_book_store_pro_slide_heading'.$i) != ''){ ?>
                        <h2 class="animated lightSpeedIn delay-1s pb-0"><?php echo esc_html(get_theme_mod('vw_book_store_pro_slide_heading'.$i)); ?></h2>
                        <?php } ?>
                         <?php if(get_theme_mod('vw_book_store_pro_slide_text'.$i) != ''){ ?>                
                        <div class="slide_desc animated lightSpeedIn delay-1s"><?php echo get_theme_mod('vw_book_store_pro_slide_text'.$i); ?></div>
                        <?php } ?>
                        <?php if( get_theme_mod('vw_book_store_pro_slide_btntext'.$i, true) != ''){ ?>
                          <a class="read-more font-weight-bold btn btn-primary theme_button slide_desc animated fadeInUp delay-1s" href="<?php echo esc_html(get_theme_mod('vw_book_store_pro_slide_btnurl'.$i)); ?>"><?php echo esc_html(get_theme_mod('vw_book_store_pro_slide_btntext'.$i)); ?></a>
                        <?php } ?>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            <?php } ?>
          <?php } ?>
        </div>
        <?php if( get_theme_mod('vw_book_store_pro_slider_arrows', true) != ''){ ?>
        <div class="">
          <a class="carousel-control-prev" data-bs-target="#carouselExampleIndicators" role="button" data-bs-slide="prev">
            <span class="carousel-control-prev-icon" aria-hidden="true"><i class="fas fa-chevron-left"></i></span>
            <span class="sr-only"><?php esc_html_e('Previous','vw-book-store-pro'); ?></span>
          </a>
          <a class="carousel-control-next" data-bs-target="#carouselExampleIndicators" role="button" data-bs-slide="next">
            <span class="carousel-control-next-icon" aria-hidden="true"><i class="fas fa-chevron-right"></i></span>
            <span class="sr-only"><?php esc_html_e('Next','vw-book-store-pro'); ?></span>
          </a>
        </div>
        <?php }?>

        <?php if( get_theme_mod('vw_book_store_pro_slider_dots', true) != ''){ ?>
          <ol class="carousel-indicators">
            <?php for($i=1;$i<=$number;$i++){ ?>
              <li data-bs-target="#carouselExampleIndicators" data-bs-slide-to="<?php echo($i-1); ?>" class="<?php if($i==1){echo 'active';} ?>"></li>
            <?php } ?>
          </ol>
        <?php } ?>
      </div> 
      <div class="clearfix"></div>
  </section>
<?php 
  }
?>