<script>
    var page = 1;
</script>
<?php if(count($product->reviews) > 0): ?>
    <?php if(count($product->reviews->where('approved', 1)->where('rating', '!=', null)) > 0): ?>
        <div class="col-md-12 product-detail-Ratings">
            <div class="col-md-4 detail-ratings-strat">
                <?php if(count($product->reviews->where('approved', 1)) > 0): ?>
                    <div class="text-center">
                        <h1><?php echo e($product->reviews->where('approved', 1)->where('rating', '!=', null)->avg('rating')); ?> <span class="glyphicon glyphicon-star" aria-hidden="true"></span></h1>
                        <div><?php echo e(count($product->reviews->where('approved', 1)->where('rating', '!=', null))); ?> <?php echo app('translator')->getFromJson('Ratings &'); ?> <?php echo e(count($product->reviews->where('approved', 1)->where('comment', '!=', null))); ?> <?php echo app('translator')->getFromJson('Reviews'); ?></div>
                    </div>
                <?php endif; ?>
            </div>
            <div class="col-xs-12 col-sm-6 col-md-6 col-lg-8 detail-reviews">
                <div class="col-md-12">
                    <h4 class="mt-0"><?php echo app('translator')->getFromJson('Reviews & Ratings'); ?></h4>

                    <div class="pull-left custom-review-star-css">
                        <div class="pull-left" style="width:35px; line-height:1;">
                            <div style="height:9px; margin:5px 0;">5 <span class="glyphicon glyphicon-star"></span></div>
                        </div>
                        <div class="pull-left" style="width:180px;">
                            <div class="progress" style="height:9px; margin:8px 0;">
                                <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="5" aria-valuemin="0" aria-valuemax="5" style="width: <?php echo e((count($product->reviews->where('approved', 1)->where('rating', 5)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>%">
                                    <span class="sr-only"><?php echo e((count($product->reviews->where('approved', 1)->where('rating', 5)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>% Complete (danger)</span>
                                </div>
                            </div>
                        </div>
                        <div class="pull-right" style="margin-left:10px;"><?php echo e(count($product->reviews->where('approved', 1)->where('rating', 5))); ?></div>
                    </div>
                    <div class="pull-left custom-review-star-css">
                        <div class="pull-left" style="width:35px; line-height:1;">
                            <div style="height:9px; margin:5px 0;">4 <span class="glyphicon glyphicon-star"></span></div>
                        </div>
                        <div class="pull-left" style="width:180px;">
                            <div class="progress" style="height:9px; margin:8px 0;">
                                <div class="progress-bar progress-bar-primary" role="progressbar" aria-valuenow="4" aria-valuemin="0" aria-valuemax="5" style="width: <?php echo e((count($product->reviews->where('approved', 1)->where('rating', 4)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>%">
                                    <span class="sr-only"><?php echo e((count($product->reviews->where('approved', 1)->where('rating', 4)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>% Complete (danger)</span>
                                </div>
                            </div>
                        </div>
                        <div class="pull-right" style="margin-left:10px;"><?php echo e(count($product->reviews->where('approved', 1)->where('rating', 4))); ?></div>
                    </div>
                    <div class="pull-left custom-review-star-css">
                        <div class="pull-left" style="width:35px; line-height:1;">
                            <div style="height:9px; margin:5px 0;">3 <span class="glyphicon glyphicon-star"></span></div>
                        </div>
                        <div class="pull-left" style="width:180px;">
                            <div class="progress" style="height:9px; margin:8px 0;">
                                <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="3" aria-valuemin="0" aria-valuemax="5" style="width: <?php echo e((count($product->reviews->where('approved', 1)->where('rating', 3)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>%">
                                    <span class="sr-only"><?php echo e((count($product->reviews->where('approved', 1)->where('rating', 3)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>% Complete (danger)</span>
                                </div>
                            </div>
                        </div>
                        <div class="pull-right" style="margin-left:10px;"><?php echo e(count($product->reviews->where('approved', 1)->where('rating', 3))); ?></div>
                    </div>
                    <div class="pull-left custom-review-star-css">
                        <div class="pull-left" style="width:35px; line-height:1;">
                            <div style="height:9px; margin:5px 0;">2 <span class="glyphicon glyphicon-star"></span></div>
                        </div>
                        <div class="pull-left" style="width:180px;">
                            <div class="progress" style="height:9px; margin:8px 0;">
                                <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="2" aria-valuemin="0" aria-valuemax="5" style="width: <?php echo e((count($product->reviews->where('approved', 1)->where('rating', 2)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>%">
                                    <span class="sr-only"><?php echo e((count($product->reviews->where('approved', 1)->where('rating', 2)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>% Complete (danger)</span>
                                </div>
                            </div>
                        </div>
                        <div class="pull-right" style="margin-left:10px;"><?php echo e(count($product->reviews->where('approved', 1)->where('rating', 2))); ?></div>
                    </div>
                    <div class="pull-left custom-review-star-css">
                        <div class="pull-left" style="width:35px; line-height:1;">
                            <div style="height:9px; margin:5px 0;">1 <span class="glyphicon glyphicon-star"></span></div>
                        </div>
                        <div class="pull-left" style="width:180px;">
                            <div class="progress" style="height:9px; margin:8px 0;">
                                <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="1" aria-valuemin="0" aria-valuemax="5" style="width: <?php echo e((count($product->reviews->where('approved', 1)->where('rating', 1)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>%">
                                    <span class="sr-only"><?php echo e((count($product->reviews->where('approved', 1)->where('rating', 1)) / count($product->reviews->where('approved', 1)->where('rating', '!=', null))) * 100); ?>% Complete (danger)</span>
                                </div>
                            </div>
                        </div>
                        <div class="pull-right" style="margin-left:10px;"><?php echo e(count($product->reviews->where('approved', 1)->where('rating', 1))); ?></div>
                    </div>
                </div>
            </div>
        </div>
    <?php endif; ?>

    <div id="approved_reviews" class="clearfix col-md-12">
        <ul class="comment-list">
            <?php echo $__env->make('includes.approved_reviews', ['reviews' => $product->reviews()->where('approved', 1)->orderBy('id', 'desc')->paginate(5)], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        </ul>
    </div>

    <?php if($product->reviews()->where('approved', 1)->count() > 0 ): ?>
        <div class="text-center">
            <button class="btn btn-sm hover-color-light" id="load-more"><?php echo app('translator')->getFromJson('Load More'); ?></button>
        </div>
    <?php endif; ?>
    <?php if(Auth::check()): ?>
        <ul class="comment-list">
            
            <?php echo $__env->make('includes.approved_reviews', ['reviews' => $product->reviews->where('approved', 0)->where('user_id', Auth::user()->id)], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        </ul>
    <?php endif; ?>
<?php else: ?>
    <div class="row text-center">
        <div class="empty-bag">
            <div class="empty-bag-icon">
                <img src="<?php echo e(asset('/img/icons/reviews.png')); ?>" class="img-responsive m-a" alt="<?php echo app('translator')->getFromJson('No Reviews'); ?>" width="100">
            </div>
            <h3 class="text-center text-muted"><?php echo app('translator')->getFromJson('NO REVIEWS FOUND'); ?></h3>
        </div>
    </div>
<?php endif; ?>