<?php 
/**
 * Hotspot Slider Template
 */
?>
<div id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $class ); ?>">
	<div class="pls-hotspot-wrapper">
		<div class="pls-hotspot-image-wrapper">
			<div class="pls-hotspot-image">
				<?php if( ! empty( $image_src ) ){ ?>
					<img src="<?php echo esc_url( $image_src ); ?>" alt="<?php echo esc_attr_e( 'Hotspot', 'modave-core' ); ?>">
				<?php } ?>
				<div class="pls-hotspot-items">
					<?php $i = 0;
					foreach ( $hotspot_items as $item ):
						if( ! empty( $item['product_id'] ) ){
							$product_id = $item['product_id'];
							$product 	= wc_get_product( $product_id ); 
							if( ! empty( $product ) ) { ?>
							<div class="pls-hotspot-item elementor-repeater-item-<?php echo esc_attr($item['_id']); ?>" data-index="<?php echo esc_attr($i); ?>">
								<span class="pls-hotspot-item-point"></span>
							</div>
							<?php }
						}
					$i++;
					endforeach ?>
				</div>
			</div>
		</div>
		<div class="pls-hotspot-content-wrapper">
			<div class="pls-hotspot-heading">
				<h3 class="pls-hotspot-title"><?php echo wp_kses_post( $title ); ?></h3>
				<div class="pls-hotspot-tagline"><?php echo esc_html( $title_tagline ); ?></div>
			</div>
			<div class="pls-hotspot-products">
				<?php
				global $post;
				$product_style 	= pls_get_loop_prop( 'product-style' );
				$products_columns = pls_get_loop_prop( 'products-columns' );
				$classes		= array();
				$classes[]	 	= 'products';
				$classes[]	 	= 'products-wrap';
				$classes[]	 	= 'grid-view';
				$classes[] 		= $product_style;
				$classes[]	 	= pls_get_option( 'product-bordered' , 0 ) ? 'pls-product-bordered' : '';
				$classes[] 		= 'swiper-wrapper';
				$classes[] 		= 'slider-col-xl-'.$slides_to_show;
				$classes[] 		= 'slider-col-lg-'.$slides_to_show_tablet;
				$classes[] 		= 'slider-col-md-'.$slides_to_show_tablet;
				$classes[] 		= 'slider-col-'.$slides_to_show_mobile;
				
				if ( pls_get_option( 'catalog-mode', 0 ) || ! pls_get_option( 'product-price' , 1 ) || ! pls_get_option( 'product-buttons', 1 ) || ! pls_get_option( 'product-cart-button', 1 ) || ( ! is_user_logged_in() && pls_get_option( 'login-to-see-price', 0 ) ) ) {
					$classes[] 	= 'pls-add-to-cart-button-effect-none';
				}
				
				if ( pls_get_option( 'product-quick-shop', 0 ) && in_array( $product_style, ['product-style-1', 'product-style-2', 'product-style-5'] ) ) {
					$classes[] 	= 'has-quick-shop';
				}
				
				if( apply_filters( 'pls_product_variation_on_hover', true ) ){
					$classes[] 	= 'pls-variation-on-hover';
				}
				
				$class_list = implode( ' ', $classes );
				$i = 0;
				$slider_data = array(
					'slider_navigation' 	=> false, 
					'slider_dots' 			=> false, 
					'slides_to_show' 		=> $slides_to_show, 
					'slides_to_show' 		=> $slides_to_show, 
					'slides_to_show_mobile' => $slides_to_show_mobile,
					'slides_to_show_tablet' => $slides_to_show_tablet,
				);
				$slide_to_show_attr = pls_slider_attributes( $slider_data );
				?>
				<div class="pls-hotspot-product-slider pls-slider row swiper" >
					<div class="<?php echo $class_list;?>" data-slider_options=<?php echo esc_attr($slide_to_show_attr); ?>>
						<?php 
						foreach ( $hotspot_items as $item ):
							if( ! empty( $item['product_id'] ) ){
								$product_id = $item['product_id'];
								$product 	= wc_get_product( $product_id ); 
								if( ! empty( $product ) ) {
									$post_object = get_post( $product_id );
									$GLOBALS['product'] = $product;
									$post = $post_object;
									setup_postdata( $post ); ?>
									<div class="swiper-slide pls-hotspot-slide-<?php echo esc_attr($i);?>" data-id="<?php echo esc_attr($i); ?>">
										<?php wc_get_template_part( 'content', 'product' ); ?>
									</div>
									<?php
								}
							}
						$i++;
						endforeach;
						wp_reset_postdata(); ?>
					</div>
				</div>
			</div>
			<?php if( ! empty( trim( $button_text ) ) ){ ?>
				<div class="pls-hotspot-view-btn">	
						<a class="button" <?php echo implode( ' ', $button_url ); ?> ><?php echo esc_html( $button_text ); ?></a>
				</div>
			<?php } ?>
		</div>
	</div>
</div>
