<?php
/**
 * Template part for displaying slider section
 *
 * @package Optical Glasses
 * @subpackage optical_glasses
 */

$optical_glasses_slider_arrows = get_theme_mod('optical_glasses_slider_arrows', true);
?>

<?php if ($optical_glasses_slider_arrows) : ?>
  <section id="slider">
    <div class="container-fluid">
      <div class="item">
        <div class="row m-0">
          <div class="col-lg-6 col-md-7 col-12 slider-content-col">
            <div class="carousel-caption">
              <div class="inner_carousel">
                <div class="slider-main-title">
                  <?php if (get_theme_mod('optical_glasses_show_slider_title')) : ?>
                  <h1 class="slider-heading mb-2 text-capitalize"><?php echo esc_html(get_theme_mod('optical_glasses_show_slider_title')); ?></h1>
                <?php endif; ?>
                </div>
                <?php if (get_theme_mod('optical_glasses_show_slider_content')) : ?>
                  <p class="slide-content"><?php echo esc_html(get_theme_mod('optical_glasses_show_slider_content')); ?></p>
                <?php endif; ?>
                <div class="more-btn mt-md-4 mt-2">
                  <?php
                  $optical_glasses_btn1_text = get_theme_mod('optical_glasses_product_btn_text1', 'Explore shop');
                  $optical_glasses_btn1_link = get_theme_mod('optical_glasses_product_btn_link1');

                  $optical_glasses_btn2_text = get_theme_mod('optical_glasses_product_btn_text2', 'Use Your Benefits');
                  $optical_glasses_btn2_link = get_theme_mod('optical_glasses_product_btn_link2');
                  ?>

                  <?php if ( ! empty($optical_glasses_btn1_text) && ! empty($optical_glasses_btn1_link) ) : ?>
                    <a class="text-capitalize me-4 mb-md-0 mb-3 slider-btn1" href="<?php echo esc_url($optical_glasses_btn1_link); ?>">
                      
                        <?php echo esc_html($optical_glasses_btn1_text); ?>
                      
                      <span class="screen-reader-text"><?php echo esc_html($optical_glasses_btn1_text); ?></span>
                    </a>
                  <?php endif; ?>

                  <?php if ( ! empty($optical_glasses_btn2_text) && ! empty($optical_glasses_btn2_link) ) : ?>
                    <a class="text-capitalize mb-md-0 mb-3 slider-btn2" href="<?php echo esc_url($optical_glasses_btn2_link); ?>">
                      <?php echo esc_html($optical_glasses_btn2_text); ?>
                      <span class="screen-reader-text"><?php echo esc_html($optical_glasses_btn2_text); ?></span>
                    </a>
                  <?php endif; ?>
                </div>
                <!-- user rating -->
                <div class="rating-col my-3">
                  <div class="row rating-box">
                    <div class="col-xl-2 col-lg-3 col-md-4 col-4 align-self-center px-0 position-relative">
                      <div class="customer-img-wrap">
                        <?php for ( $i = 1; $i <= 2; $i++ ) :
                            $optical_glasses_customer_image = get_theme_mod( 'optical_glasses_customer_image_' . $i );

                            if ( $optical_glasses_customer_image ) : ?>
                                <div class="customer-img customer-img-<?php echo esc_attr( $i ); ?>">
                                    <img src="<?php echo esc_url( $optical_glasses_customer_image ); ?>" alt="">
                                </div>
                            <?php endif;
                        endfor; ?>
                      </div>
                    </div>
                    <div class="col-xl-10 col-lg-9 col-md-8 col-8 align-self-center ps-1">
                      <div class="customzer-rating">
                        <span class="rate-no"><?php echo esc_html(get_theme_mod('optical_glasses_customer_review', '')); ?></span>
                        <?php
                        $optical_glasses_customer_review_text = get_theme_mod(
                            'optical_glasses_customer_review_text',
                            'Satisfied Customer'
                        );

                        if ( ! empty( $optical_glasses_customer_review_text ) ) : ?>
                            <div class="customer-review">
                                <?php echo esc_html( $optical_glasses_customer_review_text ); ?>
                            </div>
                        <?php endif; ?>
                      </div>
                    </div>
                  </div>
                </div>
                <?php
                $optical_glasses_rating_no = get_theme_mod('optical_glasses_review_rating', '15,008');
                $optical_glasses_brand_name   = get_theme_mod('optical_glasses_review_brand', 'TrustSphere');
                $optical_glasses_review_count = get_theme_mod('optical_glasses_rating_count');
                $optical_glasses_rating_text  = get_theme_mod('optical_glasses_review_text', 'Excellent');
                ?>
                <div class="trustpilot-review">
                  <span class="brand-name">
                      <i class="fas fa-star me-2"></i><?php echo esc_html( $optical_glasses_brand_name ); ?>
                  </span>
                  <span class="dot"><i class="fas fa-circle"></i></span>
                 <?php
                  $optical_glasses_rating_count = absint( get_theme_mod( 'optical_glasses_rating_count', 5 ) );

                  if ( $optical_glasses_rating_count > 5 ) {
                      $optical_glasses_rating_count = 5;
                  }

                  if ( $optical_glasses_rating_count > 0 ) : ?>
                      <div class="rating-stars">
                          <?php for ( $optical_glasses_i = 1; $optical_glasses_i <= $optical_glasses_rating_count; $optical_glasses_i++ ) : ?>
                              <span class="star"><i class="fas fa-star me-2"></i></span>
                          <?php endfor; ?>
                      </div>
                  <?php endif; ?>
                  <span class="review-count">
                      <?php echo esc_html( $optical_glasses_rating_no ); ?>
                  </span>
                  <span class="dot"><i class="fas fa-circle"></i></span>
                  <span class="rating-text">
                      <?php echo esc_html( $optical_glasses_rating_text ); ?>
                  </span>
                </div>
              </div>
            </div>
             
          </div>
          <div class="col-lg-6 col-md-5 slider-gallery-col">
            <?php
              $optical_glasses_hide_album_section = get_theme_mod(
                  'optical_glasses_disabled_album_section',
                  true
              );
              $optical_glasses_show_gallery = false;

              for ( $optical_glasses_i = 1; $optical_glasses_i <= 5; $optical_glasses_i++ ) {
                  if ( get_theme_mod( 'optical_glasses_gallery_image_' . $optical_glasses_i ) ) {
                      $optical_glasses_show_gallery = true;
                      break;
                  }
              }
              if ( $optical_glasses_hide_album_section && $optical_glasses_show_gallery ) :
              ?>
              <div class="slider-gallery">
                <div class="swiper mySwiper m-0">
                    <div class="swiper-wrapper">
                      <?php
                      for ( $optical_glasses_i = 1; $optical_glasses_i <= 5; $optical_glasses_i++ ) :
                          $optical_glasses_image = get_theme_mod( 'optical_glasses_gallery_image_' . $optical_glasses_i );

                          if ( ! empty( $optical_glasses_image ) ) :
                      ?>
                          <div class="swiper-slide album-content">
                              <div class="postbg-img">
                                  <img src="<?php echo esc_url( $optical_glasses_image ); ?>" alt="" class="post-image">
                              </div>
                          </div>
                      <?php
                          endif;
                      endfor;
                      ?>
                    </div>
                    <div class="swiper-button-next"></div>
                    <div class="swiper-button-prev"></div>
                </div>
              </div>
            <?php endif; ?>
          </div>
        </div>
      </div>
    </div>
    <div class="clearfix"></div>
  </section>

<?php endif; ?>