<div class="col-sm-12 hemo-reviews">
{% set remoteClickOptions = {
selector: "#review-tab",
scrollToElement: true
} %}
<div class="row" style="padding-left: 1rem; padding-right: 1rem; padding-top: 2rem">
<b style="display: block">Kundenbewertungen({{ reviews|length}})</b>
<style>
.bg-reviews{
background: darkgrey;
}
.color{
background: #8c1e2f;
}
</style>
<div style="display: flex; width: 100%;">
<div style="width: 40%; display: flex; justify-content: flex-start">
<b>{{ product.ratingAverage }}/5</b>
</div>
<div style="width: 60%; display: flex; justify-content: flex-end">
<div class="product-rating">
{% if product.ratingAverage %}
{% sw_include '@Storefront/storefront/component/review/rating.html.twig' with {
points: product.ratingAverage,
style: 'text-primary'
} %}
{% endif %}
</div>
</div>
</div>
{% set maxpoint = reviews.elements|length %}
{% set fivepoint = 0 %}
{% set fourpoint = 0 %}
{% set threepoint = 0 %}
{% set twopoint = 0 %}
{% set onepoint = 0 %}
{% for review in reviews.elements %}
{% if review.points >= 5 %} {% set fivepoint = fivepoint + 1 %} {% endif %}
{% if (review.points < 5) and (review.points >= 4) %} {% set fourpoint = fourpoint + 1 %} {% endif %}
{% if review.points < 4 and review.points >= 3 %} {% set threepoint = threepoint + 1 %} {% endif %}
{% if review.points < 3 and review.points >= 2 %} {% set twopoint = twopoint + 1 %} {% endif %}
{% if review.points < 2 and review.points >= 1 %} {% set onepoint = onepoint + 1 %} {% endif %}
{% endfor %}
<div style="width: 100%; position: relative; display: block; height: 20px">
<span style="position: absolute; top: -10px">5</span>
<div class="5point bg-reviews" style="margin-left: 20px; height: 2px;">
<div class="color" style="width:{% if fivepoint > 0 %}{{ (fivepoint / maxpoint) * 100 }}{% else %}{{ 0 }}{% endif %}%; height: 2px" ></div> </div>
</div>
<div style="width: 100%; position: relative; display: block; height: 20px">
<span style="position: absolute; top: -10px">4</span>
<div class="4point bg-reviews" style="margin-left: 20px; height: 2px;">
<div class="color" style="width:{% if fourpoint > 0 %}{{ (fourpoint / maxpoint) * 100 }}{% else %}{{ 0 }}{% endif %}%; height: 2px" ></div> </div>
</div>
<div style="width: 100%; position: relative; display: block; height: 20px">
<span style="position: absolute; top: -10px">3</span>
<div class="3point bg-reviews" style="margin-left: 20px; height: 2px;">
<div class="color" style="width:{% if threepoint > 0 %}{{ (threepoint / maxpoint) * 100 }}{% else %}{{ 0 }}{% endif %}%; height: 2px" ></div> </div>
</div>
<div style="width: 100%; position: relative; display: block; height: 20px">
<span style="position: absolute; top: -10px">2</span>
<div class="2point bg-reviews" style="margin-left: 20px; height: 2px;">
<div class="color"style="width:{% if twopoint > 0 %}{{ (twopoint / maxpoint) * 100 }}{% else %}{{ 0 }}{% endif %}%; height: 2px" ></div> </div>
</div>
<div style="width: 100%; position: relative; display: block; height: 20px">
<span style="position: absolute; top: -10px">1</span>
<div class="1point bg-reviews" style="margin-left: 20px; height: 2px;">
<div class="color" style="width:{% if onepoint > 0 %}{{ (onepoint / maxpoint) * 100 }}{% else %}{{ 0 }}{% endif %}%; height: 2px" ></div> </div>
</div>
<a
class="product-detail-reviews-link btn btn-secondary"
data-offcanvas-tabs="true"
data-remote-click="true"
data-remote-click-options='{{ remoteClickOptions|json_encode }}'
href="{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}?tab=review-tab-pane"
aria-controls="review-tab-pane">
{{ "detail.reviewLinkText"|trans({'%count%': maxpoint})|sw_sanitize }}
</a>
</div>
</div>