<?php
/**
 * @package    JBusinessDirectory
 *
 * @author CMSJunkie http://www.cmsjunkie.com
 * @copyright  Copyright (C) 2007 - 2021 CMSJunkie. All rights reserved.
 * @license   https://www.gnu.org/licenses/agpl-3.0.en.html
 */ 
defined('_JEXEC') or die('Restricted access');
?>

<div class="review-scorecard">
<div class="row">
    <div class="col-md-8">
        <div class="row">
            <div class="col-md-5">
                <span class="heading"><?php echo JText::_("LNG_USER_RATING"); ?></span>
            </div>
            <div class="col-md-7" style="margin-top: 15px">
            <div class="rating">
                <span class="user-rating-avg rating-average-review" id="rating-average-review" title="<?php echo $this->offer->review_score?>" alt="<?php echo $this->offer->id?>" style="display: block;"></span>
            </div>
            </div>
        </div>
        <p><?php echo $this->offer->review_score." ". JText::_("LNG_AVERAGE_BASED_ON")." ". count($this->reviews)." ".JText::_("LNG_REVIEWS") ?></p>
    </div>
    <div class="col-md-4" style="padding: 30px">
        <a class="add-review-link btn btn-sm btn-success" href="javascript:void(0)" onclick="jbdReviews.addNewReview(<?php echo ($appSettings->enable_reviews_users && $user->id ==0) ?"1":"0"?>,false)"><?php echo JText::_("LNG_ADD_REVIEW") ?> <i class="la la-plus"></i></a>
    </div>
</div>
    <hr style="border:3px solid #f1f1f1">
<div class="row align-center">
    <div class="col-md-2">
        <div><?php echo JText::_("LNG_5_STAR"); ?></div>
    </div>
    <div class="col-md-8">
        <div class="bar-container">
            <div class="bar-5" style="width: <?php echo (count($this->reviewsStatistics[5])>0)?(count($this->reviewsStatistics[5])/count($this->reviews))*100:0 ?>%"></div>
        </div>
    </div>
    <div class="col-md-2 right">
        <div><?php echo count($this->reviewsStatistics[5]) ?></div>
    </div>
    <div class="col-md-2">
        <div><?php echo JText::_("LNG_4_STAR"); ?></div>
    </div>
    <div class="col-md-8">
        <div class="bar-container">
            <div class="bar-4" style="width: <?php echo (count($this->reviewsStatistics[4])>0)?(count($this->reviewsStatistics[4])/count($this->reviews))*100:0 ?>%"></div>
        </div>
    </div>
    <div class="col-md-2 right">
        <div><?php echo count($this->reviewsStatistics[4]) ?></div>
    </div>
    <div class="col-md-2">
        <div><?php echo JText::_("LNG_3_STAR"); ?></div>
    </div>
    <div class="col-md-8">
        <div class="bar-container">
            <div class="bar-3" style="width: <?php echo (count($this->reviewsStatistics[3])>0)?(count($this->reviewsStatistics[3])/count($this->reviews))*100:0 ?>%"></div>
        </div>
    </div>
    <div class="col-md-2 right">
        <div><?php echo count($this->reviewsStatistics[3]) ?></div>
    </div>
    <div class="col-md-2">
        <div><?php echo JText::_("LNG_2_STAR"); ?></div>
    </div>
    <div class="col-md-8">
        <div class="bar-container">
            <div class="bar-2" style="width: <?php echo (count($this->reviewsStatistics[2])>0)?(count($this->reviewsStatistics[2])/count($this->reviews))*100:0 ?>%"></div>
        </div>
    </div>
    <div class="col-md-2 right">
        <div><?php echo count($this->reviewsStatistics[2]) ?></div>
    </div>
    <div class="col-md-2">
        <div><?php echo JText::_("LNG_1_STAR"); ?></div>
    </div>
    <div class="col-md-8">
        <div class="bar-container">
            <div class="bar-1" style="width: <?php echo (count($this->reviewsStatistics[1])>0)?(count($this->reviewsStatistics[1])/count($this->reviews))*100:0 ?>%"></div>
        </div>
    </div>
    <div class="col-md-2 right">
        <div><?php echo count($this->reviewsStatistics[1]) ?></div>
    </div>
</div>

</div>