<?php
/**
 * The template for displaying product content in the single-product.php template
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/content-single-product.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you
 * (the theme developer) will need to copy the new files to your theme to
 * maintain compatibility. We try to do this as little as possible, but it does
 * happen. When this occurs the version of the template file will be bumped and
 * the readme will list any important changes.
 *
 * @see     https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce\Templates
 * @version 3.6.0
 */

defined( 'ABSPATH' ) || exit;

global $product;

/**
 * Hook: woocommerce_before_single_product.
 *
 * @hooked woocommerce_output_all_notices - 10
 */
do_action( 'woocommerce_before_single_product' );

if ( post_password_required() ) {
	echo get_the_password_form(); // WPCS: XSS ok.
	return;
}
?>
<div id="product-<?php the_ID(); ?>" <?php wc_product_class( '', $product ); ?>>
	<div class="row">
		<div class="col-12 col-lg-5">
			<div class="productpics">
	<?php
	/**
	 * Hook: woocommerce_before_single_product_summary.
	 *
	 * @hooked woocommerce_show_product_sale_flash - 10
	 * @hooked woocommerce_show_product_images - 20
	 */
	do_action( 'woocommerce_before_single_product_summary' );
	?>
			</div>
			<div class="productratearea">
				<div class="prorate">
					<?php
					$aaa = $product->get_average_rating() - 1;
					while ($aaa >= 0) {
					echo '<i class="fas fa-star"></i>';
					$aaa--;
					}
					if ($product->get_average_rating()==0) {
						echo '<i class="fas fa-star grayco"></i>'.'<i class="fas fa-star grayco"></i>'.'<i class="fas fa-star grayco"></i>'.'<i class="fas fa-star grayco"></i>'.'<i class="fas fa-star grayco"></i>';
					}
				 ?>


					<?php echo gajcommerce_change_number(round($product->get_average_rating())); ?> از <?php echo gajcommerce_change_number('5') ?>
					<div class="azchand"><span>(از <?php echo gajcommerce_change_number($product->get_rating_count());  ?> نظر)</span></div>

				</div>
				<div class="proshare">
					<span title="اشتراک گذاری" data-toggle="modal" data-target="#shareModal"><i class="fas fa-share-alt"></i></span>
					<div class="modal fade" id="shareModal">
					  <div class="modal-dialog modal-dialog-centered">
					    <div class="modal-content">
					      <!-- Share Modal Header -->
					      <div class="modal-header">
					        <h4 class="modal-title">اشتراک گذاری</h4>
					        <button type="button" class="close" data-dismiss="modal">
					            <i class="fas fa-times"></i>
					        </button>
					      </div>
					      <!-- Share Modal body -->
					      <div class="modal-body">
					        <ul class="social-box">
					            <li><a data-toggle="tooltip" data-placement="top" title="Facebook" href="http://www.facebook.com/sharer.php?u=<?php echo wp_get_shortlink(); ?>" target="_blank"><i class="fab fa-facebook-f" aria-hidden="true"></i></a></li>
					            <li><a data-toggle="tooltip" data-placement="top" title="Pinterest" href="http://pinterest.com/pin/create/link/?url=<?php echo wp_get_shortlink(); ?>" target="_blank"><i class="fab fa-pinterest-p" aria-hidden="true"></i></a></li>
					            <li><a data-toggle="tooltip" data-placement="top" title="Twitter" href="http://www.twitter.com/share?url=<?php echo wp_get_shortlink(); ?>" target="_blank"><i class="fab fa-twitter" aria-hidden="true"></i></a></li>
					            <li><a data-toggle="tooltip" data-placement="top" title="LinkedIn" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo wp_get_shortlink(); ?>" target="_blank"><i class="fab fa-linkedin-in" aria-hidden="true"></i></a></li>
					            <li><a data-toggle="tooltip" data-placement="top" title="Telegram" href="https://telegram.me/share/url?url=<?php echo wp_get_shortlink(); ?>" target="_blank"><i class="fab fa-telegram-plane" aria-hidden="true"></i></a></li>
					            <li><a data-toggle="tooltip" data-placement="top" title="Whatsapp" href="https://wa.me/?text=<?php echo wp_get_shortlink(); ?>" target="_blank"><i class="fab fa-whatsapp" aria-hidden="true"></i></a></li>
					            <li><a data-toggle="tooltip" data-placement="top" title="Email" href="mailto:?subject=<?php the_title(); ?>&body=<?php echo wp_get_shortlink(); ?>" target="_blank"><i class="far fa-envelope" aria-hidden="true"></i></a></li>
					        </ul>
					        <div class="short-con">
					            <span class="short-text">لینک محصول:</span>
					            <span class="short-link"><?php echo wp_get_shortlink(); ?></span>
					            <span data-toggle="tooltip" data-placement="top" title="کپی لینک محصول" class="short-btn" onclick="copyToClipboard('.short-link')"><i class="far fa-copy"></i></span>
					        </div>
					        <div class="link-copy">لینک کپی شد</div>
					      </div>

					    </div>
					  </div>
					</div>

					<?php if ( defined( 'WCCM_VERISON' ) ) {
						$product_id_com = get_the_ID();
						if ( in_array( $product_id_com, wccm_get_compare_list() ) ) {
								$url_com = wccm_get_compare_link( $product_id_com, 'remove-from-list' );
								$compare_title= 'حذف محصول از لیست مقایسه';
								$compare_class = "in-compare-list text-success";
						}else{
								$url_com = wccm_get_compare_link( $product_id_com, 'add-to-list' );
								$compare_title= 'افزودن محصول به لیست مقایسه';
								$compare_class = "out-compare-list";
						} ?>
						<a href="<?php echo $url_com; ?>">
						<span title="<?php echo $compare_title; ?>">
						<i aria-hidden="true" class="fa fa-random <?php echo $compare_class; ?>"></i>
						</span>
						</a>
					<?php } ?>

					<?php
					if (is_plugin_active( 'yith-woocommerce-wishlist/init.php' )) {
						echo do_shortcode("[yith_wcwl_add_to_wishlist]");
					} ?>
				</div>
			</div>
		</div>
		<div class="col-12 col-lg-7">
			<div class="productbuyarea">
		<?php
		/**
		 * Hook: woocommerce_single_product_summary.
		 *
		 * @hooked woocommerce_template_single_title - 5
		 * @hooked woocommerce_template_single_rating - 10
		 * @hooked woocommerce_template_single_price - 10
		 * @hooked woocommerce_template_single_excerpt - 20
		 * @hooked woocommerce_template_single_add_to_cart - 30
		 * @hooked woocommerce_template_single_meta - 40
		 * @hooked woocommerce_template_single_sharing - 50
		 * @hooked WC_Structured_Data::generate_product_data() - 60
		 */
		do_action( 'woocommerce_single_product_summary' );
		?>
		</div>
	</div>
</div>
	<?php
	/**
	 * Hook: woocommerce_after_single_product_summary.
	 *
	 * @hooked woocommerce_output_product_data_tabs - 10
	 * @hooked woocommerce_upsell_display - 15
	 * @hooked woocommerce_output_related_products - 20
	 */
	do_action( 'woocommerce_after_single_product_summary' );
	?>
	</div>
</div>

<?php do_action( 'woocommerce_after_single_product' ); ?>
