{% if trustpilot_item_reviews|length > 0 %}

    <div class="trustpilotProductReviewsHeader">
        <img src="/plugins/TrustpilotAPI/images/logo/light_bg/255x38.png" class="trustpilot_logo"/>
        <h5>{{ item.name }} Reviews</h5>
        <div class="innerReviewWrap">

            <div class="left">
                <img src="{{ truspilot_get_rating_image(all_trustpilot_item_reviews.starsAverage|round(0, 'floor')) }}"/>
                <p>Rated <b>{{ all_trustpilot_item_reviews.starsAverage }}</b> out of 5 based on <b>{{ trustpilot_item_reviews|length }}</b> reviews.</p>
            </div>

            <a href="#" class="trustpilotOverlay" data-filter=".trustpilotOverlayWrap">Read Reviews ({{ trustpilot_item_reviews|length }})<i class="fa fa-double-angle-right"></i></a>
        </div>
    </div>

    <div class="trustpilotOverlayWrap">

        <div class="trustpilotOverlayHeader">
            <h2>{{ item.name }} Reviews</h2>
        </div>

        <div class="trustpilotOverlayLeft">

            <div class="trustpilotAverage">
                <h5>Average Rating</h5>
                <img src="{{ truspilot_get_rating_image(all_trustpilot_item_reviews.starsAverage|round(0, 'floor')) }}"/>
                <p>Rated <b>{{ all_trustpilot_item_reviews.starsAverage }}</b> out of 5 based on <b>{{ trustpilot_item_reviews|length }}</b> reviews.</p>
            </div>

            <div class="trustpilotOverlayImage">
                <img src="{{ settings.SITE_URL }}/uploads/images/products/large/{{ item_image }}"  alt="{{ item.name }}" title="{{ item.name }}" />
            </div>

            <div class="trustpilotOverlayDetails">
                <span class="name"><strong>Product:</strong> {{ item.name }}</span>
                <span class="colour"><strong>Colour:</strong> {{ item.colour }}</span>
                <span class="price"><strong>Price:</strong>
                    {{ item.display_price|raw }}

                    {% if(item.sale_price) > 0 %}
                        <div class="salePercentage">
                            {% set percentagePrice = ((item.price - item.sale_price) / item.price) * 100 %}
                            {{ percentagePrice|round('0', 'floor') }}% off
                        </div>
                    {% endif %}
                </span>
            </div>

        </div>

        <ul class="trustpilotProductReviews2">
            {% for trustpilot_review in trustpilot_item_reviews %}
                <li class="trustpilotProductReviewWrapper">
                    <div class="trustpilotProductReview">

                        <div class="reviewHeader">
                            <h3><i class="fa fa-user"></i> {{ trustpilot_review.consumer.displayName }}</h3>
                        <img src="{{ truspilot_get_rating_image(trustpilot_review.stars) }}" alt="Trust Pilot Reviews of {{ config('app.name') }}" />
                        </div>
                        <div class="trustpilotProductDescription">{{ trustpilot_review.content }}</div>
                        <span class="date"><i class="fa fa-calendar-o"></i> Posted on {{ trustpilot_review.createdAt|date('dS F Y') }}</span>
                    </div>
                </li>
            {% endfor %}
        </ul>

        <div class="trustpilotOverlayPowered">
            Powered by <img src="/plugins/TrustpilotAPI/images/logo/light_bg/120x18.png" class="trustpilot_logo"/>
        </div>
        
    </div>
    
{% endif %}