<?php 
/**
 * Dokan Vendors Template
 */
?>
<div id="<?php echo esc_attr($id);?>" class="<?php echo esc_attr( $class ); ?>">	
	<div class="<?php echo esc_attr( $wrapper ); ?>">
		<div class="pls-vendors-list <?php echo esc_attr( $grid_class ); ?>" <?php if(!empty( $slider_options ) ){ echo 'data-slider_options="'.esc_attr( $slider_options ).'"';  } ?> >
			<?php
			foreach ( $vendors as $key => $vendor_id ) {
				$vendor				= dokan()->vendor->get( $vendor_id );
				$store_banner_id	= $vendor->get_banner_id();
				$store_name			= $vendor->get_shop_name();
				$store_url			= $vendor->get_shop_url();
				$store_rating		= $vendor->get_rating();
				$store_phone		= $vendor->get_phone();
				$is_store_featured 	= $vendor->is_featured();
				$store_info			= dokan_get_store_info( $vendor_id);
				$store_address		= dokan_get_seller_short_address( $vendor_id );
				$store_banner_url	= $store_banner_id ? wp_get_attachment_image_src( $store_banner_id, 'full' ) : DOKAN_PLUGIN_ASSEST . '/images/default-store-banner.png';
				$has_bg_class 		= $store_banner_id ? "has-vendor-background" : ''; ?>
				<div class="pls-single-vendor woocommerce<?php echo esc_attr( $column_class ); ?>">
					<div class="pls-vendor-wrapper">
						<div class="pls-vendor-image">
							<img src="<?php echo is_array( $store_banner_url ) ? esc_attr( $store_banner_url[0] ) : esc_attr( $store_banner_url ); ?>"/>
							<?php if ( $is_store_featured ) : ?>
								<div class="pls-vendor-featured"><?php esc_html_e( 'Featured', 'anvogue-core' ); ?></div>
							<?php endif ?>
						</div>
						<div class="pls-vendor-content">
							<div class="pls-store-data">
								<h2><?php echo esc_html( $store_name ); ?></h2>
								<?php if ( ! empty( $store_rating['count'] ) ) { ?>
									<div class="pls-store-rating">
										<div class="star-rating" title="<?php echo sprintf( esc_attr__( 'Rated %s out of 5', 'anvogue-core' ), esc_attr( $store_rating['rating'] ) ) ?>">
											<span style="width: <?php echo ( esc_attr( ( $store_rating['rating'] / 5 ) ) * 100 - 1 ); ?>%">
												<strong class="rating"><?php echo esc_html( $store_rating['rating'] ); ?></strong> <?php esc_html_e( 'out of 5', 'anvogue-core' ); ?>
											</span>
										</div>
									</div>
								<?php } ?>
								
								<?php if ( $store_address || $store_phone ){ ?>
									<ul class="pls-store-info">
										<?php if ( $store_address ){
											$allowed_tags = array(
												'span' => array(
													'class' => array(),
												),
												'br' => array()
											); ?>
											<li class="store-address"><?php echo wp_kses( $store_address, $allowed_tags ); ?></li>
										<?php } ?>
										
										<?php if ( $store_phone ) { ?>
											<li class="store-phone"><?php echo esc_html( $store_phone ); ?></li>
										<?php } ?>
									</ul>
								<?php } ?>
								<a class="button pls-store-link" href="<?php echo esc_attr( $store_url ); ?>"><?php esc_html_e( 'Visit Store', 'anvogue-core' )?></a>
							</div>
							<div class="pls-vendor-avatar">
								<?php echo get_avatar( $vendor_id, 150 ); ?>						
							</div>
						</div>
					</div>
				</div>	
			<?php } ?>
		</div>
	</div>
</div>